pyInstaller executable missing module "_struct" on Ubuntu 12.04 Precise - python

I would like to package my python project into a UNIX executable. For this I've tried py2exe, cxfreeze and pyInstaller, but nothing worked. Hopefully you can help me with pyinstaller. So here it goes:
I've downloaded the zipfile of pyinstaller-2.0 from http://www.pyinstaller.org/ and unzipped it.
In the folder, I run python pyinstaller.py ../helloworld.py (output listed at the end).
Then I try to execute the file: ./helloworld/dist/helloworld/helloworld
which gives me the output:
mod is NULL - structTraceback (most recent call last):
File "/usr/lib/python2.7/struct.py", line 1, in <module>
from _struct import *
ImportError: No module named _struct
mod is NULL - archiveTraceback (most recent call last):
File "/home/jelle/Downloads/pyinstaller-1.5.1/archive.py", line 42, in <module>
import struct
ImportError: No module named struct
Traceback (most recent call last):
File "<string>", line 25, in <module>
ImportError: No module named archive
I'm using Ubuntu 12.04 with Python 2.7.3. My PYTHONPATH include /usr/lib/python2.7. It looks as if the problem is a missing module _struct, but I have no idea where to find it. I've tried pyinstaller 1.5.1 and the development version, neither work here.
Please help!
The output of python pyinstaller.py ../helloworld.py:
7 INFO: wrote /home/jelle/Downloads/pyinstaller-2.0/helloworld/helloworld.spec
27 INFO: UPX is not available.
583 INFO: checking Analysis
583 INFO: building Analysis because out00-Analysis.toc non existent
583 INFO: running Analysis out00-Analysis.toc
702 INFO: Analyzing /home/jelle/Downloads/pyinstaller-2.0/support/_pyi_bootstrap.py
1570 INFO: Analyzing /home/jelle/Downloads/pyinstaller-2.0/PyInstaller/loader/archive.py
1637 INFO: Analyzing /home/jelle/Downloads/pyinstaller-2.0/PyInstaller/loader/carchive.py
1701 INFO: Analyzing /home/jelle/Downloads/pyinstaller-2.0/PyInstaller/loader/iu.py
1720 INFO: Analyzing ../helloworld.py
1721 INFO: Hidden import 'encodings' has been found otherwise
1721 INFO: Looking for run-time hooks
1721 INFO: Analyzing rthook /home/jelle/Downloads/pyinstaller-2.0/support/rthooks/pyi_rth_encodings.py
2197 INFO: Looking for Python library libpython2.7.so
objdump: section '.dynamic' mentioned in a -j option, but not found in any input file
2308 INFO: Warnings written to /home/jelle/Downloads/pyinstaller-2.0/helloworld/build/pyi.linux2/helloworld/warnhelloworld.txt
2311 INFO: checking PYZ
2311 INFO: rebuilding out00-PYZ.toc because out00-PYZ.pyz is missing
2312 INFO: building PYZ out00-PYZ.toc
2706 INFO: checking PKG
2706 INFO: rebuilding out00-PKG.toc because out00-PKG.pkg is missing
2706 INFO: building PKG out00-PKG.pkg
2711 INFO: checking EXE
2712 INFO: rebuilding out00-EXE.toc because helloworld missing
2712 INFO: building EXE from out00-EXE.toc
2772 INFO: Appending archive to EXE /home/jelle/Downloads/pyinstaller-2.0/helloworld/build/pyi.linux2/helloworld/helloworld
2773 INFO: checking COLLECT
2773 INFO: building COLLECT out00-COLLECT.toc
BTW: my helloworld.py simply contains the statement print "hello world". I tried putting #!/usr/bin/python2.7 at the top.

Check the value of the system variable LD_LIBRARY_PATH
echo $LD_LIBRARY_PATH
It might point to the wrong python library libpython2.7.so.
In my case, I could fix this by resetting it:
export LD_LIBRARY_PATH=

Related

Pyinstaller issue in packaging exe program on win10

