Using Docker interpreter with PyCharm

Answered

Hello guys!

I don't know if it's a stupid question or not so please forgive me if it is. I am using a docker image as python interpreter. The docker image I'm using is a container contains PyTorch with RoCM. PyCharm can detect the docker image, able to get the python installed in the image but I cannot proceed since the "Remote project location" part is not auto-specified. In official jetbrains doc says nothing about remote project location, so I'm assuming usually it's been filled automatically. The field I'm talking about can be seen that picture:

I don't know how to use Docker Compose files, so I couldn't try if it's working with a Docker Compose file. If anybody can help me create a docker compose file I would be much appreciated. Normally, in terminal, I'm creating a container with the following line of code:

docker run -i -t \
--network=host \
--device=/dev/kfd \
--device=/dev/dri \
--group-add video \
--cap-add=SYS_PTRACE \
--security-opt seccomp=unconfined \
--workdir=/pytorch_docker_share \
-v $HOME/pytorch_docker_share:/pytorch_docker_share rocm/pytorch:rocm2.3_ubuntu16.04_py3.6_pytorch /bin/bash

Can someone help me out on using a docker image as python interpreter in PyCharm?

Ps: I'm using PyCharm 2019

Edit: I was able to proceed without specifying "remote project path" by selecting virtualenv option and specifying docker image later. However, now pycharm is not able to see installed packages in that image. Furthermore, it says there is no packaging tool is installed. When I try to install via pycharm, I'm getting that error:

python3: can't open file '/tmp/tmpxqcpvwnspycharm-management/setuptools-40.8.0/setup.py': [Errno 2] No such file or directory

3 comments
Comment actions Permalink

Hi,

Remote project location is auto-filled when using remote SSH interpreter, but I believe it shouldn't be used with Docker.

Configuring Docker and docker compose interpreter is confusing. I would suggest to try our examples from documentation

Using docker: https://www.jetbrains.com/help/pycharm/using-docker-as-a-remote-interpreter.html?section=Windows

Using docker-compose: https://www.jetbrains.com/help/pycharm/using-docker-compose-as-a-remote-interpreter.html?section=Windows

This should help to better understand the workflow with docker/docker-compose in PyCharm.

0
Comment actions Permalink

Hello Fkucuk! Were you able to solve the problem with providing "Remote project location" and getting your project to run? I have a similar issue and I appreciate your feedback!

 

 

0
Comment actions Permalink

Hi,

Creating Scientific project with a remote interpreter is not possible at the moment https://youtrack.jetbrains.com/issue/PY-29312, please vote for the feature request and follow it for updates.

0

Please sign in to leave a comment.