Probelm connecting Pycharm (2018.1.4) to nvidia-docker (version 2):


Dear all, the following action were executed

1) Compose the nvidia-docker-compose.yml by hand

    - /dev/nvidia0
    - /dev/nvidiactl
    - /dev/nvidia-uvm
    - /dev/nvidia-uvm-tools
    image: floydhub/dl-docker
    - ./disk:/disk
    - nvidia_driver_390.59:/usr/local/nvidia:ro
version: '2'
  media: null
    external: true

2) Under the Add Python Interprete-Docker compose, I add the nvidia-docker-compose.yml  under the Service. However, when confirming the setting, Pycharm give the following error.



May I know where I do wrong.

Thanks in advance for the time spent.

Comment actions Permalink

Hi rpb, PyCharm doesn't support nvidia-docker, unfortunately. Please vote for PY-26429.

Comment actions Permalink

Hi Pavel, thanks for the quick response. I wonder how others are able to connect Pycharm to nvidia-docker. I guess they are using somewhat lower version.

Some of the discussion can be found in the following


2) (maybe use lower version of Pycharm)

3)  (although he does not show how specifically on the setup)



These are few limited resources that I can found on the net discussing the setting up between pycharm and nvidia-docker. So, just to verify, are you sure PyCharm doesn't support nvidia-docker, if yes, then I will halt my current effort in dong this setting-up.

Comment actions Permalink


possible answer/workaround: 

simply change docker "default-runtime" to "nvidia" by adding line

"default-runtime": "nvidia"

to your "etc/docker/daemon.json" file

Comment actions Permalink

Hello, i was able to connect to the remote Python interpreter using Pycharm. I know my solution is a bit clunky (can be optimized, for example create a docker-compose which i prefer to not create).

I'm using Arch Linux with the latest drivers (396.54-3) and Pycharm 2018.02. This guide should be working on every linux distro.

1) You have to import or create a project with a new Virtualenv env (it does not work to create a project with the Remote docker interpreter)

2) Follow this steps to connect to the Remote Docker interpreter:

3) in /etc/docker/daemon.json, change this file as follows:

    "default-runtime": "nvidia",
    "runtimes": {
      "nvidia": {
        "path": "/usr/bin/nvidia-container-runtime",
        "runtimeArgs": []

4) systemctl daemon-reload and systemctl restart docker to apply the changes (as written here:

5) [Arch] Because i have bumblebee (my nvidia drivers are OFF by default), YOU MUST spawn a new docker BEFORE you can run yout code on Pycharm, with:

```optirun nvidia-docker run -it -p 8888:8888 tensorflow/tensorflow:1.10.1-devel-gpu-py3 bash``` (version is an example)

6) Run a TF Hello world on pycharm. It should see that a docker container is already up and use that one to execute your code.

Trick: maybe one can put this: "alias docker=nvidia-docker" somewhere so that actually Pycharm spawn the right container. Right now, it is configured to create a container with docker and not with nvidia-docker. That's why it doesn't work if Pycharm runs your code (don't ask me why it works with the container already created <magic>)


Please sign in to leave a comment.