Numpy error at runtime on pyinstaller builded application
See original GitHub issueHi. I’m getting an error while running an exe builded via pyinstaller. Running script via ide (pycharm) or >python index.py works fine. Project includes pandas, wich imports numpy, where i’m getting the foowing error:
ERROR C:\Users\pc-peironem(guest)\Desktop\arcaboost\executable\dist>index.exe Traceback (most recent call last): File “index.py”, line 6, in <module> File “c:\program files\python37\lib\site-packages\PyInstaller\loader\pyimod03_importers.py”, line 627, in exec_module exec(bytecode, module.dict) File “server.py”, line 7, in <module> File “c:\program files\python37\lib\site-packages\PyInstaller\loader\pyimod03_importers.py”, line 627, in exec_module exec(bytecode, module.dict) File “task.py”, line 5, in <module> File “c:\program files\python37\lib\site-packages\PyInstaller\loader\pyimod03_importers.py”, line 627, in exec_module exec(bytecode, module.dict) File “datasource.py”, line 1, in <module> File “c:\program files\python37\lib\site-packages\PyInstaller\loader\pyimod03_importers.py”, line 627, in exec_module exec(bytecode, module.dict) File “venv\Lib\site-packages\pandas_init_.py”, line 17, in <module> ImportError: Unable to import required dependencies: numpy:
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:
- Check that you expected to use Python3.7 from “C:\Users\pc-peironem(guest)\Desktop\arcaboost\executable\dist\index.exe”, and that you have no directories in your PATH or PYTHONPATH that can interfere with the Python and numpy version “1.17.3” you’re trying to use.
- 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: The specified module could not be found.
[18952] Failed to execute script index
Ok, some infos here.
PYTHONPATH C:\Program Files\Python37\python37.zip C:\Program Files\Python37\DLLs C:\Program Files\Python37\lib C:\Program Files\Python37 C:\Users\pc-peironem(guest)\AppData\Roaming\Python\Python37\site-packages C:\Program Files\Python37\lib\site-packages
OSINFO OS Name: Microsoft Windows 10 Pro OS Version: 10.0.18362 N/A Build 18362
PYTHON Python 3.7.2 no multiple versions installed
NUMPY version 1.17.3 numpy installed in project virtualenv folder
BUILDER Pyinstaller version 3.5 build log: C:\Users\pc-peironem(guest)\Desktop\arcaboost\executable>pyinstaller index.spec 65 INFO: PyInstaller: 3.4 65 INFO: Python: 3.7.2 66 INFO: Platform: Windows-10-10.0.18362-SP0 67 INFO: UPX is not available. 69 INFO: Extending PYTHONPATH with paths [‘C:\Users\pc-peironem(guest)\Desktop\arcaboost\server’, ‘C:\Users\pc-peironem(guest)\Desktop\arcaboost’, ‘C:\Users\pc-peironem(guest)\Desktop\arcaboost\venv\Lib\site-packages’, ‘C:\Users\pc-peironem(guest)\Desktop\arcaboost\executable’] 69 INFO: checking Analysis 155 INFO: Building because hiddenimports changed 156 INFO: Initializing module dependency graph… 158 INFO: Initializing module graph hooks… 160 INFO: Analyzing base_library.zip … 3162 INFO: Analyzing hidden import ‘numpy’ 3614 INFO: Processing pre-find module path hook distutils 4656 INFO: Processing pre-find module path hook site 4657 INFO: site: retargeting to fake-dir ‘c:\program files\python37\lib\site-packages\PyInstaller\fake-modules’ 6863 INFO: Processing pre-safe import module hook setuptools.extern.six.moves 9511 INFO: running Analysis Analysis-00.toc 9527 INFO: Adding Microsoft.Windows.Common-Controls to dependent assemblies of final executable required by c:\program files\python37\python.exe 10160 INFO: Caching module hooks… 10165 INFO: Analyzing …\server\index.py 15814 INFO: Processing pre-safe import module hook six.moves 18248 INFO: Loading module hooks… 18248 INFO: Loading module hook “hook-clr.py”… 18250 INFO: Loading module hook “hook-distutils.py”… 18251 INFO: Loading module hook “hook-django.core.cache.py”… 18455 INFO: Loading module hook “hook-django.core.mail.py”… 18499 INFO: Loading module hook “hook-django.core.management.py”… 18516 INFO: Excluding import ‘matplotlib’ 18518 INFO: Import to be excluded not found: ‘tkinter’ 18518 INFO: Excluding import ‘IPython’ 18519 INFO: Loading module hook “hook-django.db.backends.py”… 18919 WARNING: Hidden import “django.db.backends.pycache.base” not found! 18919 INFO: Loading module hook “hook-django.py”… Traceback (most recent call last): File “<string>”, line 41, in <module> File “<string>”, line 36, in walk_packages File “<string>”, line 36, in walk_packages File “<string>”, line 20, in walk_packages File “C:\Users\pc-peironem(guest)\AppData\Roaming\Python\Python37\site-packages\django\contrib\gis\admin_init_.py”, line 5, in <module> from django.contrib.gis.admin.options import GeoModelAdmin, OSMGeoAdmin File “C:\Users\pc-peironem(guest)\AppData\Roaming\Python\Python37\site-packages\django\contrib\gis\admin\options.py”, line 2, in <module> from django.contrib.gis.admin.widgets import OpenLayersWidget File “C:\Users\pc-peironem(guest)\AppData\Roaming\Python\Python37\site-packages\django\contrib\gis\admin\widgets.py”, line 3, in <module> from django.contrib.gis.gdal import GDALException File “C:\Users\pc-peironem(guest)\AppData\Roaming\Python\Python37\site-packages\django\contrib\gis\gdal_init_.py”, line 28, in <module> from django.contrib.gis.gdal.datasource import DataSource File “C:\Users\pc-peironem(guest)\AppData\Roaming\Python\Python37\site-packages\django\contrib\gis\gdal\datasource.py”, line 39, in <module> from django.contrib.gis.gdal.driver import Driver File “C:\Users\pc-peironem(guest)\AppData\Roaming\Python\Python37\site-packages\django\contrib\gis\gdal\driver.py”, line 5, in <module> from django.contrib.gis.gdal.prototypes import ds as vcapi, raster as rcapi File “C:\Users\pc-peironem(guest)\AppData\Roaming\Python\Python37\site-packages\django\contrib\gis\gdal\prototypes\ds.py”, line 9, in <module> from django.contrib.gis.gdal.libgdal import GDAL_VERSION, lgdal File “C:\Users\pc-peironem(guest)\AppData\Roaming\Python\Python37\site-packages\django\contrib\gis\gdal\libgdal.py”, line 43, in <module> % ‘", "’.join(lib_names) django.core.exceptions.ImproperlyConfigured: Could not find the GDAL library (tried “gdal202”, “gdal201”, “gdal20”, “gdal111”, “gdal110”, “gdal19”). Is GDAL installed? If it is, try setting GDAL_LIBRARY_PATH in your settings. 20519 INFO: Determining a mapping of distributions to packages… 25165 INFO: Packages required by django: [‘pytz’, ‘pytz’] 25166 WARNING: No django root directory could be found! 28566 INFO: Loading module hook “hook-dynaconf.py”… 28570 WARNING: Hidden import “dynaconf.loaders.vault.loader” not found! 28570 INFO: Loading module hook “hook-encodings.py”… 28710 INFO: Loading module hook “hook-gevent.py”… 28946 WARNING: Unable to find package for requirement greenlet from package gevent. 28946 INFO: Packages required by gevent: [‘cffi’] 30165 INFO: Loading module hook “hook-lib2to3.py”… 30171 INFO: Loading module hook “hook-numpy.core.py”… 30252 INFO: Loading module hook “hook-numpy.py”… 30253 INFO: Loading module hook “hook-pandas.py”… 31268 INFO: Loading module hook “hook-PIL.Image.py”… 31782 INFO: Loading module hook “hook-PIL.py”… 31785 INFO: Excluding import ‘PyQt4’ 31788 INFO: Removing import of PyQt4 from module PIL.ImageQt 31789 INFO: Excluding import ‘PyQt5’ 31791 INFO: Import to be excluded not found: ‘FixTk’ 31791 INFO: Excluding import ‘PySide’ 31794 INFO: Removing import of PySide from module PIL.ImageQt 31795 INFO: Excluding import ‘tkinter’ 31797 INFO: Removing import of tkinter from module PIL.ImageTk 31798 INFO: Loading module hook “hook-PIL.SpiderImagePlugin.py”… 31800 INFO: Excluding import ‘tkinter’ 31802 INFO: Import to be excluded not found: ‘FixTk’ 31802 INFO: Loading module hook “hook-pkg_resources.py”… 32361 INFO: Processing pre-safe import module hook win32com Traceback (most recent call last): File “<string>”, line 2, in <module> ModuleNotFoundError: No module named ‘win32com’ 32554 INFO: Processing pre-safe import module hook win32com Traceback (most recent call last): File “<string>”, line 2, in <module> ModuleNotFoundError: No module named ‘win32com’ 32650 INFO: Loading module hook “hook-pycparser.py”… 32651 INFO: Loading module hook “hook-pydoc.py”… 32652 INFO: Loading module hook “hook-pyodbc.py”… 32739 INFO: Loading module hook “hook-pytz.py”… 32791 INFO: Loading module hook “hook-setuptools.py”… 33309 INFO: Loading module hook “hook-sqlite3.py”… 33500 INFO: Loading module hook “hook-sysconfig.py”… 33501 INFO: Loading module hook “hook-xml.dom.domreg.py”… 33502 INFO: Loading module hook “hook-xml.etree.cElementTree.py”… 33502 INFO: Loading module hook “hook-xml.py”… 33503 INFO: Loading module hook “hook-_tkinter.py”… 33706 INFO: checking Tree 33765 INFO: checking Tree 33787 INFO: Loading module hook “hook-django.db.backends.mysql.base.py”… 33789 INFO: Loading module hook “hook-django.db.backends.oracle.base.py”… 33923 INFO: Looking for ctypes DLLs 34059 INFO: Analyzing run-time hooks … 34072 INFO: Including run-time hook ‘pyi_rth_multiprocessing.py’ 34075 INFO: Including run-time hook ‘pyi_rth_pkgres.py’ 34075 INFO: Including run-time hook ‘pyi_rth_django.py’ 34078 INFO: Including run-time hook ‘pyi_rth__tkinter.py’ 34105 INFO: Looking for dynamic libraries 34187 WARNING: lib not found: libopenblas.PYQHXLVVQ7VESDPUVUADXEVJOBGHJPAY.gfortran-win_amd64.dll dependency of C:\Users\pc-peironem(guest)\Desktop\arcaboost\venv\Lib\site-packages\numpy\linalg\lapack_lite.cp37-win_amd64.pyd 34224 WARNING: lib not found: libopenblas.PYQHXLVVQ7VESDPUVUADXEVJOBGHJPAY.gfortran-win_amd64.dll dependency of C:\Users\pc-peironem(guest)\Desktop\arcaboost\venv\Lib\site-packages\numpy\linalg_umath_linalg.cp37-win_amd64.pyd 34305 WARNING: lib not found: libopenblas.PYQHXLVVQ7VESDPUVUADXEVJOBGHJPAY.gfortran-win_amd64.dll dependency of C:\Users\pc-peironem(guest)\Desktop\arcaboost\venv\Lib\site-packages\numpy\core_multiarray_umath.cp37-win_amd64.pyd 35490 INFO: Looking for eggs 35490 INFO: Using Python library c:\program files\python37\python37.dll 35491 INFO: Found binding redirects: [] 35519 INFO: Warnings written to C:\Users\pc-peironem(guest)\Desktop\arcaboost\executable\build\index\warn-index.txt 35840 INFO: Graph cross-reference written to C:\Users\pc-peironem(guest)\Desktop\arcaboost\executable\build\index\xref-index.html 36127 INFO: Appending ‘datas’ from .spec 36131 INFO: checking PYZ 36147 INFO: Building because toc changed 36147 INFO: Building PYZ (ZlibArchive) C:\Users\pc-peironem(guest)\Desktop\arcaboost\executable\build\index\PYZ-00.pyz 39248 INFO: Building PYZ (ZlibArchive) C:\Users\pc-peironem(guest)\Desktop\arcaboost\executable\build\index\PYZ-00.pyz completed successfully. 39355 INFO: checking PKG 39419 INFO: Building because toc changed 39419 INFO: Building PKG (CArchive) PKG-00.pkg 48485 INFO: Building PKG (CArchive) PKG-00.pkg completed successfully. 48731 INFO: Bootloader c:\program files\python37\lib\site-packages\PyInstaller\bootloader\Windows-64bit\run.exe 48732 INFO: checking EXE 48795 INFO: Building because toc changed 48796 INFO: Building EXE from EXE-00.toc 48800 INFO: Appending archive to EXE C:\Users\pc-peironem(guest)\Desktop\arcaboost\executable\dist\index.exe 48869 INFO: Building EXE from EXE-00.toc completed successfully.
Here we are. Tryed to reinstall numpy, but nothing changed. Tryed to hidden imports the module, but problem remains. pythonpath seems Ok, no interference founded
Can you kindly take a look at the issue? Sorry for wasting your time. Thanks. P.M.
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (1 by maintainers)
OK, I solved it! This is problem with conda (Anaconda). numpy must be reinstalled by pip: pip install --upgrade --force-reinstall numpy
DONE !! I solved it using the following command: pip install --user --upgrade --force-reinstall numpy.