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 #42441
Comments
Could you give an example repro? |
@WestbrookZero, could you please ensure your change in spec not reset. (https://stackoverflow.com/questions/49083667/updating-spec-file-for-pyinstaller-gets-reset) Strictly, It's a pyInstaller issue rather than pytorch issue. |
My environment is Win10 , Pytorch:1.6.0+cpu、Torchvision:0.7.0+cpu、numpy:1.19.2,use pyinstaller:4.0 to make an .exe file, have try to change numpy to 1.18.5 or 1.17.5 or 1.15.0 still have this error : |
|
@zhousteven , could you try the below in your app.sepc |
@mszhanyi i have try this way, still occuring the same error |
@zhousteven Could you please tailor you project and provide a small demo for us? |
@peterjc123 Have tried your idea, when i only import the relate packages, there isn't an error occring, when i use .exe file; the code coped below: -- encoding:utf-8 --import numpy from PIL import Image but when i use pyinstaller compile contain invoking load model which trained by pytorch,occuring the error. |
@mszhanyi @peterjc123@WestbrookZero first, best appreciate yours kindly help and useful idea. after trail and error find that below method solved my error: |
I'd same error and I solved it with change version of numpy. Result of $ python Result of import numpy Solution: Hope this help. |
The PyInstaller team is developing some hooks for NumPy to make sure all dll's are packaged, see numpy/numpy#17184. Without it I think using PyInstaller won't work right now. The Also given that reinstalling numpy solves this, I don't think there's anything to do on the PyTorch side. |
Closing this issue per @rgommers's comment. |
My environment is Win10 , Pytorch:1.15.1、Torchvision:0.6.1、numpy:1.19.1 , when i change Torchvision to 0.2.2. Post 3 , hiddenimports=['numpy.core.dtype_ctypes'] and change numpy to 1.18.5 or 1.16.4 or 1.15.0 still have this error :
cc @mruberry @rgommers @peterjc123 @maxluk @nbcsm @guyang3532 @gunandrose4u @smartcat2010 @mszhanyi
The text was updated successfully, but these errors were encountered: