No module named 'PyPDF2._codecs', even after already installed - python

I have installed PyPDF2==2.3.0, but I still get the error below when I import PyPDF2.
The error message is:
ModuleNotFoundError: No module named 'PyPDF2._codecs'

This issue was only present in the PyPI distribution of PyPDF2==2.3.0 for a couple of hours. It was fixed with release 2.3.1. See #1011 for more details
I'm the maintainer of PyPDF2. I'm sorry I caused some headaches.
You can update PyPDF2 via:
pip install PyPDF2 --upgrade

Related

Pip installed a module I want to use, but still getting "module not found" error

I am trying to use the Python module Gdal. I have run pip install gdal and I recieve the message
Requirement already satisfied: gdal in c:\users\willy\appdata\local\packages\pythonsoftwarefoundation.python.3.9_qbz5n2kfra8p0\localcache\local-packages\python39\site-packages (3.3.1)
and yet when I run import gdal in my Python IDE (I use Spyder), I still get the error no module named gdal
You need to tell Spyder which Python interpreter to use. Point it to the one you're installing the package for, as it seems that it's using a different one.
https://docs.spyder-ide.org/current/faq.html#using-existing-environment
From the documentation it seems you have to call:
from osgeo import gdal
See here
Answer is here in Spyder docs: https://docs.spyder-ide.org/5/faq.html#using-packages-installer
Don't try to use pip install and expect it to work in Spyder. Follow these instructions

ModuleNotFoundError: No module named 'psycopg2' (But it is installed)

I've been stuck on a part of a Udemy course. Even the (very helpful) tutor on there has run of ideas. When I try and run my script I get:
ModuleNotFoundError: No module named 'psycopg2'
I've done pip install psycopg2 and pip install psycopg2-2.8.4-cp37-cp37m-win_amd64.whl. Both result in 'requirement already satisfied'. I tried CTRL+SHIFT+P, Select Interpreter, and got the same problem with all of the three options. Only difference is Python3.8.0 gives me a Unable to import 'psycopg2' pylint(import-error) [1,1] error as well.
C:\Python\Database>pip install psycopg2
Requirement already satisfied: psycopg2 in c:\users\jeff\anaconda3\lib\site-packages (2.8.4)
C:\Python\Database>script1.py
Traceback (most recent call last):
File "C:\Python\Database\script1.py", line 1, in <module>
import psycopg2
ModuleNotFoundError: No module named 'psycopg2'
Edit
I still can't figure this out. And now I just got the same problem with Tweepy. ModuleNotFoundError: No module named 'tweepy' after I'd just successfully installed it. And similar error in the problems tab on VSC Unable to import 'tweepy' pylint(import-error) [1,1].
Psycopg project has modified the way they distribute the package. Starting from version 2.8.0, psycopg2 wheel on Pypi is a source distribution. To get the same package you used to install, you have to
pip install psycopg2-binary
Explanations can be found in psycopg-2.7.4 release note:
The psycopg2 wheel package will be renamed from release 2.8; in order to keep installing from binary please use "pip install psycopg2-binary" instead. For details see: </docs/install.html#binary-install-from-pypi>.
I guess you need to first install the dependencies.
sudo apt-get install build-dep python-psycopg2
Now run
pip install pyschopg2
I had a similar issue. I solved it by installing psycopg2 using PyCharm UI as follows :
Go to Current interpreter at the bottom of the window
Python Interpreter
Interpreter Settings
Interpreter Settings
Press (+) to add a package
Add package
Type psycopg2 on the search bar and press Install Package at the botton
Install psycopg2

No module named 'xlrd' when xlrd module is installed

I am using Jupyter Notebook in an environment, and when I try to use xlrd module I get "No module named 'xlrd". I checked others Stack Overflow posts and I installed the module xlrd using the command pip3 install xlrd. but still it continues to throw me the error No module named 'xlrd.
I tried again to install may be something went wrong and I get Requirement already satisfied: xlrd in /usr/local/lib/python3.6/site-packages which I believe it's ok. Is it possible that I have to update my environment in order to use the new installs? If so how do I do it?

using python faker library but have import error

I had this line in my code from faker import Factoryand I had the error ImportError: no module named faker. So I looked up on Stack Overflow and pip installed fake-factory. It says installation successful but then when I ran the code again it gives me another import error:
ImportError: The ``fake-factory`` package is now called ``Faker``.
Please update your requirements.
What am I missing here?
I had the same problem.
As the ImportError implies, you need to install Faker for this.
Move the directory in which your python library is installed and try this..
First uninstall fake-factory (I use pip) pip uninstall fake-factory
Then check if it is uninstalled using pip freeze and it should not be there
Then, proceed with installing Faker by pip install Faker
Now, try running that code again, it should work. Hope this helps :)
For me, It was working when I run pip uninstall fake-factory.

ImportError: No module named twilio.rest

I realize this question has been posted before (1, 2), but none of the posted solutions have worked for me.
I've correctly installed twilio in python 2.7.0 using pip install
I've checked to make sure none of the projects are named twilio.py
I've tried uninstalling and re-installing, confirmed twilio version 5.7.0
tried relaunching IDLE
I'm still getting the "ImportError: No module named twilio.rest" message. What can I do?
You need to make sure that your pip command that you are running is from the right path, just as described in their FAQ
This one worked for me:
/usr/local/bin/pip install twilio

Categories