Home > database >  running pycharm interpreter using nvidia-docker2
running pycharm interpreter using nvidia-docker2

Time:08-12

Im working on Ubuntu 20. I've installed docker, nvidia-docker2. On Pycharm, I've followed enter image description here

in the run options I put additionally --runtime=nvidia and --gpus=all.

Step 4 finishes as same as in the guide (almost, but it seems that it doesn't bother anything so on that later) and on step 5 I put manually the path to the interpreter in the virtual environment I've created using the Dockerfile.

In that way I am able to run the command of nvidia-smi and see correctly the GPU, but I don't see any packages I've installed during the Dockerfile build.

There is another option to connect the interpreter a little bit differently in which I do see the packages, but I can't run the nvidia-smi command and the torch.cuda.is_availble return False.

The way is instead of doing this as in the guide: enter image description here

I press on the little down arrow in left of the Add Interpreter button and then click on Show all: enter image description here

After which I can press the button : enter image description here works, so it might be PyCharm "Python Console" issue.

and then I can choose Docker: enter image description here

which will result in the difference mentioned above in functionality and also in the path dispalyed (the first one is the first remote interpreter top to bottom direction and the second is the second correspondingly):

enter image description here

Here of course the effect of the first and the second correspondingly: enter image description here

enter image description here

Here is the results of the interpreter run with the first method connected interpreter: enter image description here

enter image description here

and here is the second:

enter image description here

Of the following code:

enter image description here

Here is the Dockerfile file if you want to take a look:

enter image description here

Anyone configured it correctly and can help ? Thank you in advance.

P.S: if I run the docker from services and enter the terminal the command nvidia-smi works fine and also the import of torch and the command torch.cuda.is_available return True.

P.S.2: The thing that has worked for me for now is to change the Dockerfile to install directly torch with pip without create conda environement.

Then I set the path to the python2.7 and I can run the code, but not debug it.

for run the result is as expected (the packages list as was shown before is still empty, but it works, I guess somehow my IDE cannot access the packages list of the remote interpreter in that case, I dont know why): enter image description here

But the debugger outputs the following error: enter image description here

Any suggestions for the debugger issue also will be welcome, although it is a different issue.

CodePudding user response:

Please update to 2022.2.1 as it looks like a known regression that has been fixed.

Let me know if it still does not work well.

  • Related