So, I am trying to create an exe using PyInstaller. My application worked fine before adding a feature with matplotlib. Now I get an import error with dateutil. I have added dateutil to the hidden imports and PyInstaller keeps returning the following error:
ERROR: Hidden import 'dateutil' not found
I did some drilling down and just made a simple file to recreate the issue and see if it was the matplotlib package or something due to dateutil.
The following script hello.py runs in my environment with no import errors:
import dateutil
print "Hello World"
When building with PyInstaller with the following command:
pyinstaller --onefile hello.py
I still get the error:
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: No module named dateutil
I have found some hints that there might be some existing problems importing dateutil but nothing that helps my specific case. I have tried making a hook for dateutil and it doesn't seem to get run by PyInstaller, so I worry importing dateutil is not the name PyInstaller sees it as, but I don't know what else it could be (I tried python_dateutil and python-dateutil as well, neither worked). I also tried the --debug flag to see if I got more information, but all I saw was:
LOADER: Running hello.py
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: No module named dateutil
I am missing something and I can't figure it out. I hope someone out there can help me out.
Note: Using Python 2.7.9, PyInstaller 3.0 and dateutil is version 2.4.2
Thanks!
Related
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
I'm trying to import PyPDF2 and it won't work. I installed it using pip, then tried it with pip3, it is installed. When I try to import I get the error
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'PyPDF2'
I'm using Python 3.7. I found a similar issue here, doesn't seem any of the answers worked and I tried them myself to the same results.
If anyone else runs into this problem try using sys.path to find the site-packages directory. I copied my PyPDF2 packages into my Python37 directory and now it works.
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.
I have installed the openpyxl Python module in my machine, or at least I thought I've done that. I entered these commands on the command prompt (on Windows):
C:\Users\gluti>cd C:\Users\gluti\PycharmProjects\Data Structures\venv\Scripts
C:\Users\gluti\PycharmProjects\Data Structures\venv\Scripts>pip install openpyxl==2.1.4
And then, it shows a message, saying that the module openpyxl was successfully installed. However, when I try to import this module on Python IDLE, it shows the following error message:
import openpyxl
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import openpyxl
ModuleNotFoundError: No module named 'openpyxl'
Did I miss something or am I installing the module in the wrong directory?
It is possible you have installed python 2 and python 3 so there are two different versions of pip on your machine.
You need to ensure you are installing openpyxl in the same type of python that you are using to run the script.
I am working on OpenSolaris(2009.06) OS. i recently installed the pycurl libraires using the following command:
$> python setup.py install --curl-config=/usr/local/bin/curl-config
the installation went perfectly fine. However now when i am trying to import the pycurl library in my python program, an error is being reported
>>>import pycurl
Traceback (most recent call last):
File "<stdin>", line 1, in ?
ImportError: ld.so.1: isapython2.4: fatal: libcurl.so.4: open failed: No such file or directory
I cant figure out where exactly i am going wrong. Any help...?
Thanks in advance.
Shubham
Sounds like your loader doesn't know where to find the cURL library. See your OS documentation for how to specify locations to search.