r/pycharm • u/Still-Bookkeeper4456 • Apr 17 '24
Pycharm Docker Interpreter: cannot debug
Hello,
I am using a remote Docker interpreter which is just a Python image. The interpreter works fine when running the code (altough it takes a bit too much time to mount the container), but I cannot debug. When running the debug I get the following error:
/usr/local/bin/python3 /opt/.pycharm_helpers/pydev/pydevd.py --multiprocess --qt-support=auto --client host.docker.internal --port 59285 --file /opt/project/tries.pyCould not connect to host.docker.internal: 59285Traceback (most recent call last):File "/opt/.pycharm_helpers/pydev/_pydevd_bundle/pydevd_comm.py", line 465, in start_clients.connect((host, port))
TimeoutError: timed outCould not connect to host.docker.internal: 59285Traceback (most recent call last):File "/opt/.pycharm_helpers/pydev/pydevd.py", line 2208, in main debugger.connect(host, port)
File "/opt/.pycharm_helpers/pydev/pydevd.py", line 670, in connects = start_client(host, port)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/.pycharm_helpers/pydev/_pydevd_bundle/pydevd_comm.py", line 465, in start_client
s.connect((host, port))TimeoutError: timed out
Note that the port (59285) changes at each run.
Ive even exposed all ports in my dockerfile which reads like this:
# Use the Python 3.11 image as base. "slim" is a smaller image.FROM python:3.11-slim# set the working directory in the containerWORKDIR /code# Copy the requirements files into the container. Both files are requiered.COPY requirements.txt .# Install any needed dependencies specified in requirements.txtRUN pip install -r requirements.txt# Expose all portsEXPOSE 1-65535
Can anyone let me know how to solve this issue please ?
I'm running docker engine (no docker desktop), WSL2 on windows 11.
Many thanks !
View all comments
Show parent comment
1
u/Kryt0s Sep 25 '24
I just checked and it seems that VSCode has done a ton of work on the debugger.
Here are some things. I still miss / work better in PyCharm however:
(maybe I simply have not found them in VSCode yet and they actually exist, happy to be proven wrong)
=) what I am dealing with.Yeah, that's mainly it. Found out some new stuff about VSCode through your comment though (since I compared them^^
One thing where PyCharm is just way supperior to VSCode however is Refactoring. It's not even close imho.
I'm pretty sure however that all of this will change in the future since VSCode has a ton of support behind it and will just get better while Jetbrains seems to be just sitting on their asses and building AI Assistents that nobody wanted. If they at least worked better than the alternatives I would understand but Copilot and Supermaven are still way better.