Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PyCharm remote debugging (pydevd) does not connect

PyCharm remote debugging (pydevd) does not connect with the following message:

error: [Errno 10061] No connection could be made because the target machine actively refused it

How can I troubleshoot it?

The output console in PyCharm shows:

Starting debug server at port 21000
Use the following code to connect to the debugger:
import pydevd
pydevd.settrace('*.*.*.*', port=21000, suspend=False)
Waiting for process connection...
Server stopped.

I checked the firewall and PyCharm is allowed for both incoming and outgoing connections.

like image 385
denfromufa Avatar asked Sep 02 '15 20:09

denfromufa


People also ask

How do I connect to a remote server with PyCharm?

Connect to a remote server and open the remote project Ensure you have the Remote Development Gateway plugin enabled. On the PyCharm welcome screen, select Remote Development. In the Run the IDE Remotely section, click SSH Connection.

How do I connect to remote debugger?

On the remote computer, find and start the Remote Debugger from the Start menu. If you don't have administrative permissions on the remote computer, right-click the Remote Debugger app and select Run as administrator. Otherwise, just start it normally.

How do I enable debugging actions in PyCharm?

Just right-click any line in the editor and select the Debug <filename> command from the context menu. After the program has been suspended, use the debugger to get the information about the state of the program and how it changes during running.

How do I debug in PyCharm remotely?

Remote Debugging with PyCharm. With PyCharm you can debug your application using an interpreter that is located on the other computer, for example, on a web server or dedicated test machine. PyCharm provides two ways to debug remotely: Through a remote interpreter.

How to debug PyDev code on remote machine?

It should show the connection to the pydev debugger. Your code is actually executed on the remote host, but debugged on the local machine. In order to debug with a remote interpreter, you have to start your program through PyCharm, which is not always possible.

What is the difference between PyCharm debug server and remote interpreter?

In order to debug with a remote interpreter, you have to start your program through PyCharm, which is not always possible. On the other hand, when using the Debug Server, you can connect to a running process. Compare the two approaches.

How do I use pydevd-PyCharm on another machine?

Install the pydevd-pycharm package on the remote machine by running the following command: Copied! On the remote machine, create a directory where the file quadratic_equation.py should be uploaded. You can do it in the Terminal window: Copied! On the local machine, create a connection profile.


2 Answers

10061 is WSAECONNREFUSED, 'connection refused', which means there was nothing listening at the IP:port you tried to connect to.

Though I see that you have validated its not a firewall issue, but still I would suggest to check the port numbers again with respect to the ones opened in windows firewall. Or to narrow down just run a simplehttpserver or icmp server at the same port and confirm.

like image 92
Surjit R Avatar answered Oct 01 '22 07:10

Surjit R


In a direct link communication, it often means that you have already something connected to this port. To check what process is hearing what port, check this SO question.
You can then either kill the program or change the port, depending of what you can do.
Without more information of the "remote tested", it is hard to know what is happening.

like image 38
Ludovic Guerra Avatar answered Oct 01 '22 09:10

Ludovic Guerra