Python interpreter launch Hanging in "Connection to Console"

Any suggestions how to debug?

Just opened a new project, trying to launch Python interpreter window, and see this:

/Users/yaroslavvb/anaconda3/envs/main/bin/python /Applications/PyCharm.app/Contents/helpers/pydev/pydevconsole.py --mode=client --port=59611
Traceback (most recent call last):
File "/Applications/PyCharm.app/Contents/helpers/pydev/pydevconsole.py", line 399, in <module>
pydevconsole.start_client(host, port)
File "/Applications/PyCharm.app/Contents/helpers/pydev/pydevconsole.py", line 311, in start_client
client, server_transport = make_rpc_client(client_service, host, port)
File "/Applications/PyCharm.app/Contents/helpers/pydev/_pydev_comm/rpc.py", line 11, in make_rpc_client
client_transport, server_transport = open_transports_as_client((host, port))
File "/Applications/PyCharm.app/Contents/helpers/pydev/_pydev_comm/transport.py", line 231, in open_transports_as_client
client_socket.connect(addr)
TimeoutError: [Errno 60] Operation timed out

 

 

11 comments
Comment actions Permalink

PyCharm 2019.1.2 (Professional Edition)
Build #PY-191.7141.48, built on May 7, 2019
Licensed to Yaroslav Bulatov
Subscription is active until September 20, 2019
JRE: 11.0.2+9-b159.56 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
macOS 10.13.6

0
Comment actions Permalink

The error suggest an issue connecting to port 59611. Please ensure that port is not taken by some other process.

You can check with TcpView if these ports are already taken: https://docs.microsoft.com/en-us/sysinternals/downloads/tcpview . It will show the process using the ports.

But in case of the firewall it can just block the bind operation and TcpView will not show anything. Try also disabling firewall and any security software you might have.

0
Comment actions Permalink

Hm, checked the port, and it's being used by PyCharm. Tried restarting pycharm, same problem. I've updated PyCharm this week so I'm wondering if the problem is related to update. I have the latest version currently.

0
Comment actions Permalink

It shows that PyCharm is listening on 50726, but when `pydevconsole.py` script is trying to connect to that port, connection is refused. Something is obstructing the connection. Do you have a firewall or any other security software, have you tried disabling them? Can you try on another machine?

Also, please ensure that `localhost` is resolved to the loopback interface IP address (127.0.0.1 or ::1) on your machine.

0
Comment actions Permalink

It seems the issue is that I have several PyCharm windows, multiple projects, and only one of them succeeds in connecting to Python console

0
Comment actions Permalink

So if you leave only one project, it connects?

I can't reproduce, because, as intended, each connection use a different port. Next time you see "connection refused", try connecting to that port with telnet.

0
Comment actions Permalink

I haven't tried with one project, I have 4 projects open, and 1 was able to connect while remaining 3 can't.

Maybe it's MacOS-specific interaction. I'm on High Sierra 10.13.6 (17G7024)

 

I tried connecting with Telnet, and it shows equivalent behavior for both working and non-working ports, except when PyCharm is in the process of trying to connect. In that case it shows "handshake" 

 

https://www.dropbox.com/s/4m2qu058vj47qr4/Screenshot%202019-06-06%2011.58.39.png?dl=0

0
Comment actions Permalink

Was there any resolution for this? I am encountering the same error in a newly installed pycharm. I am also on High Sierra 10.13.6. 

PyCharm 2019.1.2 (Community Edition)
Build #PC-191.7141.48, built on May 7, 2019
JRE: 11.0.2+9-b159.56 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
macOS 10.13.6

0
Comment actions Permalink

Hmm, no, I'm afraid we couldn't reproduce the issue so far to identify the root cause.

I suggest submitting a bug report to https://youtrack.jetbrains.com/issues/PY and provide steps to reproduce the issue, so that we could proceed.

0
Comment actions Permalink

Are there any solutions? I have the same problem, please help.

0
Comment actions Permalink

Hi, to anyone who met this problem, I solved it by changing line 399 

pydevconsole.start_client(host, port)

in `/Applications/PyCharm.app/Contents/helpers/pydev/pydevconsole.py` 

to

pydevconsole.start_client("127.0.0.1", port)
0

Please sign in to leave a comment.