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:
Just updated to the latest PyCharm 2024.3 after using the python.use.targets.api registry setting for a while. This registry key is no longer present so have to roll back to 2024.2.4 to be able to use remote SSH.
PyCharm 2024.3 (Professional Edition)
Build #PY-243.21565.199, built on November 13, 2024
Subscription is active until November 19, 2024.
Runtime version: 21.0.5+8-b631.16 amd64 (JCEF 122.1.9)
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Toolkit: sun.awt.X11.XToolkit
Linux 6.8.0-47-generic
GC: G1 Young Generation, G1 Concurrent GC, G1 Old Generation
Memory: 4002M
Cores: 16
Registry:
ide.experimental.ui=true
i18n.locale=
ide.images.show.chessboard=true
Non-Bundled Plugins:
com.intellij.plugins.resharperkeymap (243.21565.122)
com.intellij.plugins.visualstudiokeymap (243.21565.122)
dev.meanmail.plugin.nginx-intellij-plugin (2024.3)
some.awesome (1.15)
com.intellij.apacheConfig (243.21565.180)
idea.plugin.protoeditor (243.21565.122)
com.intellij.plugins.vscodekeymap (243.21565.122)
name.kropp.intellij.makefile (243.21565.122)
GrepConsole (13.2.0-IJ2023.3)
ru.adelf.idea.dotenv (2024.3)
com.leinardi.pycharm.pylint (0.16.4)
net.seesharpsoft.intellij.plugins.csv (4.0.0)
commit-prefix-plugin (1.4.1)
mobi.hsz.idea.gitignore (4.5.4)
Current Desktop: ubuntu:GNOME
Try re-creating a remote interpreter after the update.
If the problem remains unresolved, please create a bug report in the PyCharm branch of YouTrack, attach IDE logs (Help | Collect Logs and Diagnostic Data), Dockerfile and docker-compose.yml.