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.
Please sign in to leave a comment.
Hello,
I have exactly same issue.
Using docker-compose. I also tried to create a new remote interpreter.
Trying to run:
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.
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.
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.
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: