Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[Solved] pycharm-community - can't start the debugger
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Unsupported Software
View previous topic :: View next topic  
Author Message
lyallp
Veteran
Veteran


Joined: 15 Jul 2004
Posts: 1579
Location: Adelaide/Australia

PostPosted: Thu Jul 20, 2023 10:50 pm    Post subject: [Solved] pycharm-community - can't start the debugger Reply with quote

Fully up to date system, using FluxBox.

I try run a simple Python script in debug mode and I receive the error shown below.

The server that pycharm is attempting to connect is not listening on the port pycharm is
attempting to connect to. (netstat -na -t tcp)

In fact, I see no evidence of pycharm even attempting to start the debugger.

The port that pycharm attempts to connect to changes every time.

I can't seem to spot what the cause is.

Am I missing an install? Some install info below...

Code:
PyCharm 2023.1.2 (Community Edition)
Build #PC-231.9011.38, built on May 17, 2023
Runtime version: 17.0.6+10-b829.9 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Linux 6.1.38-gentoo
GC: G1 Young Generation, G1 Old Generation
Memory: 2048M
Cores: 8
Registry:
    debugger.new.tool.window.layout=true
    ide.experimental.ui=true


Current Desktop: Undefined

Code:

Could not connect to 127.0.0.1: 40089
Traceback (most recent call last):
  File "/opt/pycharm-community/plugins/python-ce/helpers/pydev/_pydevd_bundle/pydevd_comm.py", line 463, in start_client
    s.connect((host, port))
TimeoutError: timed out
Could not connect to 127.0.0.1: 40089
Traceback (most recent call last):
  File "/opt/pycharm-community/plugins/python-ce/helpers/pydev/pydevd.py", line 2168, in main
    debugger.connect(host, port)
  File "/opt/pycharm-community/plugins/python-ce/helpers/pydev/pydevd.py", line 660, in connect
    s = start_client(host, port)
        ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/pycharm-community/plugins/python-ce/helpers/pydev/_pydevd_bundle/pydevd_comm.py", line 463, in start_client
    s.connect((host, port))
TimeoutError: timed out

Process finished with exit code 1


Code:
lyall@Lyalls-PC /tmp
$ eix --installed pycharm-community
[I] dev-util/pycharm-community
     Available versions:  2023.1.1^m (~)2023.1.2-r1^m {+bundled-jdk}
     Installed versions:  2023.1.2-r1^m(15:35:46 09/07/23)(bundled-jdk)
     Homepage:            http://www.jetbrains.com/pycharm/
     Description:         Intelligent Python IDE with unique code assistance and analysis

lyall@Lyalls-PC /tmp
$ eix --installed dev-lang/python
[I] dev-lang/python
     Available versions: 
     (2.7)  2.7.18_p16-r1^t
     (3.8)  3.8.17^t
     (3.9)  3.9.17^t
     (3.10) 3.10.12^t
     (3.11) 3.11.4^t
     (3.12) ~3.12.0_beta3^t ~3.12.0_beta4^t
       {berkdb bluetooth build debug +ensurepip examples gdbm libedit lto +ncurses pgo +readline +sqlite +ssl test tk valgrind verify-sig wininst +xml}
     Installed versions:  3.11.4(3.11)^t(20:48:19 08/07/23)(bluetooth ensurepip gdbm ncurses readline sqlite ssl -build -debug -examples -libedit -lto -pgo -test -tk -valgrind -verify-sig)
     Homepage:            https://www.python.org/ https://github.com/python/cpython/
     Description:         An interpreted, interactive, object-oriented programming language

_________________
...Lyall


Last edited by lyallp on Mon Jul 31, 2023 10:46 am; edited 1 time in total
Back to top
View user's profile Send private message
lyallp
Veteran
Veteran


Joined: 15 Jul 2004
Posts: 1579
Location: Adelaide/Australia

PostPosted: Fri Jul 28, 2023 9:46 am    Post subject: Reply with quote

Well, according to the debugger output in pycharm
Code:
/opt/pycharm-community/plugins/python-ce/helpers/pydev/pydevd.py
is run as follows

Code:
/home/lyall/Source/Python/PycharmProjects/IdentifyBookmarks/venv/bin/python /opt/pycharm-community/plugins/python-ce/helpers/pydev/pydevd.py --multiprocess --qt-support=auto --client 127.0.0.1 --port 44271 --file /home/lyall/Source/Python/PycharmProjects/IdentifyBookmarks/IdentifyBookmarks.py --env=Test --confi=BookmarksInfo.conf --log=debug --doc=PF_001.doc


Yet, when I run
Code:
python /opt/pycharm-community/plugins/python-ce/helpers/pydev/pydevd.py --help

I see
Code:
Usage:
   pydevd.py --port N [(--client hostname) | --server] --file executable [file_options]

Implying that pycharm is running this script with invalid command line options.

Problem is, I don't see any pycharm GUI settings for those parameters.

In fact, I think pycharm is running entirely the wrong thing or expecting the python debugger to be running as a service somewhere...
_________________
...Lyall
Back to top
View user's profile Send private message
lyallp
Veteran
Veteran


Joined: 15 Jul 2004
Posts: 1579
Location: Adelaide/Australia

PostPosted: Sat Jul 29, 2023 11:41 am    Post subject: Reply with quote

I noticed that the instalaltion of pycharm-community is missing __pycache__ directories, and they cannot be created by non-root users.

The ebuild does not pre-generate them.

I rectified this by adding
Code:
python -m compileall /opt/pycharm-community
into the ebuild (obviously parameterising the path, but you know what I mean)

Just an FYI, during my floundering around whilst I try get the debugger to work (having created a 2023.2 ebuild based on the 2023.1 ebuild)
_________________
...Lyall
Back to top
View user's profile Send private message
lyallp
Veteran
Veteran


Joined: 15 Jul 2004
Posts: 1579
Location: Adelaide/Australia

PostPosted: Mon Jul 31, 2023 10:46 am    Post subject: Reply with quote

Doh!

It was my firewall blocking access to local ports!

Once I enabled local source to local destination, things worked.

I could not tie down to a specific port because pycharm seems to use a random port each time when starting up the debugger. (I guess so pycharm works on a multi-user server)
_________________
...Lyall
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Unsupported Software All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum