AssertionError: Failed to determine matplotlib's data directory!
Im not using maptolib anywhere and there is another error assiciated with it
File "C:\Python310\lib\site-packages\matplotlib\colors.py", line 51, in <module>
from PIL import Image
ModuleNotFoundError: No module named 'PIL'
My command
pyinstaller --noconfirm --onefile -w --console --name "Project1" --add-data "C:/Users/user/Desktop/bot/app.py;." --add-data "C:/Users/user/Desktop/bot/czgen.py;." --add-data "C:/Users/user/Desktop/bot/sk.py;." --add-data "C:/Users/user/Desktop/bot/site.py;." --hidden-import "colorama" "C:/Users/user/Desktop/bot/main.py"
Any ideas?
i think one of the modules you used needs matplotlib, so check if everything works. otherwise, i would suggest to clear out the virtual enviroment and downloading everything back. this way the issue will be inside of the code and not in pyinstaller, therefore it'll be easier to debug and find the issue.
Related
i made a python script(flask) that use html and generate a local host link to open my website i also imported some deep learning models to my project what i want is i want to make an exe file that gives me the output is the local host link so i used this command to make it
pyinstaller --onefile main.py
but when i run my exe file it gives me this error
no module named cv2
i also tried this command
pyinstaller spec_an_API.py --onefile --add-data "templates";"templates" --add-data "static";"static"
but same problem
not that my program has no errors i tried to run it from pycharm and it works well
I'm trying to build an exe file from a python game using PyBox2D and Pyglet.
When I build the exe there occurs an error that a module cannot be imported:
Unable to import the back-end pyglet: module 'gui.backends' has no attribute 'pyglet_framework'
I guess this happens because this file only gets imported indirectly/hidden from another file with __import__()
This is my project hierarchy:
I've tried to add the file to pyinstaller on multiple ways. From the directory /SpaceJam/building I've tried calling:
pyinstaller.exe --onefile "../game/spacejam.py" --hidden-import="gui/framework/backends/pyglet_framework.py"
pyinstaller.exe --onefile "../game/spacejam.py" --hidden-import="../gui/framework/backends/pyglet_framework.py"
pyinstaller.exe --onefile "../game/spacejam.py" --hidden-import="../gui/framework/backends/pyglet_framework"
pyinstaller.exe --onefile "../game/spacejam.py" --hidden-import="../gui/framework/backends/*"
but none of that seemed to change anything in the error message.
I feel like I'm missing something obvious. Does somebody have an idea what I might be doing wrong or why the --hidden-import argument doesn't seem to work?
That argument expects a module name, not a filesystem path. How would you import it?
I'm not totally clear on how your project is set up, but try
--hidden-import gui.backends.pyglet_framework
I have a python program I'm converting to a single binary file and then moving to a different platform. When I run the binary it's complaining about a missing library. What's confusing is that it is present. How can I fix this error?
Binary Created:
pyinstaller --hidden-import pyaudio --hidden-import wave --hidden-import Logger --hidden-import json --hidden-import websockets --hidden-import asyncio --onefile Run_SD.py
Running Binary (on different platform):
/lib/libcrypto.so.1.1
/usr/lib/libcrypto.so.1.1
~$ ./Run_SD
[3656] Error loading Python lib '/tmp/_MEIgqfADy/libpython3.7m.so.1.0': dlopen: libcrypt.so.1: cannot open shared object file: No such file or directory
But the library is on the platform:
/lib/libcrypto.so.1.1
/usr/lib/libcrypto.so.1.1
(on the source plaform it's at: /usr/lib/aarch64-linux-gnu/libcrypto.so.1.1 )
I have found a solution .. not sure it's the correct one, but it works.
I copied the missing file into the source directory and then added --add-binary libcrypt.so.1:. to the command line which includes the file into the build and then all works.
i'm making a basic OCR with pytesseract, I have this line in my Code
pytesseract.pytesseract.tesseract_cmd = 'data/A/tesseract/tesseract.exe'
and run pyinstaller with
pyinstaller -F --add-data "data;data" OCR.py
but when I launch the application I get this error
data/A/tesseract/tesseract.exe is not installed or it's not in your PATH. See README file for more information.
But if I omit the -F
pyinstaller --add-data "data;data" OCR.py
it just works fine with no errors, But I need it to be a --one-file , How can I Fix it?
The Issue Resolved by adding
if getattr(sys, 'frozen', False) and hasattr(sys, '_MEIPASS'):
os.chdir(sys._MEIPASS)
at the beginning of the script
I have been able to freeze a Python/PySide2 script with fbs on macOS, and the app seems to work.
However, I got some errors from the freeze process stating:
Can not find path ./libshiboken2.abi3.5.13.dylib.
Does anyone know how to fix that?
Try to use the --runtime-tmpdir because while running the generated exe file it needs this file libshiboken2.abi3.5.13.dylib and unable hook that file.
Solution: use --add-data & --runtime-tmpdir to pyinstaller command line.
pyinstaller -F --add-data "path/libshiboken2.abi3.5.13.dylib":"**PATH"
--runtime-tmpdir temp_dir_name your_program.py
here PATH = the directory name of that file looking for.-F = one file