Please consider editing your post and mark it as obsolete instead. Do you want to delete post?
How does PyCharm see available packages?
Permanently deleted user
Created
If I go Project Interpreter, I can see the installed packages for my project. However, in the editor, I get "Unresolved reference" for all my dependencies.
The project is installed in an env that also contains the project interpreter. I created this env with Nix (https://nixos.org/nix/), but as far as I can tell, it mimics an env created with virtualenv. This is what it looks like:
result/ bin/ python3 - What I set as Project Interpreter include lib/ python3.7/site-packages/ MowitiGIS/ MowitiGIS-0.1.dist-info/ share/
"MowitiGIS" is the name of my project.
You said:
"Do you have problems importing any modules (including the ones installed from PyPI) or only your own?"
PyCharm shows "Unresolved reference" for all external dependencies: django, django-leaflet, etc. wherever I import them in my project. However, it doesn't show this for the modules or packages of my project.
At the same time, if I go to Preferences and click on Project Interpreter, it shows all the dependencies installed in the env with their versions.
Hi,
Here's some suggestions you can try:
- Mark the directories where your code is located as "Source" using project structure settings.
- Ensure your code is not located inside a venv directory
- Try "File > Invalidate caches / restart"
- Try to delete and re-create project interpreter
If nothing of the above helped, please provide your project structure. Does the issue happen for any package?
Hi, Andrey,
Here are more details about my setup.
First, I'm developing inside a VM, so I chose the "Vagrant" option in the "Add Python Interpreter" window.
Next, my setup installs my project inside the interpreter's "site-packages" in development mode, but the project itself is not inside the env.
The issue occurs for all packages that my project uses.
I tried all the steps you suggested, but the issue persists.
The structure of my project is as follows:
project/
.git/
manage.py
project/
AppDir/
static/
templates/
__init__.py
settings.py
urls.py
wsgi.py
Is it correct that apart from opening the project in PyCharm, you also installed your project with -e flag to your project interpreter?
Do you have problems importing any modules (including the ones installed from PyPI) or only your own?
Hi, Sergey,
The project is installed in an env that also contains the project interpreter. I created this env with Nix (https://nixos.org/nix/), but as far as I can tell, it mimics an env created with virtualenv. This is what it looks like:
"MowitiGIS" is the name of my project.
You said:
"Do you have problems importing any modules (including the ones installed from PyPI) or only your own?"
PyCharm shows "Unresolved reference" for all external dependencies: django, django-leaflet, etc. wherever I import them in my project. However, it doesn't show this for the modules or packages of my project.
At the same time, if I go to Preferences and click on Project Interpreter, it shows all the dependencies installed in the env with their versions.