Currently i meet issue while packaging exe through pyinstaller .
I create a virtual environmental under pycharm , and my programe is very simple
a = input("please input a :")
b = input("please input b: ")
c = print(a+b)
the code stored in test.py . and then I type pyinstaller -F test.py on pycharm consle , it shows as below . as you seen , many libs not found , and packaing failed .
(venv) C:\cheng\Project\STC_Tool\venv>pyinstaller -v
3.6
(venv) C:\cheng\Project\STC_Tool\venv>pyinstaller -F test.py
67 INFO: PyInstaller: 3.6
67 INFO: Python: 3.7.8
70 INFO: Platform: Windows-10-10.0.18362-SP0
72 INFO: wrote C:\cheng\Project\STC_Tool\venv\test.spec
73 INFO: UPX is not available.
74 INFO: Extending PYTHONPATH with paths
['C:\\cheng\\Project\\STC_Tool\\venv', 'C:\\cheng\\Project\\STC_Tool\\venv']
75 INFO: checking Analysis
77 INFO: Building because C:\cheng\Project\STC_Tool\venv\test.py changed
78 INFO: Initializing module dependency graph...
80 INFO: Caching module graph hooks...
83 INFO: Analyzing base_library.zip ...
2178 INFO: Processing pre-find module path hook distutils
2191 INFO: distutils: retargeting to non-venv dir 'C:\\cheng\\Software\\Python\\lib'
3247 INFO: Caching module dependency graph...
3348 INFO: running Analysis Analysis-00.toc
3351 INFO: Adding Microsoft.Windows.Common-Controls to dependent assemblies of final executable
required by c:\cheng\project\stc_tool\venv\scripts\python.exe
3365 WARNING: lib not found: VERSION.dll dependency of c:\cheng\project\stc_tool\venv\scripts\python.exe
3371 INFO: Analyzing C:\cheng\Project\STC_Tool\venv\test.py
3373 INFO: Processing module hooks...
3374 INFO: Loading module hook "hook-distutils.py"...
3375 INFO: Loading module hook "hook-encodings.py"...
3656 INFO: Loading module hook "hook-pydoc.py"...
3657 INFO: Loading module hook "hook-sysconfig.py"...
3659 INFO: Loading module hook "hook-xml.py"...
3910 INFO: Looking for ctypes DLLs
3915 INFO: Analyzing run-time hooks ...
3917 INFO: Looking for dynamic libraries
3937 WARNING: lib not found: VCRUNTIME140.dll dependency of C:\cheng\Software\Python\DLLs\select.pyd
3947 WARNING: lib not found: python37.dll dependency of C:\cheng\Software\Python\DLLs\select.pyd
3966 WARNING: lib not found: VCRUNTIME140.dll dependency of C:\cheng\Software\Python\DLLs\_socket.pyd
3974 WARNING: lib not found: python37.dll dependency of C:\cheng\Software\Python\DLLs\_socket.pyd
3978 WARNING: lib not found: VCRUNTIME140.dll dependency of C:\cheng\Software\Python\DLLs\_lzma.pyd
3994 WARNING: lib not found: python37.dll dependency of C:\cheng\Software\Python\DLLs\_lzma.pyd
4001 WARNING: lib not found: VCRUNTIME140.dll dependency of C:\cheng\Software\Python\DLLs\_bz2.pyd
4027 WARNING: lib not found: python37.dll dependency of C:\cheng\Software\Python\DLLs\_bz2.pyd
4052 WARNING: lib not found: VCRUNTIME140.dll dependency of C:\cheng\Software\Python\DLLs\_hashlib.pyd
4062 WARNING: lib not found: python37.dll dependency of C:\cheng\Software\Python\DLLs\_hashlib.pyd
4071 WARNING: lib not found: libcrypto-1_1.dll dependency of C:\cheng\Software\Python\DLLs\_hashlib.pyd
4079 WARNING: lib not found: libssl-1_1.dll dependency of C:\cheng\Software\Python\DLLs\_ssl.pyd
4095 WARNING: lib not found: VCRUNTIME140.dll dependency of C:\cheng\Software\Python\DLLs\_ssl.pyd
4097 WARNING: lib not found: python37.dll dependency of C:\cheng\Software\Python\DLLs\_ssl.pyd
4106 WARNING: lib not found: libcrypto-1_1.dll dependency of C:\cheng\Software\Python\DLLs\_ssl.pyd
4128 WARNING: lib not found: VCRUNTIME140.dll dependency of C:\cheng\Software\Python\DLLs\unicodedata.pyd
4141 WARNING: lib not found: python37.dll dependency of C:\cheng\Software\Python\DLLs\unicodedata.pyd
4161 WARNING: lib not found: VCRUNTIME140.dll dependency of C:\cheng\Software\Python\DLLs\pyexpat.pyd
4171 WARNING: lib not found: python37.dll dependency of C:\cheng\Software\Python\DLLs\pyexpat.pyd
4174 INFO: Looking for eggs
4174 INFO: Python library not in binary dependencies. Doing additional searching...
4180 INFO: Using Python library
4180 INFO: Found binding redirects:
[]
4194 INFO: Warnings written to C:\cheng\Project\STC_Tool\venv\build\test\warn-test.txt
4252 INFO: Graph cross-reference written to C:\cheng\Project\STC_Tool\venv\build\test\xref-test.html
4261 INFO: checking PYZ
4268 INFO: Building because toc changed
4270 INFO: Building PYZ (ZlibArchive) C:\cheng\Project\STC_Tool\venv\build\test\PYZ-00.pyz
4875 INFO: Building PYZ (ZlibArchive) C:\cheng\Project\STC_Tool\venv\build\test\PYZ-00.pyz completed successfully.
4890 INFO: checking PKG
4891 INFO: Building because toc changed
4893 INFO: Building PKG (CArchive) PKG-00.pkg
Traceback (most recent call last):
File "C:\cheng\Software\Python\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "C:\cheng\Software\Python\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\cheng\Project\STC_Tool\venv\Scripts\pyinstaller.exe\__main__.py", line 7, in <module>
File "c:\cheng\project\stc_tool\venv\lib\site-packages\PyInstaller\__main__.py", line 114, in run
run_build(pyi_config, spec_file, **vars(args))
File "c:\cheng\project\stc_tool\venv\lib\site-packages\PyInstaller\__main__.py", line 65, in run_build
PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
File "c:\cheng\project\stc_tool\venv\lib\site-packages\PyInstaller\building\build_main.py", line 734, in main
build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
File "c:\cheng\project\stc_tool\venv\lib\site-packages\PyInstaller\building\build_main.py", line 681, in build
exec(code, spec_namespace)
File "C:\cheng\Project\STC_Tool\venv\test.spec", line 33, in <module>
console=True )
File "c:\cheng\project\stc_tool\venv\lib\site-packages\PyInstaller\building\api.py", line 436, in __init__
upx_exclude=self.upx_exclude
File "c:\cheng\project\stc_tool\venv\lib\site-packages\PyInstaller\building\api.py", line 199, in __init__
self.__postinit__()
File "c:\cheng\project\stc_tool\venv\lib\site-packages\PyInstaller\building\datastruct.py", line 160, in __postinit__
self.assemble()
File "c:\cheng\project\stc_tool\venv\lib\site-packages\PyInstaller\building\api.py", line 262, in assemble
dist_nm=inm)
File "c:\cheng\project\stc_tool\venv\lib\site-packages\PyInstaller\building\utils.py", line 220, in checkCache
digest = cacheDigest(fnm, redirects)
File "c:\cheng\project\stc_tool\venv\lib\site-packages\PyInstaller\building\utils.py", line 365, in cacheDigest
with open(fnm, "rb") as f:
FileNotFoundError: [Errno 2] No such file or directory: ''
if I remobve -F option and type pyinstaller test.py directly , the packaing would be successfully
(venv) C:\cheng\Project\STC_Tool\venv>pyinstaller test.py
65 INFO: PyInstaller: 3.6
65 INFO: Python: 3.7.8
66 INFO: Platform: Windows-10-10.0.18362-SP0
68 INFO: wrote C:\cheng\Project\STC_Tool\venv\test.spec
70 INFO: UPX is not available.
70 INFO: Extending PYTHONPATH with paths
['C:\\cheng\\Project\\STC_Tool\\venv', 'C:\\cheng\\Project\\STC_Tool\\venv']
70 INFO: checking Analysis
75 INFO: checking PYZ
98 INFO: checking PKG
98 INFO: Building because toc changed
99 INFO: Building PKG (CArchive) PKG-00.pkg
125 INFO: Building PKG (CArchive) PKG-00.pkg completed successfully.
128 INFO: Bootloader c:\cheng\project\stc_tool\venv\lib\site-packages\PyInstaller\bootloader\Windows-32bit\run.exe
129 INFO: checking EXE
131 INFO: Building because toc changed
132 INFO: Building EXE from EXE-00.toc
134 INFO: Appending archive to EXE C:\cheng\Project\STC_Tool\venv\build\test\test.exe
137 INFO: Building EXE from EXE-00.toc completed successfully.
142 INFO: checking COLLECT
WARNING: The output directory "C:\cheng\Project\STC_Tool\venv\dist\test" and ALL ITS CONTENTS will be REMOVED! Continue? (y/N)y
On your own risk, you can use the option `--noconfirm` to get rid of this question.
2769 INFO: Removing dir C:\cheng\Project\STC_Tool\venv\dist\test
2780 INFO: Building COLLECT COLLECT-00.toc
2830 INFO: Building COLLECT COLLECT-00.toc completed successfully.
but the test.exe flashed and closed after I click , I using screen recording tool capture the flash error
, it shows Error loading Python DLL 'c:\cheng\Project\STC_Tool\venv\dist\test'
the python installed on win10 is python3.7 , and I am using win10 64 bit operating system.
could you please give me some suggestiones .
after unistall pyinstaller and then reinstall pyinstaller again , issue solved.
please considered to update system variable as well.

Reducing .exe file using virtual environment

I am quite new to Python (and programming in general to be frank), and am using pyinstaller to create a .exe file from a .py file. After a few trials I figured that pyinstaller is including many unnecessary libraries such as scipy which is making my file extremely big.
To get around that I made a virtual environment and installed the modules I needed. However, when I tried making the .exe while still in the venv using pyinstaller -w -F -i "iconpath" filename.py its not working (it just stops after the last line in the code below):
126 INFO: PyInstaller: 3.6
126 INFO: Python: 3.8.1
127 INFO: Platform: Windows-10-10.0.16299-SP0
128 INFO: wrote C:\Users\26039190\RefCal_v4\RefCal_v4.spec
131 INFO: UPX is not available.
139 INFO: Extending PYTHONPATH with paths
['C:\\Users\\26039190\\RefCal_v4', 'C:\\Users\\26039190\\RefCal_v4']
139 INFO: checking Analysis
139 INFO: Building Analysis because Analysis-00.toc is non existent
139 INFO: Initializing module dependency graph...
143 INFO: Caching module graph hooks...
153 INFO: Analyzing base_library.zip ...
5696 INFO: Processing pre-find module path hook distutils
5697 INFO: distutils: retargeting to non-venv dir 'C:\\Users\\26039190\\AppData\\Local\\Programs\\Python\\Python38-32\\lib'
9412 INFO: Caching module dependency graph...
9565 INFO: running Analysis Analysis-00.toc
9570 INFO: Adding Microsoft.Windows.Common-Controls to dependent assemblies of final executable
required by c:\users\26039190\env\scripts\python.exe
9601 INFO: Analyzing C:\Users\26039190\RefCal_v4\RefCal_v4.py
13180 INFO: Processing pre-find module path hook site
13181 INFO: site: retargeting to fake-dir 'c:\\users\\26039190\\env\\lib\\site-packages\\PyInstaller\\fake-modules'
14909 INFO: Processing pre-safe import module hook setuptools.extern.six.moves
21403 INFO: Processing pre-safe import module hook six.moves
122612 INFO: Processing module hooks...
122615 INFO: Loading module hook "hook-distutils.py"...
122622 INFO: Loading module hook "hook-encodings.py"...
122840 INFO: Loading module hook "hook-lib2to3.py"...
122846 INFO: Loading module hook "hook-matplotlib.backends.py"...
124362 INFO: Matplotlib backend "GTK3Agg": ignored
backend Gtk3Agg requires cairo
124925 INFO: Matplotlib backend "GTK3Cairo": ignored
cairo backend requires that pycairo>=1.11.0 or cairocffiis installed
125538 INFO: Matplotlib backend "MacOSX": ignored
cannot import name '_macosx' from 'matplotlib.backends' (c:\users\26039190\env\lib\site-packages\matplotlib\backends\__init__.py)
126226 INFO: Matplotlib backend "nbAgg": ignored
No module named 'IPython'
127194 INFO: Matplotlib backend "Qt4Agg": added
128011 INFO: Matplotlib backend "Qt4Cairo": ignored
cairo backend requires that pycairo>=1.11.0 or cairocffiis installed
128802 INFO: Matplotlib backend "Qt5Agg": added
129303 INFO: Matplotlib backend "Qt5Cairo": ignored
cairo backend requires that pycairo>=1.11.0 or cairocffiis installed
130180 INFO: Matplotlib backend "TkAgg": added
131163 INFO: Matplotlib backend "TkCairo": ignored
cairo backend requires that pycairo>=1.11.0 or cairocffiis installed
131845 INFO: Matplotlib backend "WebAgg": ignored
Traceback (most recent call last):
File "c:\users\26039190\env\lib\site-packages\matplotlib\backends\backend_webagg.py", line 27, in <module>
import tornado
ModuleNotFoundError: No module named 'tornado'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<string>", line 12, in <module>
File "c:\users\26039190\env\lib\site-packages\matplotlib\backends\backend_webagg.py", line 29, in <module>
raise RuntimeError("The WebAgg backend requires Tornado.")
RuntimeError: The WebAgg backend requires Tornado.
132610 INFO: Matplotlib backend "WX": ignored
No module named 'wx'
133240 INFO: Matplotlib backend "WXAgg": ignored
No module named 'wx'
133885 INFO: Matplotlib backend "WXCairo": ignored
No module named 'wx'
134389 INFO: Matplotlib backend "agg": added
135129 INFO: Matplotlib backend "cairo": ignored
cairo backend requires that pycairo>=1.11.0 or cairocffiis installed
136202 INFO: Matplotlib backend "pdf": added
136913 INFO: Matplotlib backend "pgf": added
137455 INFO: Matplotlib backend "ps": added
138036 INFO: Matplotlib backend "svg": added
138739 INFO: Matplotlib backend "template": added
139367 INFO: Loading module hook "hook-matplotlib.py"...
139836 INFO: Loading module hook "hook-numpy.core.py"...
140027 INFO: Loading module hook "hook-numpy.py"...
140031 INFO: Loading module hook "hook-pkg_resources.py"...
140710 INFO: Processing pre-safe import module hook win32com
Traceback (most recent call last):
File "<string>", line 2, in <module>
ModuleNotFoundError: No module named 'win32com'
140839 INFO: Processing pre-safe import module hook win32com
Traceback (most recent call last):
File "<string>", line 2, in <module>
ModuleNotFoundError: No module named 'win32com'
140954 INFO: Excluding import '__main__'
140957 INFO: Removing import of __main__ from module pkg_resources
140966 INFO: Loading module hook "hook-pydoc.py"...
140976 INFO: Loading module hook "hook-PyQt5.py"...
Can anyone please shed some light?
By the way I am using anaconda, could that be the problem? Some people say I should uninstall anaconda, but I do not want to delete anaconda since I use Jupyter and Spyder quite a lot
Thank you everyone
collections is included in The Python Standard Library, no need to install it.

