Pycharm Debugger fails to run project with docker-compose remote interpreter

Answered

I'm having some issues running and debugging my project in Pycharm Professional 2017.3

I have a set up my remote python interpreter and am able to run the project using the docker-compose run configuration. However when I set up the django server to run the remote debugging it fails to run the app with the following output:

ed78d69c5d73:python -u /opt/.pycharm_helpers/pydev/pydevd.py --multiprocess --qt-support=auto --port 51519 --file /app/manage.py runserver 0.0.0.0:8080
Connected to pydev debugger (build 173.3727.137)
Traceback (most recent call last):
  File "/opt/.pycharm_helpers/pydev/_pydevd_bundle/pydevd_process_net_command.py", line 507, in process_net_command
    if int(notify_always) == 1:
ValueError: invalid literal for int() with base 10: 'None'
Traceback (most recent call last):
  File "/opt/.pycharm_helpers/pydev/_pydevd_bundle/pydevd_process_net_command.py", line 507, in process_net_command
    if int(notify_always) == 1:
ValueError: invalid literal for int() with base 10: 'None'
Traceback (most recent call last):
  File "/opt/.pycharm_helpers/pydev/_pydevd_bundle/pydevd_process_net_command.py", line 507, in process_net_command
    if int(notify_always) == 1:
ValueError: invalid literal for int() with base 10: 'None'
Performing system checks...


Process finished with exit code 0

And it doesn't run the containers / app.


My remote interpreter config is as follows:


and my django server config is:


My exact PyCharm version and environment is:

PyCharm 2017.3 (Professional Edition)
Build #PY-173.3727.137, built on November 28, 2017
JRE: 1.8.0_152-release-1024-b6 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Linux 4.4.0-101-generic


How can I get the remote debugger to work via docker-compose?

0
11 comments

Hi Pitt, there's a similar ticket in our bug tracker: PY-27381, could you please close PyCharm and try to remove all `pycharm_helpers` images & containers? Has it helped? if not - please try workaround from this comment: https://youtrack.jetbrains.com/issue/PY-27381#comment=27-2589206

0
Avatar
Permanently deleted user

Thanks Pavel! Removing the old pycharm helper images and containers didn't change anything, but applying the work around got rid of the error messages.

my pycharm helper image:

my docker containers:

Output from running the django server in debug mode:


As you can see the system checks are not performed and runserver just exits. So the app is still not starting via the runserver command.

My service / app container depends on a database container to run, which is defined in the docker-compose file but I'm not sure it actually gets started up along with the app container.
Also it looks like pycharm is changing the config of my app container.

0
Avatar
Permanently deleted user

The database container is correctly created and is running.

The problem is with the runserver command in the app container.

0
Avatar
Permanently deleted user

So after doing some research I found that some people were successful in doing the remote debugging via docker by starting runserver with the --no-reload flag, so ticking the setting in my run configuration allowed me to start the debugging server and my app:

This is the output I get now:

There is a notice from the debugger:

pydev debugger: To debug that process please enable 'Attach to subprocess automatically while debugging?' option in the debugger settings.

However I have this setting enabled already:

I'm doing some more testing but it looks promising.

1
Avatar
Permanently deleted user

I am also having this issue except that the proposed workaround does not work.  My setup is a little bit different.

PyCharm 2018.1 (Professional Edition trial)
Build #PY-181.44445.76, built on April 9, 2018
Mac OSX High Sierra

I first run the remote debugger and after it is waiting for a connection, I then up my docker container which runs gunicorn (flask).
docker run command: gunicorn --workers 1 --timeout 100000 --user gunicorn --group gunicorn --bind=0.0.0.0:80 --limit-request-line 6144 --pid /var/run/gunicorn.pid astra.application:app

 

 

0
Avatar
Permanently deleted user

I was having the problem that I could not start the remote debugger and the 'no reload' workaround helped me get it working again.

0

PyCharm Professional 2021.2.3 / #PY-212.5457.59

Running on an ubuntu 20.04 LTS with docker engine and docker-compose.

Client: Docker Engine - Community
Version: 20.10.10
API version: 1.41
Go version: go1.16.9
Git commit: b485636
Built: Mon Oct 25 07:42:59 2021
OS/Arch: linux/amd64
Context: default
Experimental: true

Server: Docker Engine - Community
Engine:
Version: 20.10.10
API version: 1.41 (minimum version 1.12)
Go version: go1.16.9
Git commit: e2f740d
Built: Mon Oct 25 07:41:08 2021
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.4.11
GitCommit: 5b46e404f6b9f661a205e28d59c982d3634148f8
runc:
Version: 1.0.2
GitCommit: v1.0.2-0-g52b36a2
docker-init:
Version: 0.19.0
GitCommit: de40ad0

I am also stuck with docker-compose remoter interpreter and a django debugger. See my project as reference: https://github.com/gannebamm/geonode/tree/atlas%403.2.x

the docker-compose-development.yml is used in my run/debug config:

If I run it like that it will stop with exit code 0. If I use --no-reload flag I get the same output as Pitt Pauly described above. Even though I have Attach to subprocess enabled, as he did.

Any news about these issues? I already deleted the cache and rebuild the pycharm helper containers without success.

0

Florian Hoedt Hi, could you please check if the issue is reproduced in a new minimal Django project with a new docker-compose interpreter?

0

Hi Andrey,
Using the minimal project described here: https://github.com/gannebamm/djangodocker/tree/dockerized (which is a fixed version of the one stated in the documentation) it does debug properly. Which is nice but not helping me much for the dev project I bought PyCharm for ;)

The composition and project itself are running fine (with some minor errors on startup). running `docker-compose -f docker-compose-development.yml build` and `docker-compose -f docker-compose-development.yml up` will properly up the services and start the Django dev server.

Therefore something in PyCharm is not working properly. Is there any option to debug the process PyCharm uses?

0

Florian Hoedt

Could you please submit an issue to https://youtrack.jetbrains.com with detailed description, and provide the following:

- Logs from **Help | Collect Logs and Diagnostic Data** after reproducing the issue

- Please add `PYCHARM_DEBUG=True` environment variable to your run/debug configuration, then reproduce the issue and provide the debug console output.

Please ping me when it's created so I could take a look.

0

Hi Andrey Resler
I have created the issue and provided the mentioned information: PY-51450 Unable to run debug configuration with docker-compose remote interpreter

yours, Florian

0

Please sign in to leave a comment.