I'm on OSX 13.4 and run into issues when importing numpy:
code = "import numpy as np;"
result = execute_python_code(code)
print(result)
OpenBLAS blas_thread_init: pthread_create failed for thread 9 of 10: Resource temporarily unavailable
OpenBLAS blas_thread_init: RLIMIT_NPROC -1 current, -1 max
Traceback (most recent call last):
File "/home/pythonuser/.local/lib/python3.12/site-packages/numpy/core/__init__.py", line 24, in <module>
from . import multiarray
File "/home/pythonuser/.local/lib/python3.12/site-packages/numpy/core/multiarray.py", line 10, in <module>
from . import overrides
File "/home/pythonuser/.local/lib/python3.12/site-packages/numpy/core/overrides.py", line 8, in <module>
from numpy.core._multiarray_umath import (
ImportError: PyCapsule_Import could not import module "datetime"
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/pythonuser/.local/lib/python3.12/site-packages/numpy/__init__.py", line 130, in <module>
from numpy.__config__ import show as show_config
File "/home/pythonuser/.local/lib/python3.12/site-packages/numpy/__config__.py", line 4, in <module>
from numpy.core._multiarray_umath import (
File "/home/pythonuser/.local/lib/python3.12/site-packages/numpy/core/__init__.py", line 50, in <module>
raise ImportError(msg)
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: Python3.12 from "/usr/local/bin/python"
* The NumPy version is: "1.26.4"
and make sure that they are the versions you expect.
Please carefully study the documentation linked above for further help.
Original error was: PyCapsule_Import could not import module "datetime"
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/code/script_90dc180aeb79403687bbcc2d2cf2ace0.py", line 1, in <module>
import numpy as np;
^^^^^^^^^^^^^^^^^^
File "/home/pythonuser/.local/lib/python3.12/site-packages/numpy/__init__.py", line 135, in <module>
raise ImportError(msg) from e
ImportError: Error importing numpy: you should not try to import numpy from
its source directory; please exit the numpy source tree, and relaunch
your python interpreter from there.
I'm on OSX 13.4 and run into issues when importing numpy:
The selected answer for this Stack overflow question seems to point to a solution and OpenBLAS says something about it in their FAQ (see comment at selected answer).