Skip to content

cantera fails to build with Python 3.11: ValueError: invalid mode: 'rU' #1325

Closed
@mefuller

Description

@mefuller

Reported in full at https://bugzilla.redhat.com/show_bug.cgi?id=2094258

Problem description

cantera fails to build with Python 3.11.0b3.

Steps to reproduce

ValueError: invalid mode: 'rU':
File "/builddir/build/BUILD/cantera-2.6.0/SConstruct", line 2020:
SConscript("build/python/SConscript")
File "/usr/lib/python3.11/site-packages/SCons/Script/SConscript.py", line 660:
return method(*args, **kw)
File "/usr/lib/python3.11/site-packages/SCons/Script/SConscript.py", line 597:
return _SConscript(self.fs, *files, **subst_kw)
File "/usr/lib/python3.11/site-packages/SCons/Script/SConscript.py", line 285:
exec(compile(scriptdata, scriptname, 'exec'), call_stack[-1].globals)
File "/builddir/build/BUILD/cantera-2.6.0/build/python/SConscript", line 98:
setup_cfg = localenv.SubstFile("setup.cfg", "setup.cfg.in")
File "/usr/lib/python3.11/site-packages/SCons/Util.py", line 742:
return self.method(*nargs, **kwargs)
File "/builddir/build/BUILD/cantera-2.6.0/site_scons/site_tools/subst.py", line 154:
return env.SubstGeneric(target,
File "/usr/lib/python3.11/site-packages/SCons/Environment.py", line 238:
return super().call(target, source, *args, **kw)
File "/usr/lib/python3.11/site-packages/SCons/Util.py", line 742:
return self.method(*nargs, **kwargs)
File "/usr/lib/python3.11/site-packages/SCons/Builder.py", line 662:
return self._execute(env, target, source, OverrideWarner(kw), ekw)
File "/usr/lib/python3.11/site-packages/SCons/Builder.py", line 568:
tlist, slist = self._create_nodes(env, target, source)
File "/usr/lib/python3.11/site-packages/SCons/Builder.py", line 530:
target, source = self.emitter(target=tlist, source=slist, env=env)
File "/builddir/build/BUILD/cantera-2.6.0/site_scons/site_tools/subst.py", line 124:
keys = _subst_keys(path, pattern)
File "/builddir/build/BUILD/cantera-2.6.0/site_scons/site_tools/subst.py", line 49:
f = open(source, "rU")
error: Bad exit status from /var/tmp/rpm-tmp.S5BgPF (%build)

open(), io.open(), codecs.open() and fileinput.FileInput no longer accept 'U' (“universal newline”) in the file mode. This flag was deprecated since Python 3.3. In Python 3, the “universal newline” is used by default when a file is open in text mode. The newline parameter of open() controls how universal newlines works. (Contributed by Victor Stinner in bpo-37330.)

https://bugs.python.org/issue?@action=redirect&bpo=37330
https://docs.python.org/3.11/whatsnew/3.11.html

For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.11/fedora-rawhide-x86_64/04495077-cantera/

For all our attempts to build cantera with Python 3.11, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.11/package/cantera/

Testing and mass rebuild of packages is happening in copr. You can follow these instructions to test locally in mock if your package builds with Python 3.11:
https://copr.fedorainfracloud.org/coprs/g/python/python3.11/

Let us know here if you have any questions.

Python 3.11 is planned to be included in Fedora 37. To make that update smoother, we're building Fedora packages with all pre-releases of Python 3.11.
A build failure prevents us from testing all dependent packages (transitive [Build]Requires), so if this package is required a lot, it's important for us to get it fixed soon.
We'd appreciate help from the people who know this package best, but if you don't want to work on this now, let us know so we can try to work around it on our side.

System information

  • Cantera version: 2.6.0 release
  • OS: Fedora Linux 37/rawhide
  • Python/MATLAB/other software versions: Python 3.11b

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions