Posts: 7
Threads: 2
Joined: Jan 2017
Jan-16-2017, 10:33 AM
(This post was last modified: Jan-16-2017, 10:33 AM by sym.)
Hey, I'm trying to create a bundled executable via PyInstaller for an assignment. Already tried multiple re-installations of Python but still PyInstaller creates Errors when building a Script without additional imports. I followed the PyInstaller Documentation, but can't figure out why these errors come up. Does anybody have an Idea?
#!/usr/bin/python3
print("Hello World")
input() Error Log when build:
Error: missing module named resource - imported by posix, C:\Users\sym\Desktop\check\pyinstaller_check.py
missing module named posix - imported by os, C:\Users\sym\Desktop\check\pyinstaller_check.py
missing module named _posixsubprocess - imported by subprocess, C:\Users\sym\Desktop\check\pyinstaller_check.py
missing module named 'org.python' - imported by pickle, C:\Users\sym\Desktop\check\pyinstaller_check.py, xml.sax
missing module named readline - imported by cmd, code, pdb, C:\Users\sym\Desktop\check\pyinstaller_check.py
excluded module named _frozen_importlib - imported by importlib, importlib.abc, C:\Users\sym\Desktop\check\pyinstaller_check.py
missing module named _frozen_importlib_external - imported by importlib._bootstrap, importlib, importlib.abc, C:\Users\sym\Desktop\check\pyinstaller_check.py
missing module named _winreg - imported by platform, C:\Users\sym\Desktop\check\pyinstaller_check.py
missing module named _scproxy - imported by urllib.request
missing module named java - imported by platform, C:\Users\sym\Desktop\check\pyinstaller_check.py
missing module named 'java.lang' - imported by platform, C:\Users\sym\Desktop\check\pyinstaller_check.py, xml.sax._exceptions
missing module named vms_lib - imported by platform, C:\Users\sym\Desktop\check\pyinstaller_check.py
missing module named termios - imported by tty, C:\Users\sym\Desktop\check\pyinstaller_check.py, getpass
missing module named grp - imported by tarfile, shutil, C:\Users\sym\Desktop\check\pyinstaller_check.py
missing module named pwd - imported by posixpath, tarfile, shutil, http.server, webbrowser, C:\Users\sym\Desktop\check\pyinstaller_check.py, netrc, getpass
missing module named ce - imported by os, C:\Users\sym\Desktop\check\pyinstaller_check.py
missing module named _dummy_threading - imported by dummy_threading, C:\Users\sym\Desktop\check\pyinstaller_check.py
missing module named org - imported by copy, C:\Users\sym\Desktop\check\pyinstaller_check.py
*This is the Command Line I used: pyinstaller --clean --onedir "C:\Users\sym\Desktop\check\pyinstaller_check.py"
Posts: 7
Threads: 2
Joined: Jan 2017
Anyone? still stuck on this
Posts: 2,953
Threads: 48
Joined: Sep 2016
Jan-19-2017, 09:03 AM
(This post was last modified: Jan-19-2017, 09:03 AM by wavic.)
I am not familiar with Windows but what if you try ti run this with privileges?
And I see Python/pyinstaller can't find required modules. Try to add to environment variables PYTHONPATH='path_to_python_modules_directory'
Also, check out https://pythonhosted.org/PyInstaller/whe...wrong.html
I want to help more but I am not using Windows
Posts: 7,313
Threads: 123
Joined: Sep 2016
Jan-19-2017, 06:27 PM
(This post was last modified: Jan-19-2017, 06:27 PM by snippsat.)
>>> s = "C:\Users\sym\Desktop\check\pyinstaller_check.py"
Traceback (most recent call last):
File "C:\Python36\lib\code.py", line 63, in runsource
code = self.compile(source, filename, symbol)
File "C:\Python36\lib\codeop.py", line 168, in __call__
return _maybe_compile(self.compiler, source, filename, symbol)
File "C:\Python36\lib\codeop.py", line 99, in _maybe_compile
raise err1
File "C:\Python36\lib\codeop.py", line 87, in _maybe_compile
code1 = compiler(source + "\n", filename, symbol)
File "C:\Python36\lib\codeop.py", line 133, in __call__
codeob = compile(source, filename, symbol, self.flags, 1)
File "<interactive input>", line 1
SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape You can not use C:\U in python 3.
Turn all backslash the other way,as you should always do or double up \\ .
>>> s = "C:/Users/sym/Desktop/check/pyinstaller_check.py"
>>> s
'C:/Users/sym/Desktop/check/pyinstaller_check.py' Here a run with pyinstaller and the code you have postet.
I use virtual environment which now is build into Python 3.5 -->.
Virtual environment is great for not messing with OS installed Python versions.
Here the run from start to hello.exe .
I use cmder,but is't just the same in cmd.
# Make virtual enviroment
C:\Python35
λ python -m venv pyinstaller_test
C:\Python35
λ cd pyinstaller_test
# Activate virtual environment
C:\Python35\pyinstaller_test
λ C:\Python35\pyinstaller_test\Scripts\activate.bat
(pyinstaller_test) C:\Python35\pyinstaller_test
# Check that pip from virtual environment is used
(pyinstaller_test) C:\Python35\pyinstaller_test
λ pip -V
pip 8.1.1 from c:\python35\pyinstaller_test\lib\site-packages (python 3.5)
# Install pyinstaller
(pyinstaller_test) C:\Python35\pyinstaller_test
λ pip install pyinstaller
Collecting pyinstaller
Using cached PyInstaller-3.2.1.tar.bz2
Requirement already satisfied (use --upgrade to upgrade): setuptools in c:\python35\pyinstaller_test\lib\site-p
ackages (from pyinstaller)
Collecting future (from pyinstaller)
Using cached future-0.16.0.tar.gz
Collecting pypiwin32 (from pyinstaller)
Downloading pypiwin32-219-cp35-none-win32.whl (7.9MB)
100% |################################| 7.9MB 156kB/s
Installing collected packages: future, pypiwin32, pyinstaller
Running setup.py install for future ... done
Running setup.py install for pyinstaller ... done
Successfully installed future-0.16.0 pyinstaller-3.2.1 pypiwin32-219
# Make exe
(pyinstaller_test) C:\Python35\pyinstaller_test
λ pyinstaller hello.py
A lot of install stuff...........
8040 INFO: Building COLLECT out00-COLLECT.toc completed successfully.
(pyinstaller_test) C:\Python35\pyinstaller_test
λ cd dist
(pyinstaller_test) C:\Python35\pyinstaller_test\dist
λ cd hello
# Test exe
(pyinstaller_test) C:\Python35\pyinstaller_test\dist\hello
λ hello.exe
Hello World
Posts: 7
Threads: 2
Joined: Jan 2017
Jan-20-2017, 02:22 PM
(This post was last modified: Jan-20-2017, 02:22 PM by sym.)
Hey, thank you very much for the reply. I followed your steps and was able to build the application in the venv and it is starting.
However the log in C:\Python35\venv\build\hello\warnhello.txt still shows the following warnings.
Error: missing module named resource - imported by posix, C:\Python35\venv\hello.py
missing module named posix - imported by os, C:\Python35\venv\hello.py
missing module named _posixsubprocess - imported by subprocess, C:\Python35\venv\hello.py
missing module named 'org.python' - imported by pickle, C:\Python35\venv\hello.py, xml.sax
missing module named ce - imported by os, C:\Python35\venv\hello.py
missing module named readline - imported by cmd, code, pdb, C:\Python35\venv\hello.py
excluded module named _frozen_importlib - imported by importlib, importlib.abc, C:\Python35\venv\hello.py
missing module named _frozen_importlib_external - imported by importlib._bootstrap, importlib, importlib.abc, C:\Python35\venv\hello.py
missing module named _winreg - imported by platform, C:\Python35\venv\hello.py
missing module named _scproxy - imported by urllib.request
missing module named java - imported by platform, C:\Python35\venv\hello.py
missing module named 'java.lang' - imported by platform, C:\Python35\venv\hello.py, xml.sax._exceptions
missing module named vms_lib - imported by platform, C:\Python35\venv\hello.py
missing module named termios - imported by tty, C:\Python35\venv\hello.py, getpass
missing module named grp - imported by tarfile, shutil, C:\Python35\venv\hello.py
missing module named _dummy_threading - imported by dummy_threading, C:\Python35\venv\hello.py
missing module named org - imported by copy, C:\Python35\venv\hello.py
missing module named pwd - imported by posixpath, tarfile, shutil, http.server, webbrowser, C:\Python35\venv\hello.py, netrc, getpass
#!/usr/bin/python35
print("Hello")
input() Command Line code to Build:
pyinstaller hello.py
I'm probably missing something obvious here, but I don't get how Errors like this "missing module named ce - imported by os, C:/Python35/venv/hello.py" come up in the log when building above python code. (as I literally import no modules there.)
When you are building the Code above in your Virtual Environment are there any error warnings in the .log in the build folder?
Posts: 7,313
Threads: 123
Joined: Sep 2016
Jan-20-2017, 03:49 PM
(This post was last modified: Jan-20-2017, 03:49 PM by snippsat.)
(Jan-20-2017, 02:22 PM)sym Wrote: When you are building the Code above in your Virtual Environment are there any error warnings in the .log in the build folder? I get the same error in log.
Look like it try to get import from a Linux version of Python.
The exe do work,so maybe just ignore the log.
Posts: 7
Threads: 2
Joined: Jan 2017
I see, thank you very much for the reply.
During the debugging I also looked into the hooks that are part of pyinstaller.
On Module imports like for example import PyQt5.QtCore the pyinstaller seems to find automatically the corresponding hooks during analysis and does not add anymore errors to the log.
However with the numpy module in the Python Code a lot of errors are added to the log. import numpy.core
There is an hook file for numpy in pyinstaller \Lib\site-packages\PyInstaller\hooks\hook-numpy.core.py for it but it does not seem to work.
Would you be able to confirm this? I wonder if it is something wrong on my end or if it's actually a bug in the current pyinstaller.
#!/usr/bin/python35
import numpy.core
a = numpy.array([1, 2])
a.fill(9)
print(a)
input() Following Code adds all of this to the error log in the build directory:
Error: missing module named pyimod03_importers - imported by c:\users\jonas\appdata\local\programs\python\python35\lib\site-packages\PyInstaller\loader\rthooks\pyi_rth_pkgres.py
missing module named StringIO - imported by numpy.lib.utils, numpy.testing.utils, numpy.lib.format, pkg_resources._vendor.six
missing module named 'pkg_resources.extern.pyparsing' - imported by pkg_resources._vendor.packaging.requirements, pkg_resources._vendor.packaging.markers
missing module named __builtin__ - imported by numpy.core.numerictypes, numpy.core.numeric, numpy.distutils.misc_util, numpy.lib.function_base, numpy.lib._iotools, numpy.ma.core, numpy, pkg_resources._vendor.pyparsing
missing module named __main__ - imported by pkg_resources
missing module named multiprocessing.SimpleQueue - imported by multiprocessing, concurrent.futures.process
missing module named multiprocessing.set_start_method - imported by multiprocessing, multiprocessing.spawn
missing module named multiprocessing.get_start_method - imported by multiprocessing, multiprocessing.spawn
missing module named multiprocessing.TimeoutError - imported by multiprocessing, multiprocessing.pool
missing module named multiprocessing.get_context - imported by multiprocessing, multiprocessing.pool, multiprocessing.managers, multiprocessing.sharedctypes
missing module named multiprocessing.AuthenticationError - imported by multiprocessing, multiprocessing.connection
missing module named multiprocessing.BufferTooShort - imported by multiprocessing, multiprocessing.connection
missing module named _sysconfigdata - imported by sysconfig
missing module named pkg_resources.extern.packaging - imported by pkg_resources.extern, pkg_resources, setuptools.dist, setuptools.command.egg_info
missing module named 'pkg_resources.extern.six.moves' - imported by pkg_resources, pkg_resources._vendor.packaging.requirements
missing module named pkg_resources.extern.six - imported by pkg_resources.extern, pkg_resources
missing module named resource - imported by posix, C:\Python35\pyinstaller_test\hello.py
missing module named posix - imported by os, C:\Python35\pyinstaller_test\hello.py
missing module named _posixsubprocess - imported by subprocess, multiprocessing.util, C:\Python35\pyinstaller_test\hello.py
missing module named 'org.python' - imported by pickle, setuptools.sandbox, C:\Python35\pyinstaller_test\hello.py, xml.sax
missing module named ce - imported by os, C:\Python35\pyinstaller_test\hello.py
missing module named readline - imported by cmd, code, pdb, C:\Python35\pyinstaller_test\hello.py
excluded module named _frozen_importlib - imported by importlib, importlib.abc, C:\Python35\pyinstaller_test\hello.py
missing module named _frozen_importlib_external - imported by importlib._bootstrap, importlib, importlib.abc, C:\Python35\pyinstaller_test\hello.py
missing module named _winreg - imported by platform, numpy.distutils.cpuinfo, C:\Python35\pyinstaller_test\hello.py
missing module named _scproxy - imported by urllib.request
missing module named java - imported by platform, C:\Python35\pyinstaller_test\hello.py
missing module named 'java.lang' - imported by platform, C:\Python35\pyinstaller_test\hello.py, xml.sax._exceptions
missing module named vms_lib - imported by platform, C:\Python35\pyinstaller_test\hello.py
missing module named termios - imported by tty, getpass, C:\Python35\pyinstaller_test\hello.py
missing module named urllib.splittag - imported by urllib, setuptools.py26compat
missing module named grp - imported by tarfile, shutil, pathlib, distutils.archive_util, C:\Python35\pyinstaller_test\hello.py
missing module named _dummy_threading - imported by dummy_threading, C:\Python35\pyinstaller_test\hello.py
missing module named org - imported by copy, C:\Python35\pyinstaller_test\hello.py
missing module named pwd - imported by posixpath, tarfile, shutil, http.server, webbrowser, pathlib, distutils.util, distutils.archive_util, netrc, getpass, C:\Python35\pyinstaller_test\hello.py
missing module named numpy.core.integer - imported by numpy.core, numpy.fft.helper
missing module named numpy.core.conjugate - imported by numpy.core, numpy.fft.fftpack
missing module named numpy.core.sqrt - imported by numpy.core, numpy.linalg.linalg, numpy.fft.fftpack
missing module named numpy.core.longdouble - imported by numpy.core, numpy.linalg.linalg
missing module named numpy.core.complexfloating - imported by numpy.core, numpy.linalg.linalg
missing module named numpy.core.double - imported by numpy.core, numpy.linalg.linalg
missing module named numpy.core.inexact - imported by numpy.core, numpy.linalg.linalg
missing module named numpy.core.object_ - imported by numpy.core, numpy.linalg.linalg
missing module named numpy.core.geterrobj - imported by numpy.core, numpy.linalg.linalg
missing module named numpy.core.single - imported by numpy.core, numpy.linalg.linalg
missing module named numpy.core.maximum - imported by numpy.core, numpy.linalg.linalg
missing module named numpy.core.cdouble - imported by numpy.core, numpy.linalg.linalg
missing module named numpy.core.multiply - imported by numpy.core, numpy.linalg.linalg
missing module named numpy.core.add - imported by numpy.core, numpy.linalg.linalg
missing module named numpy.core.csingle - imported by numpy.core, numpy.linalg.linalg
missing module named numpy.core.intp - imported by numpy.core, numpy.linalg.linalg
missing module named copy_reg - imported by cPickle, cStringIO, numpy.core
missing module named commands - imported by numpy.distutils.cpuinfo
missing module named ConfigParser - imported by numpy.distutils.system_info, numpy.distutils.npy_pkg_config
missing module named setuptools_svn - imported by setuptools.command.egg_info
missing module named 'setuptools.extern.six.moves' - imported by setuptools.dist, setuptools.command.easy_install, setuptools.sandbox, setuptools.command.setopt, setuptools.package_index, setuptools.ssl_support, setuptools.command.egg_info
missing module named 'setuptools.extern.six' - imported by setuptools, setuptools.extension
missing module named wincertstore - imported by setuptools.ssl_support
missing module named 'backports.ssl_match_hostname' - imported by setuptools.ssl_support
missing module named backports - imported by setuptools.ssl_support
missing module named urllib2 - imported by setuptools.package_index, numpy.lib._datasource
missing module named setuptools.extern.six - imported by setuptools.extern, setuptools.dist, setuptools.depends, setuptools.command.easy_install, setuptools.sandbox, setuptools.package_index, setuptools.command.bdist_egg, setuptools.command.egg_info, setuptools.command.sdist, setuptools.unicode_utils, setuptools.command.develop
missing module named 'numpy_distutils.cpuinfo' - imported by numpy.f2py.diagnose
missing module named 'numpy_distutils.fcompiler' - imported by numpy.f2py.diagnose
missing module named 'numpy_distutils.command' - imported by numpy.f2py.diagnose
missing module named numpy_distutils - imported by numpy.f2py.diagnose
missing module named __svn_version__ - imported by numpy.f2py.__version__
missing module named numarray - imported by numpy.distutils.system_info
missing module named Numeric - imported by numpy.distutils.system_info
missing module named sets - imported by numpy.distutils.misc_util, numpy.distutils.fcompiler, numpy.distutils.command.build_ext
missing module named _curses - imported by curses, curses.has_key
missing module named nose - imported by numpy.testing.utils, numpy.testing.decorators, numpy.testing.noseclasses
missing module named 'nose.plugins' - imported by numpy.testing.noseclasses, numpy.testing.nosetester
missing module named scipy - imported by numpy.testing.nosetester
missing module named 'nose.util' - imported by numpy.testing.noseclasses
missing module named numpy.lib.real - imported by numpy.lib, numpy.testing.utils
missing module named numpy.lib.imag - imported by numpy.lib, numpy.testing.utils
missing module named numpy.lib.iscomplexobj - imported by numpy.lib, numpy.testing.utils
missing module named numpy.ndarray - imported by numpy, numpy.ma.core, numpy.ma.extras, numpy.ma.mrecords, numpy.ctypeslib
missing module named numpy.dtype - imported by numpy, numpy.ma.mrecords, numpy.ctypeslib
missing module named numpy.recarray - imported by numpy, numpy.ma.mrecords
missing module named numpy.array - imported by numpy, numpy.ma.core, numpy.ma.extras, numpy.ma.mrecords, numpy.ctypeslib
missing module named numpy.bool_ - imported by numpy, numpy.ma.core, numpy.ma.mrecords
missing module named numpy.expand_dims - imported by numpy, numpy.ma.core
missing module named numpy.amin - imported by numpy, numpy.ma.core
missing module named numpy.amax - imported by numpy, numpy.ma.core
missing module named numpy.iscomplexobj - imported by numpy, numpy.ma.core
missing module named future_builtins - imported by numpy.lib.npyio
missing module named cPickle - imported by numpy.core.numeric, numpy.lib.format, numpy.lib.npyio, numpy.ma.core
missing module named cStringIO - imported by cPickle
missing module named urlparse - imported by numpy.lib._datasource
missing module named numpy.linalg.inv - imported by numpy.linalg, numpy.matrixlib.defmatrix, numpy.lib.polynomial
missing module named numpy.histogramdd - imported by numpy, numpy.lib.twodim_base
missing module named numpy.lib.i0 - imported by numpy.lib, numpy.dual
missing module named numpy.lib.triu - imported by numpy.lib, numpy.linalg.linalg
missing module named numpy.core.number - imported by numpy.core, numpy.testing.utils
missing module named numpy.core.signbit - imported by numpy.core, numpy.testing.utils
missing module named numpy.core.float64 - imported by numpy.core, numpy.testing.utils
missing module named numpy.core.isinf - imported by numpy.core, numpy.testing.utils
missing module named numpy.core.isfinite - imported by numpy.core, numpy.testing.utils, numpy.linalg.linalg
missing module named numpy.core.isnan - imported by numpy.core, numpy.testing.utils
missing module named numpy.core.float32 - imported by numpy.core, numpy.testing.utils
missing module named numpy.eye - imported by numpy, numpy.core.numeric
Posts: 7,313
Threads: 123
Joined: Sep 2016
Jan-21-2017, 01:31 AM
(This post was last modified: Jan-21-2017, 01:31 AM by snippsat.)
Test of numpy,it make a working exe for me.
There a stuff you have to know,now we work with virtual environment.
So numpy has to be install into virtual environment.
I use numpy for Gohlke,because we need wheel for not setting up a compiler.
So i activate environment and pip install wheel ,i have placed wheel in scripts folder.
(pyinstaller_test) C:\Python35\pyinstaller_test\Scripts
λ pip install numpy-1.12.0+mkl-cp35-cp35m-win32.whl
Processing c:\python35\pyinstaller_test\scripts\numpy-1.12.0+mkl-cp35-cp35m-win32.whl
Installing collected packages: numpy
Successfully installed numpy-1.12.0+mkl
λ cd ..
# Make exe
(pyinstaller_test) C:\Python35\pyinstaller_test
λ pyinstaller numpy_test.py Script i make exe of numpy_test.py
import numpy
a = numpy.array([1, 2])
a.fill(9)
print(a)
input() (pyinstaller_test) C:\Python35\pyinstaller_test
λ pyinstaller numpy_test.py
A lot of install stuff.............. Now in dist folder numpy_test.exe (a working exe for me).
Posts: 7
Threads: 2
Joined: Jan 2017
Jan-23-2017, 08:56 AM
(This post was last modified: Jan-23-2017, 08:56 AM by sym.)
Hey, thank you very much for the help. Using wheel helped to solve the numpy problem and the .exe is starting correctly.
There is now only one Module still causing an error for me. It is PySoundFile pip install pysoundfile, currently when I build an .exe with it included it crashes the app on start. I believe it might be the same behavior that happened with numpy before, however I have not found a proper wheel installation.
#!/usr/bin/python35
import numpy.core
import soundfile
print("Soundfile")
data, samplerate = soundfile.read("path to audio file")
print(samplerate)
print (data) When launching the .exe via the Command Line I can see the following warnings:
Error: Traceback (most recent call last):
File "lib\site-packages\soundfile.py", line 259, in <module>
File "lib\site-packages\cffi\api.py", line 139, in dlopen
File "lib\site-packages\cffi\api.py", line 769, in _make_ffi_library
File "lib\site-packages\cffi\api.py", line 757, in _load_backend_lib
OSError: library not found: 'sndfile'
Posts: 7
Threads: 2
Joined: Jan 2017
Figured it out. The missing .dll needed to be specified as a seperate import in the pyinstaller .spec file.
|