-
-
Notifications
You must be signed in to change notification settings - Fork 33.8k
Closed
Labels
pendingThe issue will be closed if no feedback is providedThe issue will be closed if no feedback is providedstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytopic-subinterpreterstype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Bug report
Bug description:
This would appear to be a regression, as ProcessPoolExecutor can work with numpy arrays. I would hazard it has something to do with the optimisations around sharing data types like bytes and str between interpreters (InterpreterPoolExecutor is much faster than ProcessPoolExecutor when transferring these instances of these classes).
import numpy as np
from operator import pos as identity # pickle-able "identity" function
from concurrent.futures import InterpreterPoolExecutor, ProcessPoolExecutor
arr = np.array(range(10))
with InterpreterPoolExecutor() as executor:
result = executor.submit(identity, arr).result()
# ^-- raises NotShareableError: args not shareable
assert np.all(arr == result)Replace InterpreterProcessPoolExecutor with ProcessPoolExecutor and the above snippet works just fine.
Wasn't sure if this was best placed as a Python bug or a Numpy bug. I opted for Python as ProcessPoolExecutor does work with numpy arrays.
Stack trace
Exception: Traceback (most recent call last):
File "/home/jackh/python/venv3.14/lib/python3.14/site-packages/numpy/_core/__init__.py", line 22, in <module>
from . import multiarray
File "/home/jackh/python/venv3.14/lib/python3.14/site-packages/numpy/_core/multiarray.py", line 11, in <module>
from . import _multiarray_umath, overrides
ImportError: module numpy._core._multiarray_umath does not support loading in subinterpreters
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/jackh/python/venv3.14/lib/python3.14/site-packages/numpy/__init__.py", line 112, in <module>
from numpy.__config__ import show_config
File "/home/jackh/python/venv3.14/lib/python3.14/site-packages/numpy/__config__.py", line 4, in <module>
from numpy._core._multiarray_umath import (
...<3 lines>...
)
File "/home/jackh/python/venv3.14/lib/python3.14/site-packages/numpy/_core/__init__.py", line 83, in <module>
raise ImportError(msg) from exc
ImportError:
IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!
Importing the numpy C-extensions failed. This error can happen for
many reasons, often due to issues with your setup or how NumPy was
installed.
We have compiled some common reasons and troubleshooting tips at:
https://numpy.org/devdocs/user/troubleshooting-importerror.html
Please note and check the following:
* The Python version is: Python 3.14 from "/home/jackh/python/venv3.14/bin/python"
* The NumPy version is: "2.4.0"
and make sure that they are the versions you expect.
Please carefully study the information and documentation linked above.
This is unlikely to be a NumPy issue but will be caused by a bad install
or environment on your machine.
Original error was: module numpy._core._multiarray_umath does not support loading in subinterpreters
The above exception was the direct cause of the following exception:
concurrent.interpreters.NotShareableError: object could not be unpickled
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "<python-input-0>", line 7, in <module>
result = executor.submit(identity, arr).result()
File "/usr/local/lib/python3.14/concurrent/futures/_base.py", line 450, in result
return self.__get_result()
~~~~~~~~~~~~~~~~~^^
File "/usr/local/lib/python3.14/concurrent/futures/_base.py", line 395, in __get_result
raise self._exception
File "/usr/local/lib/python3.14/concurrent/futures/thread.py", line 86, in run
result = ctx.run(self.task)
File "/usr/local/lib/python3.14/concurrent/futures/interpreter.py", line 84, in run
return self.interp.call(do_call, self.results, *task)
~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.14/concurrent/interpreters/__init__.py", line 238, in call
return self._call(callable, args, kwargs)
~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.14/concurrent/interpreters/__init__.py", line 220, in _call
res, excinfo = _interpreters.call(self._id, callable, args, kwargs, restrict=True)
~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
concurrent.interpreters.NotShareableError: args not shareable
CPython versions tested on:
3.14
Operating systems tested on:
Linux
Metadata
Metadata
Assignees
Labels
pendingThe issue will be closed if no feedback is providedThe issue will be closed if no feedback is providedstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytopic-subinterpreterstype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Projects
Status
Done