Strinnityk Strinnityk - 4 years ago 355
Python Question

Pycharm docker-compose interpreter not loading libraries

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:

Compose 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:

SSH Packages

Here are the configurations I'm using:

SSH:

SSH Config

Compose:

Compose Config

Any idea?

Answer Source

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download