Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python Visual Studio Code Module not found

Have installed Python 3.7.6 and am trying to write a code in Visual Studio Code

Using: import pikepdf

Gets me the error of ModuleNotFoundError: No module named 'pikepdf'

However, I run "pip install pikepdf" and I get:

Requirement already satisfied: pikepdf in c:\users\ME\appdata\local\packages\pythonsoftwarefoundation.python.3.7_qbz5n2kfra8p0\localcache\local-packages\python37\site-packages (1.8.2) Requirement already satisfied: lxml>=4.0 in c:\users\ME\appdata\local\packages\pythonsoftwarefoundation.python.3.7_qbz5n2kfra8p0\localcache\local-packages\python37\site-packages (from pikepdf) (4.4.2)

My installation path for Python is: C:\Users\ME\AppData\Local\Programs\Python\Python38

And trying to change something in the "Python: Python Path" gets me more errors.

like image 404
Mario Garcia Avatar asked Mar 14 '26 05:03

Mario Garcia


2 Answers

The issue was that Visual Studio Code comes with its own version of Python, while I had installed my own.

The issue was solved by changing the version VSC was running so it matched the one where the modules were being installed.

enter image description here

like image 82
Mario Garcia Avatar answered Mar 15 '26 18:03

Mario Garcia


You can check which environment your VSCode is using. You can do that by inspecting your left-bottom corner, here:

Visual Studio Code image.

When you are running your code, you are using python or python3.7?

like image 38
Dawid Gacek Avatar answered Mar 15 '26 19:03

Dawid Gacek



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!