Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImportError: numpy.core.multiarray failed to import #4368

Closed
Cranbaerry opened this issue Aug 9, 2019 · 5 comments
Closed

ImportError: numpy.core.multiarray failed to import #4368

Cranbaerry opened this issue Aug 9, 2019 · 5 comments
Labels
state:need info Need more information for solve or help.

Comments

@Cranbaerry
Copy link

Cranbaerry commented Aug 9, 2019

Hi,

I'm working on a project and this is my first time trying out pyinstaller and I have encountered this issue upon opening my compiled program: ImportError: numpy.core.multiarray failed to import

I'm using the following versions:

  • Python 3.7.4
  • Numpy 1.17.0
  • PyInstaller-4.0.dev0+515bf55a4

I am running this in a virtual environment, and I have tried to use hiddenimport for "numpy" and specifically "numpy.core.multiarray", but to no avail. Still same error.

This is the program's console output in Windows Powershell.

PS D:\Documents\EasyAK\dist\main> .\main.exe
ImportError: numpy.core.multiarray failed to import
Traceback (most recent call last):
File "main.py", line 5, in
File "d:\documents\easyak\venv\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 621, in exec_module
exec(bytecode, module.dict)
File "imagesearch.py", line 1, in
File "d:\documents\easyak\venv\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 621, in exec_module
exec(bytecode, module.dict)
File "lib\site-packages\cv2_init_.py", line 3, in
ImportError: numpy.core.multiarray failed to import
[7632] Failed to execute script main
PS D:\Documents\EasyAK\dist\main>

@htgoebel
Copy link
Member

htgoebel commented Aug 9, 2019

This looks like not all required files are packages. Please have a look at Make sure everything is packaged correctly for tips to find out what is missing.

@htgoebel htgoebel added the state:need info Need more information for solve or help. label Aug 9, 2019
@Cranbaerry
Copy link
Author

Hi,

Thank you for replying, I have just downgraded numpy to version 1.16.4 and it seems to be working fine without any issues.

I'm sorry, I do not understand what you mean by "not all required files are packages". I have looked over the website you linked, I did try both --onedir and --onefile. And --noupx or set upx=False. They all did not work.

@atvKumar
Copy link

atvKumar commented Aug 9, 2019

I recently did numpy and had simmilar issues. Add the module in hidden imports and try again.
e.g - hiddenimports=['numpy.random.common', 'numpy.random.bounded_integers', 'numpy.random.entropy']

@htgoebel
Copy link
Member

htgoebel commented Aug 9, 2019

That's a good start. Now continue debugging by following the other hints. (Or close this issue.)

@Cranbaerry
Copy link
Author

@atvKumar It works, thank you.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 17, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
state:need info Need more information for solve or help.
Projects
None yet
Development

No branches or pull requests

3 participants