ModuleNotFoundError with pyinstaller but fine in Pycharm - python

I'm trying to convert a .py project to an .exe file using the using the Auto Py To Exe which uses the pyinstaller.
Running my code inside pycharm I get no errors. Running the .exe file i'm getting the error:
Traceback (most recent call last):
File "objectGui.py", line 6, in <module>
ModuleNotFoundError: No module named 'scipy'
[19724] Failed to execute script objectGui
I've tried adding following bit of code to the conversion
--hidden-import scipy
This does not change the error I keep getting.
Any suggestions?

I have found the solution in
this post.
Since I worked on my project in an environment (PyCharm) I needed to type in the command in the PyCharm terminal for it to work. I also added the hidden import:
--hidden-import scipy
to find the module and it worked!

Related

ModuleNotFoundError: No module named 'feedparser'

I have Python 3.11 and I have done everything expect Anaconda thing in this video below to try and fix this issue.
https://www.youtube.com/watch?v=RvbUqf3Tb1s&t=181s&ab_channel=TechWithTim
Here is the error:
C:\Python311\python.exe
C:\Users\16789\PycharmProjects\cyberNewsfeed\main.py Traceback (most
recent call last): File
"C:\Users\16789\PycharmProjects\cyberNewsfeed\main.py", line 1, in
import feedparser ModuleNotFoundError: No module named 'feedparser'
Attached is a screenshot of my interpeter and structue.
Tried everything in the linked video besides anaconda and i was expecting it to run. I restarted my computer as well.
You have to install the missing package. Try this in a shell inside your python environment.
pip install feedparser

Snap7 module not found with python .exe

I'm using Pycharm to create a simple program that uses snap7 lib. to read a S7-1200 PLC, it works correctly when i run it with Pycharm but when i try to run it with an .exe file it prompts this error message:
Traceback (most recent call last):
File "main.py", line 1, in
ModuleNotFoundError: No module named 'snap7'
the snap7.dll and .lib are both in sys32 folder aswell as in environment variables PATH route.
both the python file and my PC are x64 so i used the x64 version of the DLL and lib files.
What am i missing?
How did you install the snap7 library?
py -m pip install python-snap7 is the way i installed it. I never had any problems with it.

Module can be imported in the terminal, but not IDLE

Recently, when I use pip to install python modules, I will get an error saying that the module has not been downloaded when I run it in the IDLE. However, when I run the same script in the terminal, it works fine. What is this error and how can I solve it?
Traceback (most recent call last):
File "<pyshell#8>", line 1, in <module>
import gspread
ModuleNotFoundError: No module named 'gspread'
Probably you have different versions of python installed.
The version you used pip to install new modules is different from the version you access with IDLE.

Python 3.6.x PyInstaller gives error "No module named 'PyQt5.sip'"

I developed a few programs that runs well on Python 3.5.4, but because of some errors about win32 made me go to Python 3.6.4, but when I build my project with pyinstaller, I get:
C:\Users\User\Desktop\dist\mycommentator>mycommentator.exe
Traceback (most recent call last):
File "mycommentator.py", line 6, in <module>
File "c:\users\user\appdata\local\programs\python\python36\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 714, in load_module
module = loader.load_module(fullname)
ModuleNotFoundError: No module named 'PyQt5.sip'
[1532] Failed to execute script mycommentator
I tried to reinstall python, so I installed Python 3.6.4/Python 3.6.5, that error happened to me too.
No matter what code in PyQt5 I build, every time this error.
I also tried to move sip.pyd to the project folder, but error still happens.
I also tried pip install --upgrade sip, that didn't help.
I also tried to install the develop version of the pyinstaller, that didn't help too.
I had the same issue which is apparently a known bug due to sip now being installed separately.
https://github.com/pyinstaller/pyinstaller/issues/3630
Upon creating the installer I added the line:
--hidden-import PyQt5.sip
This worked no problem.
I solve this error (python3.10) by adding this code at the top of the main file:
import PyQt5.sip
before this i tried hidden import (https://github.com/pyinstaller/pyinstaller/issues/5381) with no fix :(

no module named pywinauto

when I type the following on python2.5 IDLE (windows vista 32-bit)--
from pywinauto import Application
I get this error message--
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
import pywinauto
ImportError: No module named pywinauto
I followed the instructions from this site, and did not get any error message during installation. What did I not get right here?
Thanks!
Do you have multiple versions of Python installed? Maybe the python.exe that was used for python.exe setup.py install is not Python 2.5. To check, open a command prompt and run python.exe -V.
If that is the problem, you need to go to the directory where you extracted the pywinauto zip file, and run C:\python25\python.exe setup.py install

Categories