Pycharm 2022.2 upgrade and Docker issues

Hi,

Until today, I was using Pycharm Pro 2022.1 (snap package) on Ubuntu 22.04 with Docker 20.10.12, which worked like a charm. Since the 2022.2 update, I have encountered 2 issues related to Docker.

1. I can run python code but not debug it. Trying to debug I have the following error:

Could not connect to 172.17.0.1: 46119
Traceback (most recent call last):
  File "/opt/.pycharm_helpers/pydev/_pydevd_bundle/pydevd_comm.py", line 463, in start_client
    s.connect((host, port))
ConnectionRefusedError: [Errno 111] Connection refused
Could not connect to 172.17.0.1: 46119
Traceback (most recent call last):
  File "/opt/.pycharm_helpers/pydev/pydevd.py", line 2168, in main
    debugger.connect(host, port)
  File "/opt/.pycharm_helpers/pydev/pydevd.py", line 660, in connect
    s = start_client(host, port)
  File "/opt/.pycharm_helpers/pydev/_pydevd_bundle/pydevd_comm.py", line 463, in start_client
    s.connect((host, port))
ConnectionRefusedError: [Errno 111] Connection refused

 

2. When I run a code, it seems that it does not take into account the path mapping that I have set on the run/debug configuration -> Docker container settings. Hence, I cannot load my dataset.

File "/tmp/1941329f-ce6c-4a60-a3af-94f1892e4500/src/main.py", line 296, in <module>
[...]
FileNotFoundError: [Errno 2] No such file or directory: '../../datasets/dataset1/train.json'

 

All my configuration is available in the images below. This configuration was working with Pycharm 2022.1.

Thanks in advance for your help.

1
5 comments

Hello,

I have exactly same issue. 

Using docker-compose. I also tried to create a new remote interpreter.

Trying to run:

Traceback (most recent call last):
  File "/opt/.pycharm_helpers/pydev/pydevconsole.py", line 509, in <module>
    pydevconsole.start_client(host, port)
  File "/opt/.pycharm_helpers/pydev/pydevconsole.py", line 421, in start_client
    client, server_transport = make_rpc_client(client_service, host, port)
  File "/opt/.pycharm_helpers/pydev/_pydev_comm/pydev_rpc.py", line 11, in make_rpc_client
    client_transport, server_transport = open_transports_as_client((host, port))
  File "/opt/.pycharm_helpers/pydev/_pydev_comm/pydev_transport.py", line 231, in open_transports_as_client
    client_socket.connect(addr)
ConnectionRefusedError: [Errno 111] Connection refused

 

1

Hello, 

 

This is a known regression, unfortunately. 

Please vote for https://youtrack.jetbrains.com/issue/PY-55338/Connection-to-python-console-refused-with-docker-interpreter-on-Linux in order to be notified about any updates. 

 

For now, the following workaround is available: 

1. go to  Help | Find Action | Registry

2. disable python.use.targets.api 

3. recreate the interpreter from scratch 

 

I apologize for the inconvenience. 

0

I confirm your workaround works for me (solves error number 1). Thank you Antonina Belianskaya!

Error number 2 is solved by carefully following the interpreter configuration https://www.jetbrains.com/help/pycharm/using-docker-as-a-remote-interpreter.html#config-docker. You should configure the docker run settings during the interpreter creation. It seems that without your workaround, the new version of Pycharm does not take into account the 'run/debug configuration -> Docker container settings ->  Run options' field.

2

It also worked for me, Antonina thanks a lot!

Specifically the error I was hitting was while trying to launch the django console that raised a Timeout. Surprisingly the test runners seemed to work fine.

0

I am facing similar issue with the Python Console. I click on Attach Debugger after setting a debug point. And the error in the image is thrown. It was working in some previous versions.

My Run/Debug configuration setting is:

0

Please sign in to leave a comment.