Pycharm not recognizing packages installed in venv (in a Docker container running on a remote host)

I am using the following setup:

PyCharm running on Windows, editing source files locally but with no need for the IDE to “deploy” them (they are made available to windows via a samba share).

Python (venv) running in a Docker container, run as part of a Docker Compose stack, in a Linux VM, to which i connect via ssh.

This setup kind of worked fine, as long as there was a native python interpreter in the Linux VM matching the one running in the container. But the VM was recently upgraded, and now it has python 3.12 whereas in the container there is python 3.10. It also has the latest Docker version.

The main issue is that PyCharmdoes not “see” the packages installed in the venv, even though the venv folder is within the project root directory.

I think that the root cause is PyCharm can not run the python venv successfully, because it can not connect to the remote container. In the Docker Settings in PyCharm I see an error about Minimum supported API being 1.40 and client version being 1.24.

Is there are known solution to make this work? I think it would be easy if it was possible f.e. to have PyCharm run a shell command by default when connecting via ssh, which would allow it to connect to the running Docker conatiner…

I almost forgot - this is PyCharm ver 2022.3 (the last version I can get under my free OSS license).

Thanks

Gaetano

0
4 comments

PS: even if I fix the error relating to minimum supported docker API version, PyCharm does not allow me to configure a remote Python interpreter running within a container _that I manage outside the IDE_.

It seems to only be able to connect to containers for which it will build/pull images. And it is not smart enough to grok the Docker Compose configuration I use (which is split in many files, uses a lot of env vars and relies on a custom shell script to set correct values to many of those)

0

Hi gggeek

I see an error about Minimum supported API being 1.40 and client version being 1.24

This appears similar to IJPL-217878, which has been fixed in PyCharm 2025.2.5 and later. As a workaround, you can downgrade Docker Engine to v28.5.x.

Please note that this setup may still not be fully reliable, as PyCharm does not currently provide native support for Docker running on remote hosts. There is a related issue here: IJPL-218396 - feel free to vote and comment on it.

If you’re not familiar with YouTrack, you can find instructions here: https://intellij-support.jetbrains.com/hc/en-us/articles/207241135-How-to-follow-YouTrack-issues-and-receive-notifications

1

> This appears similar to IJPL-217878, which has been fixed in PyCharm 2025.2.5 and later. As a workaround, you can downgrade Docker Engine to v28.5.x.

Thanks for the feedback, but, as I stated in my comment above, working around the issue with the docker engine API (I did apply the systemd config fix mentioned in the issue you linked to) is not enough.

The tip about allowing remote access to the Docker daemon via tcp,  as found on the other ticket, was also good. 

Alas, as you stated, it seems that PyCharm does not provide good-enough support for Docker running on remote hosts, where the container lifecycle is managed outside the IDE…

0

You are right,  PyCharm's Docker integration currently requires the IDE to manage the container lifecycle. Using an externally managed container on a remote host is not supported yet.

0

Please sign in to leave a comment.