I am able to run my python (python 3.7) program on my pc from sublime text. The program uses tkinter and sqlite3. Does pyinstaller not support them?
The error I'm getting when running it (by simply double-clicking the file created in dist:
Fatal Python error: initfsencoding: unable to load the file system codec
zipimport.ZipImportError: can't find module 'encodings'
If anyone has some experience with this all help will be greatly appreciated!
I can post the code if the issue might be in the code itself.
You are using python 3.7. As far as I have tested , modules like pyinstaller don't seem to be working in this version. Try uninstalling your python (don't forget to backup your files before), and installing python 3.6.3 or any other python 3 version except python 3.7. Same happened with me and I did this. It worked.
Related
As you can see I have imported the modules correctly using pip install. I googled a bit why the module was not imported and I realized I have to add it to PATH. I did that too but now there is a new error something about a syntax error
File "pygame/__init__.py",
self.reason = f"{exc_type.__name__}: {self.info}"
Is this because my chrome book can not run Pygame or is the problem something else?
Picture of my terminal with the error:
you need to run python3. to start python 3. Just running python starts python 2.7.
you have your installed packages in python 3.9 version while your python environment is 2.7, look for python3 executable and try with that version
I have been building an application on Linux using python pygobject, and now I need to distribute it on Windows.
I first installed pygobject via msys2 (as per the official pygobject documentation)
Now, using msys2/mingw32, I can run my program typing
python3 main.py
But when I try to freeze it into a .exe with Pyinstaller, and try to run the produced .exe
If I Don't use --onefile, I get an import error on the _struct module (whereas "import _struct" works in python shell)
If I use --onefile, I get the Following error :
error:
lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-ani.dll could not be extracted!
fopen: No such file or directory
I’m using the devel version of Pyinstaller. I know next to nothing on Windows OS… does anyone know how to fix that error ?
It sounds like you were on the right path, unfortunately you ran in to a bug in PyInstaller. The good news is that the issue with the No module named '_struct' error is now fixed and released in version 3.6 and later. I would recommend using the --onedir mode of PyInstaller, you should be able to successfully package a GTK app for Windows.
I am trying to create a standalone executable with my python script using cx_Freeze.
This is the error I am getting: error: [Errno 2] No such file or directory: 'C:\\Program Files\\Python37\\tcl\\tcl8.6'
Does this have anything to do with using a module such as PySimpleGUI? I am using PySimpleGUI 3.1.2.
How do I fix this?
Here is my code (setup.py and Track_Companion.py).
Note: Track_Companion.py is not yet finished.
Instructions for making .EXE files from programs using PySimpleGUI can be found in the docs here.
To create the .EXE:
pyinstaller -wF yoursourcefile.py
I would upgrade your PySimpleGUI package prior to doing it.
cx_Freeze does not yet support Python 3.7, it has a bug. A bugfix exists but has not yet been released, however you can apply it manually, see What could be the reason for fatal python error:initfsencoding:unable to load the file system codec? and Cx_freeze crashing Python3.7.0. Or you can rollback to Python 3.6 if this is an option for you.
Have you checked that C:\\Program Files\\Python37\\tcl\\tcl8.6 exists? It would anyway be better to let your setup script dynamically determine you Python installation directory using PYTHON_INSTALL_DIR = os.path.dirname(os.path.dirname(os.__file__)) as done in this answer.
You need to tell cx_Freeze to include the Tcl and Tk DLLs using the build_exe option include_files as done in the same answer; if you are using cx_Freeze 5.1.1 or 5.1.0, you need to do it slightly differently, see this answer.
Is there now an easy protocol to build a .exe from python 3.5+, using modules pyqtgraph, qt5, theano, pymc3, numpy, scipy, os and sys, and opening a simple GUI stored in a '.ui' file ? I lost hours and eventually failed to make one (for w7-64 bits). Help !
preliminary failure with py2exe: I first install py2exe for python 3 but it turns out this is not compatible with my python 3.6 yet, so I downgraded to python 3.5… to get a bunch of errors. Then I went to forums and tried the proposed cures but failed (I’m uneasy with windows), the alternative being to downgrade to python 3.4… So I downgraded to python 3.4 to get an error concerning a missing ‘msvcr100.dll’ that I tried to install following instructions on forums but by default I don’t have the permission to modify system directories… When I eventually had this permission it turns out the ‘regsvr32’ command fails (isn’t this for 32 bits ? but there is no ‘regsvr64’…). Following episodes are described below.
update august 23, 2017, 1pm:
I also tried pyinstaller as advised but it failed (see my related question build a .exe for Windows from a python 3 script importing theano with pyinstaller)
I also tried cx_freeze but it failed (see my related question build a .exe for Windows from a python 3 script)
I also tried pynsist but it fails (same link than above)
what's next ?
update september, 2, 2pm:
I eventually managed to build a .exe with pyinstaller after many episodes.
Unfortunately I failed to deal with the ‘theano’ module (that is required in my case by the ‘pymc3’ module) and I had to modify the .py files and give up part of the application. Could anyone help me building a .exe for windows 7+, with the ‘theano’ module ?
see build a .exe for Windows from a python 3 script importing theano with pyinstaller
Pyinstaller Works with Python 3.5 and it is working even for packages like tensor-flow, scipy , etc (The packages I worked with)
py -3.5 pip install pyinstaller
then go the C:\Users\user\AppData\Local\Programs\Python\Python35\Scripts
and run the command
pyinstaller <code .py file along with directory> --onefile
--onefile : is for compressing the build and get a single file as output
I would suggest pyinstaller see http://www.pyinstaller.org/
The pyinstaller already supports 3.5
The development version supports 3.6
It is better to use spec file to import other hidden libraries. I listed all Sklearn libraries and add them to spec file as a hiddenimports, you can add libraries you used in your project.
My laptop is installed with Windows 7 64-bit operating system.
Prior to the installation of Python 3.4 using installation file "python-3.4.0.amd64.msi" (downloaded from https://www.python.org/downloads/release/python-340/), I have been using Python 2.7. However, I still need Python 2.7 for ABAQUS and hence need to retain it.
After I installed Python 3.4 and added its path to the environmental variables there was a conflict in calling "python" from command prompt. So I re-named python.exe in Python27 and Python34 folder as python27.exe and python34.exe, respectively. Also I added 27 and 34 as suffix to various other files in scripts folder in both version. I doubt if this is the best way to go forward in retaining two versions at the same time. So this is one question for which I would like an answer or a suitable reference.
But after installation of Python 3.4 I am not able to load python.exe, neither directly from folder nor command prompt. I get the following error:
Fatal Python error: Py_Initialize: unable to load the file system codec
Traceback (most recent call last):
File "C:\Python34\Lib\encodings\__init__.py", line 31, in <module>
ImportError: No module named 'codecs'
I am not able to uninstall the Python 3.4 from the control panel too. I get the following error when I attempt it:
I also tried removing the folder and installing the setup again. But still I get the same error.
I would be glad if some of the Python experts to help me resolve this problem.