How to use pyinstaller with pipenv / pyenv

I am trying to ship an executable from my python script which lives inside a virtual environment using pipenv which again relies on pyenv for python versioning. For that, I want to us pyinstaller.
What I did:
pipenv install pyinstaller
pyinstaller --onefile my_script.py
Output:
40 INFO: PyInstaller: 3.5
40 INFO: Python: 3.6.9
41 INFO: Platform: Linux-4.15.0-65-generic-x86_64-with-debian-stretch-sid
42 INFO: wrote /home/matthaeus/cybathlon/planvec/qt_video_gui_example.spec
44 INFO: UPX is not available.
45 INFO: Extending PYTHONPATH with paths
['/home/matthaeus/cybathlon/planvec', '/home/matthaeus/cybathlon/planvec']
45 INFO: checking Analysis
45 INFO: Building Analysis because Analysis-00.toc is non existent
45 INFO: Initializing module dependency graph...
46 INFO: Initializing module graph hooks...
47 INFO: Analyzing base_library.zip ...
2786 INFO: running Analysis Analysis-00.toc
2801 INFO: Caching module hooks...
2805 INFO: Analyzing /home/matthaeus/cybathlon/planvec/qt_video_gui_example.py
3284 INFO: Processing pre-find module path hook distutils
3285 INFO: distutils: retargeting to non-venv dir '/home/matthaeus/.pyenv/versions/3.6.9/lib/python3.6/distutils/__init__.py'
3972 INFO: Processing pre-safe import module hook setuptools.extern.six.moves
4336 INFO: Processing pre-find module path hook site
4337 INFO: site: retargeting to fake-dir '/home/matthaeus/.local/share/virtualenvs/planvec-R86NQhbu/lib/python3.6/site-packages/PyInstaller/fake-modules'
6327 INFO: Loading module hooks...
6328 INFO: Loading module hook "hook-numpy.core.py"...
6458 INFO: Loading module hook "hook-sysconfig.py"...
6464 INFO: Loading module hook "hook-PyQt5.QtCore.py"...
6534 INFO: Loading module hook "hook-scipy.py"...
6535 INFO: Loading module hook "hook-PyQt5.py"...
6549 WARNING: Hidden import "sip" not found!
6549 INFO: Loading module hook "hook-pkg_resources.py"...
6788 INFO: Processing pre-safe import module hook win32com
7015 INFO: Loading module hook "hook-numpy.py"...
7015 INFO: Loading module hook "hook-cv2.py"...
7016 INFO: Loading module hook "hook-PyQt5.QtGui.py"...
7048 INFO: Loading module hook "hook-PyQt5.QtWidgets.py"...
7096 INFO: Loading module hook "hook-pydoc.py"...
7097 INFO: Loading module hook "hook-xml.py"...
7150 INFO: Loading module hook "hook-encodings.py"...
7203 INFO: Loading module hook "hook-setuptools.py"...
7423 WARNING: Hidden import "distutils.command.build_ext" not found!
7680 INFO: Looking for ctypes DLLs
7762 INFO: Analyzing run-time hooks ...
7769 INFO: Including run-time hook 'pyi_rth_pyqt5.py'
7770 INFO: Including run-time hook 'pyi_rth_pkgres.py'
7771 INFO: Including run-time hook 'pyi_rth_multiprocessing.py'
7785 INFO: Looking for dynamic libraries
9784 INFO: Looking for eggs
9784 INFO: Python library not in binary dependencies. Doing additional searching...
Traceback (most recent call last):
File "/home/matthaeus/.local/share/virtualenvs/planvec-R86NQhbu/bin/pyinstaller", line 8, in <module>
sys.exit(run())
File "/home/matthaeus/.local/share/virtualenvs/planvec-R86NQhbu/lib/python3.6/site-packages/PyInstaller/__main__.py", line 111, in run
run_build(pyi_config, spec_file, **vars(args))
File "/home/matthaeus/.local/share/virtualenvs/planvec-R86NQhbu/lib/python3.6/site-packages/PyInstaller/__main__.py", line 63, in run_build
PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
File "/home/matthaeus/.local/share/virtualenvs/planvec-R86NQhbu/lib/python3.6/site-packages/PyInstaller/building/build_main.py", line 844, in main
build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
File "/home/matthaeus/.local/share/virtualenvs/planvec-R86NQhbu/lib/python3.6/site-packages/PyInstaller/building/build_main.py", line 791, in build
exec(code, spec_namespace)
File "/home/matthaeus/cybathlon/planvec/qt_video_gui_example.spec", line 17, in <module>
noarchive=False)
File "/home/matthaeus/.local/share/virtualenvs/planvec-R86NQhbu/lib/python3.6/site-packages/PyInstaller/building/build_main.py", line 243, in __init__
self.__postinit__()
File "/home/matthaeus/.local/share/virtualenvs/planvec-R86NQhbu/lib/python3.6/site-packages/PyInstaller/building/datastruct.py", line 158, in __postinit__
self.assemble()
File "/home/matthaeus/.local/share/virtualenvs/planvec-R86NQhbu/lib/python3.6/site-packages/PyInstaller/building/build_main.py", line 575, in assemble
self._check_python_library(self.binaries)
File "/home/matthaeus/.local/share/virtualenvs/planvec-R86NQhbu/lib/python3.6/site-packages/PyInstaller/building/build_main.py", line 681, in _check_python_library
raise IOError(msg)
OSError: Python library not found: libpython3.6mu.so.1.0, libpython3.6m.so, libpython3.6m.so.1.0, libpython3.6.so.1.0
This would mean your Python installation doesn't come with proper library files.
This usually happens by missing development package, or unsuitable build parameters of Python installation.
* On Debian/Ubuntu, you would need to install Python development packages
* apt-get install python3-dev
* apt-get install python-dev
* If you're building Python by yourself, please rebuild your Python with `--enable-shared` (or, `--enable-framework` on Darwin)
I tried the recommended python3-dev and python-dev installations without luck.
Now, I hope someone can enlighten me what is going on here!
Cheers,
Matt
You need to build with CPython shared-library enabled.
env PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install 3.6.9
eval "$(pyenv init -)"
Reference: https://github.com/pyenv/pyenv/wiki

