I have been trying to install numpy to run some code that was made by someone else. The issue I am having is that when I run the code a numpy Import Error is thrown telling me that I am missing required c files.
I am running the code in an anaconda env
- Conda version 24.5.0
- Python version 3.11
- Numpy version 2.0.0
- Numpy-base version 1.26.4
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.11 from "C:UsersVinr5anaconda3envsresearchpython.exe"
* The NumPy version is: "2.0.0"
and make sure that they are the versions you expect.
Please carefully study the documentation linked above for further help.
Original error was: DLL load failed while importing _multiarray_umath: The paging file is too small for this operation to complete.
...
This is accompanied by a long error message which I will have to cut short to fit StackOverflow’s post requirements
Could not import runpy module
Fatal Python error: Could not import runpy module
init_import_siteException in Tkinter callback
init_import_siteFatal Python error: Could not import runpy module
Could not import runpy module
Could not import runpy module
Could not import runpy module
: : init_import_siteFatal Python error: Traceback (most recent call last):
Traceback (most recent call last):
Traceback (most recent call last):
Traceback (most recent call last):
Traceback (most recent call last):
Fatal Python error: Could not import runpy module
Traceback (most recent call last):
File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
Traceback (most recent call last):
Traceback (most recent call last):
Traceback (most recent call last):
Traceback (most recent call last):
Traceback (most recent call last):
Traceback (most recent call last):
Traceback (most recent call last):
File "C:UsersVinr5anaconda3envsresearchLibsite-packagesnumpy_core__init__.py", line 23, in <module>
from . import multiarray
File "C:UsersVinr5anaconda3envsresearchLibsite-packagesnumpy_coremultiarray.py", line 10, in <module>
from . import overrides
File "C:UsersVinr5anaconda3envsresearchLibsite-packagesnumpy_coreoverrides.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 "C:UsersVinr5anaconda3envsresearchLibsite-packagesnumpy__init__.py", line 128, in <module>
Traceback (most recent call last):
Traceback (most recent call last):
Traceback (most recent call last):
from numpy.__config__ import show as show_config
Traceback (most recent call last):
File "C:UsersVinr5anaconda3envsresearchLibsite-packagesnumpy__config__.py", line 4, in <module>
Traceback (most recent call last):
Traceback (most recent call last):
Traceback (most recent call last):
Could not import runpy module
Could not import runpy module
from numpy._core._multiarray_umath import (
File "<frozen runpy>", line 189, in _run_module_as_main
Could not import runpy module
File "C:UsersVinr5anaconda3envsresearchLibsite-packagesnumpy_core__init__.py", line 49, in <module>
Traceback (most recent call last):
Traceback (most recent call last):
Traceback (most recent call last):
Could not import runpy module
Could not import runpy module
Traceback (most recent call last):
raise ImportError(msg)
File "<frozen runpy>", line 189, in _run_module_as_main
File "<frozen runpy>", line 189, in _run_module_as_main
Traceback (most recent call last):
Traceback (most recent call last):
Traceback (most recent call last):
Traceback (most recent call last):
File "<frozen runpy>", line 189, in _run_module_as_main
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.11 from "C:UsersVinr5anaconda3envsresearchpython.exe"
* The NumPy version is: "2.0.0"
Following the link in the error message I have done the following
- Verified that I have the correct numpy and python version installed
- Uninstalled and reinstalled numpy through
conda install -c conda-forge numpy
- Uninstalled and reinstalled numpy through
pip install numpy
. Taking care that I have removed numpy from the environment before I pip install numpy. - I have tried all of these on conda version 4.10, 4.14, 22.3, 24.5
- I have removed all other installations of python that aren’t the anaconda specific installation as well as their environment variable paths
- Building numpy from source following their directions failed on the final step because package metadata generation failed.
All of these things I have tried on two computers and have gotten the same results.
Arye Oskotsky is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.