Python Forum
Missing required dependencies when using pyinstaller
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Missing required dependencies when using pyinstaller
#11
Actual code is huge, but minimal program below reproduces error:

import pandas
import numpy
import setuptools

print pandas.__version__;
print numpy.__version__;
print setuptools.__version__;

C:\Users\DerekR>python pandastest.py
0.24.1
1.16.2
19.2


C:\Users\DerekR>dist\pandastest\pandastest.exe
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "c:\python27\Lib\site-packages\PyInstaller\loader\pyi_importers.py", line 270, in load_module
exec(bytecode, module.__dict__)
File "C:\Users\DerekR\build\pandastest\out00-PYZ.pyz\pandas", line 19, in <module>
ImportError: Missing required dependencies ['numpy']

It's python 2.7 if that's relevant
Reply
#12
(Mar-07-2019, 03:08 PM)dmag Wrote: Actual code is huge, but minimal program below reproduces error:

import pandas
import numpy
import setuptools

print pandas.__version__;
print numpy.__version__;
print setuptools.__version__;

C:\Users\DerekR>python pandastest.py
0.24.1
1.16.2
19.2


C:\Users\DerekR>dist\pandastest\pandastest.exe
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "c:\python27\Lib\site-packages\PyInstaller\loader\pyi_importers.py", line 270, in load_module
exec(bytecode, module.__dict__)
File "C:\Users\DerekR\build\pandastest\out00-PYZ.pyz\pandas", line 19, in <module>
ImportError: Missing required dependencies ['numpy']

It's python 2.7 if that's relevant

I'm working on python 3.7.2, if possible you can try this version.
Reply
#13
Th efull app isn't ever going to work on python 3, however I'm getting closer. I removed the pandas lines from the example and am getting:

C:\Users\DerekR>dist\pandastest\pandastest.exe
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "c:\python27\Lib\site-packages\PyInstaller\loader\pyi_importers.py", line
270, in load_module
exec(bytecode, module.__dict__)
File "C:\Users\DerekR\build\pandastest\out00-PYZ.pyz\numpy", line 142, in <mod
ule>
File "c:\python27\Lib\site-packages\PyInstaller\loader\pyi_importers.py", line
270, in load_module
exec(bytecode, module.__dict__)
File "C:\Users\DerekR\build\pandastest\out00-PYZ.pyz\numpy.core", line 71, in
<module>
ImportError:

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

Importing the multiarray numpy extension module failed. Most
likely you are trying to import a failed build of numpy.
Here is how to proceed:
- If you're working with a numpy git repository, try git clean -xdf
(removes all files not under version control) and rebuild numpy.
- If you are simply trying to use the numpy version that you have installed:
your installation is broken - please reinstall numpy.
- If you have already reinstalled and that did not fix the problem, then:
1. Check that you are using the Python you expect (you're using C:\Users\Derek
R\dist\pandastest\pandastest.exe),
and that you have no directories in your PATH or PYTHONPATH that can
interfere with the Python and numpy versions 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

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.

numpy was installed by pip. I uninstalled, cleared the pip cache and reinstalled using pip. Still the same issue. I even set the path so it is just c:\Python27 and nothing else. numpy works fine in a regular context. I suspect pyinstaller is just not copying the dll. but which dll?
Reply
#14
If problem with pyinstaller build always start with virtual environment.
This will isolating projects and dependencies,so will eg not have problem that use wrong version of numpy.

Her a run and will use Pipenv.
This command will install all and also make a virtual environment.
pipenv install pyinstaller pandas openpyxl 
After this activate folder
pipenv shell
Now can look at graph.
See how easy it to see what installed Pandas version is 0.24.1 and required numpy 1.16.2 is installed.
E:\div_code\pyin_env

# Activate 
λ pipenv shell
Launching subshell in virtual environment…

# Look at graph
E:\div_code\pyin_env
λ pipenv graph
openpyxl==2.6.1
  - et-xmlfile [required: Any, installed: 1.0.1]
  - jdcal [required: Any, installed: 1.4]
pandas==0.24.1
  - numpy [required: >=1.12.0, installed: 1.16.2]
  - python-dateutil [required: >=2.5.0, installed: 2.8.0]
    - six [required: >=1.5, installed: 1.12.0]
  - pytz [required: >=2011k, installed: 2018.9]
