Reputation: 618
I'm trying to setup Pycharm to properly work with Docker. Right now I'm dealing with the remote python interpreter from inside a container.
Using SSH to access the remote interpreter, Pycharm is able to read the packages:
If I configure it to work with docker-compose instead, it detects a python interpreter, but is unable to read which libraries are installed:
Here are the configurations I'm using:
SSH:
Compose:
Any idea?
Upvotes: 4
Views: 2200
Reputation: 315
As stated in this issue directories with site packages could be added manually. For PyCharm Professional 2021.3 on Mac go PyCharm -> Preferences -> Project -> Python Interpreter, press the gear button -> Show All..., select your interpreter and press "Show paths for selected interpreter" button and add path to site packages folder.
In my case it also worked with writing full path to "Python interpreter path" in Python Interpreter settings.
Upvotes: 1
Reputation: 618
As I've finally realized, when Pycharm uses the SSH connection it doesn't get access to the environment variables, not to the ones defined in the docker-compose.yml.
To solve this you can either use the docker-compose remote interpreter instead of SSH or set the environment variables in "Edit Run/Debug Configurations" in Pycharm.
Upvotes: 3