Python 3.5 - PyInstaller not working - python

im coding a program in Python 3.5.1 and i intended to use PyInstaller to create an excutable, i've used PyInstaller before but now it doesn't seem to work, wich i find weird because it worked before.
I even tried with a simple hello world program but it doesnt work. PyInstaller creates a "warn...txt" file wich as a lot of warnings, saying that theres "No module named (module name) and then the path to the project directory". When i used it before it never gave those warnings and modules were imported sucessfully.
I know that this isnt a lot of information but even with the hello world program (without importing any module) it doesnt seem to work, it creates the executable but i when i run it nothing happens.
Do you have any idea what it might be? and what approach should i take in order to resolve this problem?
Here's some of the output in the command line

Related

Python (manimgl) cannot find module in current directory

I'm trying to run a python program (specifically, I'm running manimgl, but I don't think that matters here) and the first line reads from manim_imports_ext import *. However, I am getting the error ModuleNotFoundError: No module named 'manim_imports_ext' even though I have verified that the file manim_imports_ext.py is in the current working directory. The program itself is in a subdirectory, but that doesn't seem relevant.
Any help would be greatly appreciated; it seems like I must be doing something dumb.

Python exe file fails due to ModuleNotFoundError: Numpy. This is confusing because numpy is already installed and the program works in Pycharm

I've written a Python program using pandas in Pycharm which works really well. However when I try to convert the Python program into an .exe file using pyinstaller in command prompt, the program fails. It successfully converts to an exe file but wehen I execute the program, a new window appears for 0.25 seconds and than terminates. I took a print screen of the window and the error it says is
"ModuleNotFoundError: No module named numpy. "
This is really confusing as Numpy is installed and the program executes perfectly in pycharm. I've tried copying and pasting the code to a new file, and created a new python file with that code. Still getting the same issue. I'd appreciate any advice you can provide :)

os.listdir() returns nothing, not even an empty list

During a presentation yesterday I had a colleague run one of my scripts on a fresh installation of Python 3.8.1. It was able to create and write to a csv file in his folder (proof that the csv library was working correctly), but everything else failed due to not being able to find the needed files. To try and isolate the problem and figure out why, we tried the below simple script, which also failed.
He had this test.py script in "D:/TEST", which also contained some folders and image files. Running this script printed nothing to the console. No empty list, no error message, no newline. Maybe the print() function was also not working, but I didn't get around to testing that.
import os
print(os.listdir())
This script works fine on my computer and my other colleagues computers (all Windows 10, similar hardware). I didn't have time to look into the issue more thoroughly and don't have access to his computer anymore. What could be the problem? What other things could I have him look into in order to fix this? In case this problem appears again during a future presentation, what steps could I take to figure out the cause of it?
My colleague uninstalled Python and reinstalled it. After doing this apparently the "python" command will no longer run his scripts, but using "py" instead will. Now that he is using "py" to run his scripts, it is working as expected.

Python: no module named 'bottle-websocket' when running an executable made with PyInstaller, including Eel module

I was playing around with the eel module for Python - gives an opportunity to run HTML + CSS/JS with the python functionality.
Made a simple program, tried to make an executable out of it via PyInstaller.
No errors whatsoever, but when running this executable it crashes on the first line - import eel, telling - there is no module called 'bottle-websocket'.
I checked pip: eel, bottle-websocket are installed. Can't figure out what's the problem. Attachments:
main.py:
import eel
from os import path
eel.init(path.dirname(__file__) + "/web")
eel.start('main.html', block=False)
while True:
eel.sleep(10)
Error:
Picture with the error while I try to start the exe
EDIT:
PyInstaller Log
I was also having this same issue, but I finally fixed it, it was actually very very easy, first of all make sure you are using auto-py-to-exe to package your app.
After inserting necessary details (script file,, extra files etc), you would see an advanced options tab probably below, click on it to expand it, look for the hidden imports label and insert "bottle-websocket" in the input field representing the hidden imports, that's basically all you need to do
I HOPE THIS HELPS
Took me the whole day figuring out the solution, but finally, here it is:
Copy the plugin.py, server.py files from C:\Users\YOUR_USERNAME\AppData\Local\Programs\Python\Python36-32\lib\site-packages\bottle_websocket to C:\Users*YOUR_USERNAME*\AppData\Local\Programs\Python\Python36-32\Lib
Make sure you have this line as follows in your *.spec file generated by PyInstaller (FOR PYTHON 3.6 32bit):
datas=[('C:\Users\YOUR_USERNAME\AppData\Local\Programs\Python\Python36-32\lib\site-packages\eel\eel.js', 'eel'), ('PATH_TO_YOUR_WEB_FOLDER', 'YOUR_WEB_FOLDER_NAME')]
3)Run this command in cmd: python C:\Users\YOUR_USERNAME\AppData\Local\Programs\Python\Python36-32\lib\site-packages\eel\main.py HERE_SHOULD_BE_THE_PATH_TO_YOUR_WEB_FOLDER
this command will get the 'bottle-websocket' work and will make sure that it complies with the web folder and files.

Issues with pyinstaller

I have created a working GUI program (using tkinter), but when I try to compile it using pyinstaller (py2exe only works for python 2.6 and I used 2.7 for the program), it doesn't work. I have 2 files: program.py, and data.xml. The program uses the xml document to retrieve information and display it to the window. I have looked all over, but no one seems to have had a similar problem, and the pyinstaller documentation is useless. the command I used was
python pyinstaller.py -w -mdata.xml -nProgram program.py
It appears to make the spec file fine, but generates an error with a large traceback upon build:
pyinstaller.utils.winmanifest.invalidManifestError: Invalid root element <items> - has to be one of <assembly>, <assemblyBinding>, <configuration>, <dependentAssembly>
and quits the build process. This is the first time I have tried to build an executable for a project, so I'm kind of shooting in the dark here. Did I forget to do something, or did I just find a bug in pyinstaller's program?
Normally I wouldn't answer my own question, but I have solved the issue and I think others should know about this. When creating your program and using an xml with it, you must have the root tag (the first one) as <assembly>. Not sure why, but it works when I do that. also, don't forget to use the --hidden-import=Module command if you imported anything into your program.

Categories

Resources