Pyinstaller not finding pandas hook

I have written a simple python script that I am now trying to make an exe file. Whenever I try to run the resulting exe, the program fails at import pandas and I get the following error.
Traceback (most recent call last):
File "myProgram.py", line 14, in <module>
import pandas
File "c:\temp\pip-install-k4pegh\pyInstaller\PyInstaller\loader\pyimod03_importers.py", line 396, in load_module
File "site-packages\pandas\__init__.py", line 35, in <module>
ImportError: C extension: No module named tslib not built. If you want to import pandas from the source directory, you may need to run 'python setup.py build_ext --inplace --force' to build the C extensions first.
[492] Failed to execute script myProgram
Looking at the cmd output, hook-pandas is loaded. So this is not an issue with pyinstaller finding the pandas hook.
30240 INFO: Loading module hook "hook-pkg_resources.py"...
30568 INFO: Processing pre-safe import module hook win32com
31036 INFO: Loading module hook "hook-pytz.py"...
31286 INFO: Loading module hook "hook-pywintypes.py"...
31550 INFO: Loading module hook "hook-setuptools.py"...
31644 INFO: Loading module hook "hook-encodings.py"...
33516 INFO: Loading module hook "hook-xml.etree.cElementTree.py"...
33516 INFO: Loading module hook "hook-numpy.core.py"...
33609 INFO: Loading module hook "hook-sqlite3.py"...
33796 INFO: Loading module hook "hook-pandas.py"...
33812 INFO: Loading module hook "hook-win32com.py"...
34779 INFO: Loading module hook "hook-pythoncom.py"...
35217 INFO: Analyzing run-time hooks ...
35231 INFO: Including run-time hook 'pyi_rth_multiprocessing.py'
35247 INFO: Including run-time hook 'pyi_rth__tkinter.py'
35263 INFO: Including run-time hook 'pyi_rth_pkgres.py'
35279 INFO: Including run-time hook 'pyi_rth_win32comgenpy.py'
I did have to add pandas-hook to Python27\Lib\site-packages\PyInstaller\hooks myself. See No module named 'pandas._libs.tslibs.timedeltas' in PyInstaller and https://github.com/lneuhaus/pyinstaller/commit/017b247064f9bd51a620cfb2172c05d63fc75133. Could that be a problem?
Earlier I also tried altering the spec file based on this question, PyInstaller and Pandas, with no luck.
Using:
python 2.7
pyinstaller 3.3.1
pandas 0.22.0.
If anyone knows why pyinstaller can't use a loaded hook or has any ideas as to what to try next, I would really appreciate it.

