Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Lost Module
#1
I install a package via pip
"pip install pypdf2". I see it install. I then try to import it "import pydf2". It complains about "import" as an invalid command. I type "python" and try from there. Import is not rejected - now told that pypdf2 is not installed. I have uninstalled and reinstalled with no results. I have check the path. Its fine.
Reply
#2
try python -m pip install pypdf2 perhaps.
Reply
#3
import is not all lowercase.
>>> import PyPDF2
>>>
>>> PyPDF2.__version__
'1.26.0'
Yoriz and Gribouillis like this post
Reply
#4
python -m pip install pypdf2 does indeed get pypdf2, which I had been successful with at the time I posted. Then trying to import this module in that same virtual environment fails to recognize the "import" keyword.
Reply
#5
Use snippsat's code in a python shell.
Reply
#6
(Oct-29-2021, 09:53 PM)Gribouillis Wrote: Use snippsat's code in a python shell.

Got no idea what that means.
Reply
#7
(Oct-29-2021, 10:37 PM)standenman Wrote: Got no idea what that means.
Python interactive shell >>>.
As your on Windows from cmd.
# Where pip install to
C:\>pip -V
pip 21.2.4 from c:\python39\lib\site-packages\pip (python 3.9)

# Start interactive shell
C:\>python
Python 3.9.5 (tags/v3.9.5:0a7dcbd, May  3 2021, 17:27:52) [MSC v.1928 64 bit (AM
D64)] on win32
Type "help", "copyright", "credits" or "license" for more information.

# Can not use lowercase
>>> import pypdf2
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'pypdf2'

>>> import PyPDF2
>>>
>>> PyPDF2.__version__
'1.26.0'
>>> exit()

C:\>
Yoriz likes this post
Reply
#8
With all due respect, you are not answering or addressing my question at all, you are just throwing code at me.
Reply
#9
snippsat is answering your question by showing the correct code to import the module.
You are being told that import is case sensitive, you currently have the import as all lower case as follows
import pypdf2
so try using the following instead which has only the y in lowercase and the rest of the letters are capital letters.
import PyPDF2
Reply
#10
In this this thread that you started more than 3 years ago, you knew very well how to use PyPDF2 in your code. Why don't you do the same thing?
Yoriz likes this post
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Lost Control over VLC jrockow 8 1,094 Jul-18-2023, 06:04 PM
Last Post: jrockow
  Lost Modules standenman 2 734 Jun-22-2023, 12:18 PM
Last Post: standenman
  XML Editing formatting lost ateestructural 2 1,923 Apr-08-2021, 04:41 AM
Last Post: ndc85430
  List structure lost when multiplying Protonn 2 2,257 Apr-23-2020, 04:16 AM
Last Post: buran
  lost dictionary jjpy 1 1,899 Jul-10-2019, 12:19 PM
Last Post: scidam
  variable gets lost Jordy 10 9,160 Oct-10-2016, 08:08 PM
Last Post: Yoriz

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020