Bug 2034574

Summary: apbs fails to build with Python 3.11: ValueError: invalid mode: 'rU'
Product: [Fedora] Fedora Reporter: Tomáš Hrnčiar <thrnciar>
Component: apbsAssignee: Antonio T. sagitter <trpost>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: mhroncok, thrnciar, tim.fenn
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-01-04 16:59:08 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 2016048    

Description Tomáš Hrnčiar 2021-12-21 11:07:18 UTC
apbs fails to build with Python 3.11.0a3.

Traceback (most recent call last):
  File "/builddir/build/BUILD/apbs-3.0.0/tests/./apbs_tester.py", line 339, in <module>
    sys.exit(main())
             ^^^^^^
  File "/builddir/build/BUILD/apbs-3.0.0/tests/./apbs_tester.py", line 332, in main
    run_test(binary, config.items(test_name), test_name, test_directory, test_setup, logger, options.ocd)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/builddir/build/BUILD/apbs-3.0.0/tests/./apbs_tester.py", line 184, in run_test
    computed_results = process_parallel(binary, input_file, procs, logger)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/builddir/build/BUILD/apbs-3.0.0/tests/./apbs_tester.py", line 111, in process_parallel
    split_input(input_file)
    ^^^^^^^^^^^^^^^^^^^^^^^
  File "/builddir/build/BUILD/apbs-3.0.0/tests/../tools/manip/inputgen.py", line 269, in split_input
    file = open(filename, 'rU')
           ^^^^^^^^^^^^^^^^^^^^
ValueError: invalid mode: 'rU'

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/issue37330
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/03052569-apbs/

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

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.

Comment 1 Antonio T. sagitter 2021-12-26 11:34:11 UTC
Python-3.11 Copr project is currently unworkable:

Error: 
 Problem: package python3-numpy-1:1.21.5-1.fc36.x86_64 requires python(abi) = 3.10, but none of the providers can be installed
  - package python3-devel-3.11.0~a3-2.fc36.x86_64 conflicts with python3 < 3.11.0~a3-2.fc36 provided by python3-3.10.1-1.fc36.i686
  - package python3-devel-3.11.0~a3-2.fc36.x86_64 conflicts with python3 < 3.11.0~a3-2.fc36 provided by python3-3.10.1-1.fc36.x86_64
  - cannot install the best candidate for the job
(try to add '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)

Comment 2 Tomáš Hrnčiar 2022-01-03 08:42:44 UTC
It was caused by new version of numpy which wasn't building with Python 3.11. I've backported upstreams commit and opened PR to bring it to Fedora [0]. With fixed numpy, apbs fails again with the failure reported in this bugzilla [1]. 

[0] https://src.fedoraproject.org/rpms/numpy/pull-request/20
[1] https://copr.fedorainfracloud.org/coprs/g/python/python3.11/build/3122346/

Comment 3 Antonio T. sagitter 2022-01-04 15:42:14 UTC
This bug should be fixed in build release 'apbs-3.0.0-13'