I was following the Packaging Python projects tutorial and everything was working fine. I uploaded my package to pypi and I can install it.
However upon importing, something odd happens;
Inside the shell, it works fine.
>>> import noodle_extensions
>>> # no errors indicate that it was imported properly.
>>> print(noodle_extensions)
<module 'noodle_extensions' from 'C:\\Users\\user\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\noodle_extensions\\__init__.py'>
However, inside VScode, I get this;
import noodle_extensions
Traceback (most recent call last):
File "c:/Users/user/OneDrive/Desktop/Codes/Python/Tests/test.py", line 1, in <module>
import noodle_extensions
ModuleNotFoundError: No module named 'noodle_extensions'
control+clicking it does not work. pylint thinks that it doesn't exist.
In terms of files at the pip install
location, I have the noodle_extensions
containing the __init__.py
, the .egg-info
folder and a .dist-info
folder.
Is there something I can do?
PyPi site
According to your description, the module "noodle_extensions
" exists in the environment "Python3.9
", please click on the Python interpreter displayed in the lower left corner of VSCode (or use F1
, python: Select Interpreter
), and then select "Python3.9
":
Or reinstall the module "noodle_extensions
" in the currently selected "Python3.8
" environment.
Check the installation package:
Reference: Environment in VSCode.