I'm trying to create a pyinstaller app distribution
pyinstaller --windowed --add-data "folder:folder" --icon=icon.icns MyApp.py
but I'm getting this error:
Traceback (most recent call last): File
"site-packages/PyInstaller/loader/rthooks/pyi_rth__tkinter.py", line
30, in FileNotFoundError: Tcl data directory
"/Path/MyApp.app/Contents/MacOS/tcl"
not found. [55354] Failed to execute script pyi_rth__tkinter
The strange thing is that I'm not using Tkinter anywhere in my application.
I noticed this in the logs as well:
4000 ERROR: Tcl/Tk improperly installed on this system.
And since my app doesn't rely on Tkinter anyway, I changed the pyinstaller command to this which fixed the issue:
pyinstaller --windowed --add-data "folder:folder" --exclude-module tkinter --icon=icon.icns MyApp.py
I'm still investigating how to fix my Tcl/Tk installation.
Related
A friend of mine asked me to write him a program, and I used pynput to handle some of the inputs and other features. When I convert the program an executable with pyinstaller, launcing the executable gives me this error: File "site-packages\pynput\keyboard\__init__.py", line 31, in <module> File "site-packages\pynput\_util\__init__.py", line 82, in backend ImportError [11492] Failed to execute script friend_project
I have tried using the pyinstaller command pyinstaller --onefile friend_project.py, and also using auto-py-to-exe to run it.
Using pyinstaller with other modules like pygame or pyopengl gives me no error, but this one module does.
Running the script by it self with the python inturpeter works fine, but I would perfer to have it be an exe so I can give it to him with out him needing python to run it.
Please fall back to 1.6.8 version of pynput.
pip install pynput==1.6.8
If you are running Windows you need to add these parameters to the command line (for the first time, after that they will be included in the generated spec file).
--hidden-import "pynput.keyboard._win32" --hidden-import "pynput.mouse._win32"
For Linux, use:
--hidden-import "pynput.keyboard._xorg" --hidden-import "pynput.mouse._xorg"
More information can be found in this Github issue.
I have used matlab, but I am only 2 weeks into Python. I downloaded anaconda 3.7 and am using spyder 4.1.3. I was following a youtube tutorial on python. I was doing well until the guy access the cmd prompt (I use Windows 10) from within his IDE.
I didn't know how to so I googled it and to do so I found on pypi.org that all I had to do was run pip install spyder-terminal in the cmd prompt. I tried this but at the end it said that I had a permissions error and to try the --user option. I copied and pasted the exact error and saw on git hub, to create an environment or run python -m pip install --user [INSERT PACKAGE NAME].
I don't really understand hat an environment is so I did the second --user way. I ran python -m pip install --user spyder terminal I got an error about a location not being in the path variable, so i just copied the file location that it referenced and copied it the the path. I then went to open up spyder 4.1.3 and i got the error
Traceback (most recent call last):
File "C:\Users\Aaron\anaconda3\lib\site-packages\qtpy\__init__.py", line 204, in
from PySide import __version__ as PYSIDE_VERSION # analysis:ignore
ModuleNotFoundError: No module named 'PySide'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\Aaron\anaconda3\Scripts\spyder-script.py", line 10, in
sys.exit(main())
File "C:\Users\Aaron\anaconda3\lib\site-packages\spyder\app\start.py", line 201, in main
from spyder.app import mainwindow
File "C:\Users\Aaron\anaconda3\lib\site-packages\spyder\app\mainwindow.py", line 53, in
requirements.check_qt()
File "C:\Users\Aaron\anaconda3\lib\site-packages\spyder\requirements.py", line 41, in check_qt
import qtpy
File "C:\Users\Aaron\anaconda3\lib\site-packages\qtpy\__init__.py", line 210, in
raise PythonQtError('No Qt bindings could be found')
qtpy.PythonQtError: No Qt bindings could be found"
I tried opening it again and got the same error. I then tried uninstalling an dre-installing spyder in the anaconda navigator and got the same error. I tried removing the location I added to path and running "pip uninstall spyder-terminal", it said it was removed and I go the same error.
If possible, I am seeking specific steps in layman's terms, because all my knowledge thus far has come from the first 2 hours of a "cool things in python" type video.
I'm trying to build my application to .exe with PyInstaller, but it seems, that PyQt3D module doesn't imports PyQt3D module.
It is impossible to build application with Qt3D with PyInstaller, or I need some extra configuration for this? I tried to add PyQt3D module in hidden-imports, but still have an error:
Traceback (most recent call last):
File "***\main.py", line 1, in <module>
from PyQt5 import QtWidgets, Qt3DCore, Qt3DExtras, Qt3DRender, QtGui, QtCore
ModuleNotFoundError: No module named 'PyQt5.Qt3DInput'
[13512] Failed to execute script main
I passed --hidden-import PyQt5.Qt3DInput to PyInstaller.
But still, I've got this:
Qt3D.Renderer.Jobs: unsupported format encountered (stl)
When I'm running my application in PyCharm everething is OK.
Maybe anyone can help with this?
Find out that to start import models with setSource() I need to add PyQt5/Qt/plugins/geometryloaders to PyQt5. So full command to build onefile PyQt3D Application is:
pyinstaller %input_file% --onefile --hidden-import PyQt5.Qt3DInput --add-data "venv/Lib/site-packages/PyQt5/Qt/plugins/geometryloaders";"PyQt5/Qt/plugins/geometryloaders"
I have a frustrating problem that set me back a day trying to get an executable file from my finished bookstore app.
I used the Pyinstaller --onefile --windowed bookstore.py from the main project menu, also vm/bin/Pyinstaller --onefile --windowed bookstore.py which created the .exe and .app file successfully.
HOWEVER, when running the .app file, nothing happens. It starts, and just disappears.
I ran the core executable from the cli on Mac from the main project folder with open dist/bookstore.app/Contents/Macos/bookstore and, loads of research and over 20 variations of code and file changes later, I got the same same trackback (N.B. different file path for global Pyinstaller) error message back from the console.
Traceback (most recent call last):
File "bookstore.py", line 5, in <module>
File "/Users/jmulhall/Documents/Documents/Python_Project_Folder/Python3_Training/ProjectBookstore/vm/lib/python3.6/site-packages/PyInstaller/loader/pyimod03_importers.py", line 631, in exec_module
exec(bytecode, module.__dict__)
File "tkinter/__init__.py", line 36, in <module>
File "/Users/jmulhall/Documents/Documents/Python_Project_Folder/Python3_Training/ProjectBookstore/vm/lib/python3.6/site-packages/PyInstaller/loader/pyimod03_importers.py", line 714, in load_module
module = loader.load_module(fullname)
ImportError: dlopen(/var/folders/0d/6l_1mgwn4cxbrx21_nm7l8gh0000gn/T/_MEIHyYK9G/_tkinter.so, 2): Library not loaded: #loader_path/Tcl
Referenced from: /var/folders/0d/6l_1mgwn4cxbrx21_nm7l8gh0000gn/T/_MEIHyYK9G/_tkinter.so
Reason: image not found
[3899] Failed to execute script bookstore
My Mac details are as follows:
MacOs High Sierra V 10.13.3 with a standard HD on a mid 2012 Macbook Pro
My Software versions are python 3.6.4, pyinstaller 3.3.1 , virtualenv 15.1.0, sqllite3 3.19.3
The most promsing fix on github did not work ergo my query on fixing the Pyinstaller issue for mac where it loads the tcl and tk resources. The links I followed are here:
Main Query Link - Github,
Support File Changes Demo for hooks
I created a pyinstaller-hooks folder and inserted the hook and pyruntime hooks file into the folder with the tclResources and tkResources name changes in the files as follows:
This did not work.
And I am still getting the above stack trace despite running the new command, picking up the new pyinstaller-hooks folder files in the main project folder, as follows:
pyinstaller --onefile --windowed --additional-hooks-dir pyinstaller-
hooks --runtime-hook pyinstaller-hooks/pyi_rth__tkinter.py bookstore.py
Why is it still not finding the the new files with Tree() and os.path.join()) functions altered to tkResources/tclResources and thus crashing the app when it tries to launch. I could not test the .exe as I have only a Mac environment so Im only focused on the .app right now. Can anybody help with this?
Nearly forgot, my main project folder view is as follows:
I installed cx_Freeze using pip:
C:\Users\Sarah\Documents\PythonScripts>python -m pip install cx_Freeze --upgrade
Collecting cx_Freeze
Downloading cx_Freeze-5.0.2-cp36-cp36m-win_amd64.whl (162kB)
Installing collected packages: cx-Freeze
Successfully installed cx-Freeze-5.0.2
However, I get this error when I try to execute a script:
setup.py build
Traceback (most recent call last):
File "C:\Users\Sarah\Documents\PythonScripts\setup.py", line 9, in <module>
from cx_freeze import setup, Executable
ImportError: No module named cx_freeze
When I check the system path, I get all this information
print (sys.path)
['', 'C:\\Users\\Sarah\\Anaconda3\\lib\\site-packages\\spyder\\utils\\site', 'C:\\Users\\Sarah\\Documents\\PythonScripts', 'C:\\Users\\Sarah\\Anaconda3\\python36.zip', 'C:\\Users\\Sarah\\Anaconda3\\DLLs', 'C:\\Users\\Sarah\\Anaconda3\\lib', 'C:\\Users\\Sarah\\Anaconda3', 'C:\\Users\\Sarah\\Anaconda3\\lib\\site-packages', 'C:\\Users\\Sarah\\Anaconda3\\lib\\site-packages\\Sphinx-1.5.6-py3.6.egg', 'C:\\Users\\Sarah\\Anaconda3\\lib\\site-packages\\win32', 'C:\\Users\\Sarah\\Anaconda3\\lib\\site-packages\\win32\\lib', 'C:\\Users\\Sarah\\Anaconda3\\lib\\site-packages\\Pythonwin', 'C:\\Users\\Sarah\\Anaconda3\\lib\\site-packages\\setuptools-27.2.0-py3.6.egg', 'C:\\Users\\Sarah\\Anaconda3\\lib\\site-packages\\IPython\\extensions', 'C:\\Users\\Sarah\\.ipython']
I am assuming that somehow, the path to the cx_freeze module is lost in here somewhere. I would really appreciate some simple (novice user) ideas for how to go about fixing this.
I tried copying the folder cx-freeze to the PythonScripts folder but that didn't help.
I know why you are getting this error and I do not think it has anything to do with the file path.
Try:
from cx_Freeze import setup, Executable
in the place of
from cx_freeze import setup, Executable
in your setup.py script
and this error should fix (you had f not F).