question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Importing the numpy c-extensions failed.

See original GitHub issue

Using Pyinstaller to create executable, Get Importing the numpy c-extensions failed.

Reproducing code example:

F:\PCS\Documents\Python>type numpytest.py
# -*- coding: utf-8 -*-

import numpy as np
x = np.array([1,2,3])
print(x)
##works fine in python...
python numpytest.py
[1 2 3]
## build with pyinstaller, no errors
pyinstaller -F numpytest.py 

Error message:

>numpytest.exe
Traceback (most recent call last):
  File "f:\python38\lib\site-packages\numpy\core\__init__.py", line 24, in <module>
    from . import multiarray
  File "f:\python38\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 627, in exec_module
    exec(bytecode, module.__dict__)
  File "f:\python38\lib\site-packages\numpy\core\multiarray.py", line 14, in <module>
    from . import overrides
  File "f:\python38\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 627, in exec_module
    exec(bytecode, module.__dict__)
  File "f:\python38\lib\site-packages\numpy\core\overrides.py", line 7, in <module>
    from numpy.core._multiarray_umath import (
ImportError: DLL load failed while importing _multiarray_umath: The specified module could not be found.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "F:\PCS\Documents\Python\numpytest.py", line 9, in <module>
    import numpy as np
  File "f:\python38\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 627, in exec_module
    exec(bytecode, module.__dict__)
  File "f:\python38\lib\site-packages\numpy\__init__.py", line 142, in <module>
    from . import core
  File "f:\python38\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 627, in exec_module
    exec(bytecode, module.__dict__)
  File "f:\python38\lib\site-packages\numpy\core\__init__.py", line 54, in <module>
    raise ImportError(msg)
ImportError:

IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!

Importing the numpy c-extensions failed.
- Try uninstalling and reinstalling numpy.
- If you have already done that, then:
  1. Check that you expected to use Python3.8 from "F:\PCS\Documents\Python\dist\numpytest.exe",
     and that you have no directories in your PATH or PYTHONPATH that can
     interfere with the Python and numpy version "1.18.0" you're trying to use.
  2. If (1) looks fine, you can open a new issue at
     https://github.com/numpy/numpy/issues.  Please include details on:
     - how you installed Python
     - how you installed numpy
     - your operating system
     - whether or not you have multiple versions of Python installed
     - if you built from source, your compiler versions and ideally a build log

- If you're working with a numpy git repository, try `git clean -xdf`
  (removes all files not under version control) and rebuild numpy.

Note: this error has many possible causes, so please don't comment on
an existing issue about this - open a new one instead.

Original error was: DLL load failed while importing _multiarray_umath: The specified module could not be found.

[19036] Failed to execute script numpytest

Actions Take:

uninstalled and reinstalled numpy.

Numpy/Python version information:

Python 3.8.1 numpy 1.18.0 PyInstaller 3.5

1.18.0 3.8.1 (tags/v3.8.1:1b293b6, Dec 18 2019, 23:11:46) [MSC v.1916 64 bit (AMD64)]

Path: F:\Python38\Scripts
F:\Python38\

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6

github_iconTop GitHub Comments

26reactions
matalabcommented, Feb 6, 2020

OK, I solved it! This is problem with conda (Anaconda). numpy must be reinstalled by pip: pip install --upgrade --force-reinstall numpy

0reactions
osahenecommented, Aug 24, 2020

Simply uninstall numpy and reinstall it. The problem will be solved.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Importing the numpy c-extensions failed - python
This issue is caused by VScode default terminal (powershell) setting, To switch VScode default terminal from powershell to cmd, the conda env ...
Read more >
Troubleshooting ImportError — NumPy v1.25.dev0 Manual
Importing the numpy c-extensions failed. This error can happen for different reasons, often due to issues with your setup.
Read more >
Fixed - Importing the numpy C-extensions failed error
I was facing this error on MacOS while using numpy in python. Importing the numpy C-extensions failed. This error can happen for many...
Read more >
Importing the numpy c-extensions failed in MacOS-numpy
Importing the numpy c -extensions failed I am trying to use numpy in terminal, when i imported it it returned an error.But whe...
Read more >
2022.8.0 Setup failed for influxdb - Importing the numpy C- ...
Importing the numpy C -extensions failed. This error can happen for many reasons, often due to issues with your setup or how NumPy...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found