Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Failing to get PyCharm to work with remote interpreter on docker

Tags:

When I add a remote interpreter from one of my docker-compose, it doesn't seem to succeed and doesn't show any packages in the dialog. When I add an interpreter to the debugger it says:

python packaging tools not found.

Then if i click on install packaging tools, error displayed:

ERROR: for dockeryard_pycharm_helpers_1
Cannot start service pycharm_helpers: network not found

Starting dockeryard_postgres_1 ...  
Starting dockeryard_nginx_1    ...  
Starting dockeryard_redis_1    ... 
Starting dockeryard_postgres_1 ... 
Starting dockeryard_nginx_1 ...  
Starting dockeryard_pycharm_helpers_1  
Starting dockeryard_redis_1  
Starting dockeryard_worker_1 ... 
Starting dockeryard_worker_1
Starting dockeryard_pycharm_helpers_1
ERROR: for dockeryard_pycharm_helpers_1  Cannot start service     pycharm_helpers: network not found

ERROR: for pycharm_helpers  Cannot start service pycharm_helpers: network not found
[31m  
ERROR [0m: 

Note, this interpreter was already in use and I was able to connect remotely with PyCharm, but I have added and eventually removed a custom network to the container.

As explained in Configuring Remote Python Interpreters - "When a remote Python interpreter is added, at first the PyCharm helpers are copied to the remote host". And my guess something went wrong since network was updated in the docker-compose.

From what I understand from the error message, when PyCharm starts interpreter it tries to use/find that network c7b0cc277c94ba5f58f6e72dcbab1ba24794e72422e839a83ea6102d08c40452.

I don't see that network listed anywhere when I run:

$ docker network inspect dockeryard_default

So PyCharm stores it somewhere and not been updated with the change. I have tried to remove interpreter (using PyCharm dialog) and add it back - same result.

How can I get rid of this network and make PyCharm to be able to debug again?

Thanks.

like image 772
AlonS Avatar asked Apr 13 '18 13:04

AlonS


1 Answers

Was having a near identical error and was able to get past it. I did two things though I'm uncertain as to which was the actual solution:

  1. Made sure the mappings were correct under both (a) Preferences -> Project -> Project Interpreter -> Path mappings and (b) Run -> Edit Configurations -> <Your_Configuration> -> Path mappings
  2. Removed/deleted any containers that looked to be related to PyCharm (believe this is more than likely what solved things).

Hope this helps. PyCharm docker-compose seems to work for some and be a real PITA for others.

One other note. I downgraded from PyCharm 2018 to 2017.3 as there's known docker bugs in 2018.

EDIT: And it would seem a docker-compose down from CLI reintroduces the error -_-

like image 197
wootencl Avatar answered Sep 19 '22 04:09

wootencl