Bug 2369423

Summary: python-rasterio fails to build with Python 3.14: Multiprocessing switched the default context method from fork to forkserver
Product: [Fedora] Fedora Reporter: Karolina Surma <ksurma>
Component: python-rasterioAssignee: Elliott Sales de Andrade <quantum.analyst>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: epel-packagers-sig, fti-bugs, jonathan, ksurma, mhroncok, python-packagers-sig, quantum.analyst
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: python-rasterio-1.4.3-5.fc43 Doc Type: ---
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2025-06-11 21:56:16 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: 2322407, 2339432, 2339435, 2371875, 2371844    

Description Karolina Surma 2025-05-30 14:53:34 UTC
python-rasterio fails to build with Python 3.14.0b2.

______________ ERROR at setup of test_reproject_error_propagation ______________

data = local('/tmp/pytest-of-mockbuild/pytest-0/test_reproject_error_propagati0')

    @pytest.mark.network
    @pytest.fixture
    def http_error_server(data):
        """Serves files from the test data directory, poorly."""
        import functools
        import multiprocessing
        import http.server
    
        Handler = functools.partial(RangeRequestErrorHandler, directory=str(data))
        httpd = http.server.HTTPServer(("", 0), Handler)
        p = multiprocessing.Process(target=httpd.serve_forever)
>       p.start()

tests/test_warp.py:2126: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/usr/lib64/python3.14/multiprocessing/process.py:121: in start
    self._popen = self._Popen(self)
/usr/lib64/python3.14/multiprocessing/context.py:224: in _Popen
    return _default_context.get_context().Process._Popen(process_obj)
/usr/lib64/python3.14/multiprocessing/context.py:300: in _Popen
    return Popen(process_obj)
/usr/lib64/python3.14/multiprocessing/popen_forkserver.py:35: in __init__
    super().__init__(process_obj)
/usr/lib64/python3.14/multiprocessing/popen_fork.py:20: in __init__
    self._launch(process_obj)
/usr/lib64/python3.14/multiprocessing/popen_forkserver.py:47: in _launch
    reduction.dump(process_obj, buf)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

obj = <Process name='Process-9' parent=2132 initial>
file = <_io.BytesIO object at 0x7f384f02fa60>, protocol = None

    def dump(obj, file, protocol=None):
        '''Replacement for pickle.dump() using ForkingPickler.'''
>       ForkingPickler(file, protocol).dump(obj)
E       TypeError: cannot pickle '_thread.lock' object
E       when serializing dict item '_lock'
E       when serializing threading.Condition state
E       when serializing threading.Condition object
E       when serializing dict item '_cond'
E       when serializing threading.Event state
E       when serializing threading.Event object
E       when serializing dict item '_BaseServer__is_shut_down'
E       when serializing http.server.HTTPServer state
E       when serializing http.server.HTTPServer object
E       when serializing tuple item 0
E       when serializing method reconstructor arguments
E       when serializing method object
E       when serializing dict item '_target'
E       when serializing multiprocessing.context.Process state
E       when serializing multiprocessing.context.Process object

See: https://docs.python.org/dev/whatsnew/3.14.html#multiprocessing

The default start method changed from fork to forkserver on platforms other than macOS and Windows where it was already spawn.
If the threading incompatible fork method is required, you must explicitly request it via a context from multiprocessing.get_context() (preferred) or change the default via multiprocessing.set_start_method().
See forkserver restrictions for information and differences with the fork method and how this change may affect existing code with mutable global shared variables and/or shared objects that can not be automatically pickled.

For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.14-b1/fedora-rawhide-x86_64/09104864-python-rasterio/

For all our attempts to build python-rasterio with Python 3.14, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.14-b1/package/python-rasterio/

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.14:
https://copr.fedorainfracloud.org/coprs/g/python/python3.14-b1/

Let us know here if you have any questions.

Python 3.14 is planned to be included in Fedora 43.
To make that update smoother, we're building Fedora packages with all pre-releases of Python 3.14.
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 Karolina Surma 2025-06-11 16:03:33 UTC
*** Bug 2372095 has been marked as a duplicate of this bug. ***

Comment 2 Fedora Update System 2025-06-11 21:51:57 UTC
FEDORA-2025-97df8aa651 (python-rasterio-1.4.3-5.fc43) has been submitted as an update to Fedora 43.
https://bodhi.fedoraproject.org/updates/FEDORA-2025-97df8aa651

Comment 3 Fedora Update System 2025-06-11 21:56:16 UTC
FEDORA-2025-97df8aa651 (python-rasterio-1.4.3-5.fc43) has been pushed to the Fedora 43 stable repository.
If problem still persists, please make note of it in this bug report.