PyInstaller==3.4
  - altgraph [required: Any, installed: 0.16.1]
  - macholib [required: >=1.8, installed: 1.11]
    - altgraph [required: >=0.15, installed: 0.16.1]
  - pefile [required: >=2017.8.1, installed: 2018.8.8]
    - future [required: Any, installed: 0.17.1]
  - pywin32-ctypes [required: Any, installed: 0.2.0]
  - setuptools [required: Any, installed: 40.8.0]
Now test script work in virtual environment.
If work then build with pyinstaller.
pyinstaller --onefile to_excel.py
E:\div_code\pyin_env
λ pyinstaller --onefile to_excel.py
252 INFO: PyInstaller: 3.4
253 INFO: Python: 3.7.2
253 INFO: Platform: Windows-10-10.0.17134-SP0
259 INFO: wrote E:\div_code\pyin_env\to_excel.spec
....................
59139 INFO: Building EXE from EXE-00.toc completed successfully.

# To dist folder
E:\div_code\pyin_env
λ cd dist

E:\div_code\pyin_env\dist
λ ls
to_excel.exe*

# Run exe and it work
E:\div_code\pyin_env\dist
λ to_excel.exe
Please enter the working path:
Done Successfully
Please press Enter to close this window
@dmag just stop using Python 2.7 today Wink
Python 3.6/3.7 and pip installation under Windows
Reply
#15
Ok, I fixed it in a different way. There were 2 issues actually:

i) numpy - pyinstaller wasn't installing the dll libopenblas.IPBC74C7KURV7CB2PKT5Z5FNR3SIBV4J.gfortran-win_amd64.dll from C:\Python27\Lib\site-packages\numpy\.libs copying this over manually fixed the numpy issue

ii) pandas - there are a couple of hidden imports missing:

import pandas._libs.skiplist
import pandas._libs.tslibs.timedeltas
import pandas._libs.tslibs.nattype
import pandas._libs.tslibs.np_datetime

I got this from this page:

https://blog.csdn.net/cyx441984694/artic...s/80883554

Thanks for the help. I'm assuming your solution (which I just spotted) fixes pyinstaller so these are copied over/included.
Reply
#16
(Mar-08-2019, 09:54 AM)dmag Wrote: Ok, I fixed it in a different way. There were 2 issues actually: i) numpy - pyinstaller wasn't installing the dll libopenblas.IPBC74C7KURV7CB2PKT5Z5FNR3SIBV4J.gfortran-win_amd64.dll from C:\Python27\Lib\site-packages\numpy\.libs copying this over manually fixed the numpy issue ii) pandas - there are a couple of hidden imports missing: import pandas._libs.skiplist import pandas._libs.tslibs.timedeltas import pandas._libs.tslibs.nattype import pandas._libs.tslibs.np_datetime I got this from this page: https://blog.csdn.net/cyx441984694/artic...s/80883554 Thanks for the help. I'm assuming your solution (which I just spotted) fixes pyinstaller so these are copied over/included.
can you please tell me where we copy this dll file in the project because i have the same problem and did not work any of the above solutions for me
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Is it possible to see dependencies before installing a package? quazirfan 4 1,083 Dec-06-2022, 02:50 PM
Last Post: snippsat
  TypeError: missing a required argument: 'y' gible 0 2,918 Dec-15-2021, 02:21 AM
Last Post: gible
  TypeError: missing 3 required positional arguments: wardancer84 9 10,900 Aug-19-2021, 04:27 PM
Last Post: deanhystad
  TypeError: run_oracle_job() missing 1 required positional argument: 'connection_strin python_student 1 1,972 Aug-06-2021, 08:05 PM
Last Post: SheeppOSU
  TypeError: max_value() missing 2 required positional arguments: 'alpha' and 'beta' Anldra12 2 4,216 May-15-2021, 04:15 PM
Last Post: Anldra12
  TypeError: sum() missing 1 required positional argument: 'num2' Insen 3 5,473 Jan-06-2021, 04:25 PM
Last Post: Insen
  Managing dependencies with pipenv t4keheart 6 2,948 Aug-05-2020, 12:39 AM
Last Post: t4keheart
  Missing 1 required position argument: 'failure' while starting thread. BradLivingstone 3 4,117 Jun-19-2020, 02:31 PM
Last Post: stullis
  TypeError: forward() missing 1 required positional argument: 'x' sveto4ka 4 12,301 Jun-17-2020, 07:25 PM
Last Post: sveto4ka
  missing 1 required positional argument: 'self' yasser 7 11,474 Jun-07-2020, 06:48 AM
Last Post: ndc85430

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020