Missing site packages in remote docker interpreter

Hello all.

 

Just trying a project and setup the docker and everything but Pycharm can't find the site packages in remote interpreter.

Invalidated cache multiple times, tried with latest stable build and also the Early access build.

All the information can be seen in Screen shot. Site packages are existing on the docker side, path is okay it sees pip and other base package but nothing about the rest.

Any help is appreciated.

0
5 comments

Hi,

In the interpreter settings, you should see the interpreter path, e.g. `python` or `/usr/bin/python`. Could you please start the container from the terminal, enter the bash shell inside the container and provide the output of `<interpreter_path> -m pip list`?

0

Hello Andrey, 

 

Sorry for the late reply. Somehow in this project I managed to make it read it for once and using that interpreter but now I have another project that does not able to find the packages. Same thing happens. 

I am putting the output that you asked and in interpreter it founds only pip, setuptools and wheel.

root@55afd1076cb7:/# /usr/local/bin/python -m pip list
Package             Version 
------------------- --------
asgiref             3.4.1   
attrs               21.2.0  
backcall            0.2.0   
decorator           5.1.1   
Django              3.2.6   
django-cors-headers 3.10.0  
django-model-utils  4.1.1   
djangorestframework 3.12.4  
drf-spectacular     0.20.0  
importlib-metadata  4.8.1   
inflection          0.5.1   
ipython             7.27.0  
jedi                0.18.1  
jsonschema          4.0.1   
matplotlib-inline   0.1.3   
parso               0.8.3   
pexpect             4.8.0   
pickleshare         0.7.5   
pip                 19.3.1  
prompt-toolkit      3.0.28  
psycopg2            2.9.1   
ptyprocess          0.7.0   
Pygments            2.11.2  
pyrsistent          0.18.0  
pytz                2021.1  
PyYAML              5.4.1   
setuptools          41.6.0  
sqlparse            0.4.1   
traitlets           5.1.1   
typing-extensions   3.10.0.2
uritemplate         3.0.1   
wcwidth             0.2.5   
wheel               0.33.6  
zipp                3.6.0   
0

Could you please show a screenshot of the interpreter settings from the second project? 

Does it show the same interpreter path? i.e. /usr/local/bin/python

0

Yes it was and I found the issue. The problem was when you pip install something inside of a docker. Pycharm does not recognize it as an installed package. However, if you use Dockerfile to install it, it finds. So we had a docker-entrypoint and it was installing packages after the Docker is up. 

Now I added pip installations in Dockerfile and pycharm is able to find it.

0

Please note it's recommended to install packages in Dockerfile using `RUN pip install <package>` statements. This will make package installation persistent in the image.

0

Please sign in to leave a comment.