PyInstaller stops working when I import something from PySide

When I build a simple hello world application with PyInstaller, it works as expected. But as soon as I import something from PySide it stops working. Here is the main.py:
from PySide.QtGui import QApplication
print "Hello World"
The build process goes smoothly, but the resulting binary doesn't work:
(pyside) C:\Test\pyinstaller>main\dist\main\main.exe
Traceback (most recent call last):
File "<string>", line 5, in <module>
File "C:\Test\pyinstaller\PyInstaller\loader\iu.py", line 386, in importHook
mod = _self_doimport(nm, ctx, fqname)
File "C:\Test\pyinstaller\PyInstaller\loader\iu.py", line 480, in doimport
exec co in mod.__dict__
File "C:\Test\pyinstaller\main\build\pyi.win32\main\out00-PYZ.pyz\PySide", lin
e 55, in <module>
File "C:\Test\pyinstaller\main\build\pyi.win32\main\out00-PYZ.pyz\PySide", lin
e 11, in _setupQtDirectories
File "C:\Test\pyinstaller\main\build\pyi.win32\main\out00-PYZ.pyz\PySide._util
s", line 87, in get_pyside_dir
File "C:\Test\pyinstaller\main\build\pyi.win32\main\out00-PYZ.pyz\PySide._util
s", line 83, in _get_win32_case_sensitive_name
File "C:\Test\pyinstaller\main\build\pyi.win32\main\out00-PYZ.pyz\PySide._util
s", line 58, in _get_win32_short_name
WindowsError: [Error 123] The filename, directory name, or volume label syntax i
s incorrect.
Notice that this happens even though I'm just importing a PySide module, not actually using it. What should I do?
I am using PyInstaller 2.0 to package an app with PySide 1.2 on 64-bit windows 7. My Python installation is 32-bit:
Python 2.7.5 (default, May 15 2013, 22:43:36) [MSC v.1500 32 bit (Intel)] on win32
>pip freeze
pyside==1.2.0
pywin32==218
And here is the build message:
(pyside) C:\Test\pyinstaller>python pyinstaller.py ..\main.py
90 INFO: wrote C:\Test\pyinstaller\main\main.spec
113 INFO: Testing for ability to set icons, version resources...
162 INFO: ... resource update available
204 INFO: UPX is available.
1237 INFO: checking Analysis
1237 INFO: building Analysis because out00-Analysis.toc non existent
1238 INFO: running Analysis out00-Analysis.toc
1240 INFO: Adding Microsoft.VC90.CRT to dependent assemblies of final executable
1313 INFO: Searching for assembly x86_Microsoft.VC90.CRT_1fc8b3b9a1e18e3b_9.0.21
022.8_none ...
1314 INFO: Found manifest C:\Windows\WinSxS\Manifests\x86_microsoft.vc90.crt_1fc
8b3b9a1e18e3b_9.0.21022.8_none_bcb86ed6ac711f91.manifest
1316 INFO: Searching for file msvcr90.dll
1317 INFO: Found file C:\Windows\WinSxS\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_
9.0.21022.8_none_bcb86ed6ac711f91\msvcr90.dll
1317 INFO: Searching for file msvcp90.dll
1319 INFO: Found file C:\Windows\WinSxS\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_
9.0.21022.8_none_bcb86ed6ac711f91\msvcp90.dll
1319 INFO: Searching for file msvcm90.dll
1319 INFO: Found file C:\Windows\WinSxS\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_
9.0.21022.8_none_bcb86ed6ac711f91\msvcm90.dll
1447 INFO: Analyzing C:\Test\pyinstaller\support\_pyi_bootstrap.py
2601 INFO: Analyzing C:\Test\pyinstaller\PyInstaller\loader\archive.py
2687 INFO: Analyzing C:\Test\pyinstaller\PyInstaller\loader\carchive.py
2776 INFO: Analyzing C:\Test\pyinstaller\PyInstaller\loader\iu.py
2800 INFO: Analyzing ..\main.py
2893 INFO: Hidden import 'encodings' has been found otherwise
2894 INFO: Looking for run-time hooks
2895 INFO: Analyzing rthook C:\Test\pyinstaller\support/rthooks/pyi_rth_encoding
s.py
7438 INFO: Warnings written to C:\Test\pyinstaller\main\build\pyi.win32\main\war
nmain.txt
7444 INFO: checking PYZ
7445 INFO: rebuilding out00-PYZ.toc because out00-PYZ.pyz is missing
7445 INFO: building PYZ out00-PYZ.toc
8059 INFO: checking PKG
8060 INFO: rebuilding out00-PKG.toc because out00-PKG.pkg is missing
8061 INFO: building PKG out00-PKG.pkg
8072 INFO: checking EXE
8073 INFO: rebuilding out00-EXE.toc because main.exe missing
8073 INFO: building EXE from out00-EXE.toc
8075 INFO: Appending archive to EXE C:\Test\pyinstaller\main\build\pyi.win32\mai
n\main.exe
8151 INFO: checking COLLECT
8151 INFO: building COLLECT out00-COLLECT.toc
EDIT: This happens even if I call from PySide import QtGui as it suggests in this answer.
Encountering same question, solved by using PyInstaller 1.5.

Categories