Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WSL 2 : Pycharm debugger connection time out


I set up Pycharm to use a virtualenv inside wls 2,
It works fine, I mean, I can run my project throught the button "run",
The problem is I can't use the debugger, it's says connection time out, let me show you the full [erros][1].
('Connecting to ', '172.21.176.1', ':', '63597')
Could not connect to 172.21.176.1: 63597

It seems that when I run with debug mode, It wants to connect to 172.21.176.1 (wsl 2 ip adress),
but it should connect to 127.0.0.1 because the process is launched by ubuntu2004.exe.
Can you help me?
Error:

C:\Users\tux\AppData\Local\Microsoft\WindowsApps\ubuntu2004.exe run "export IDE_PROJECT_ROOTS=/mnt/c/Users/tux/Documents/projects/odoo/13 && export PYCHARM_DEBUG=True && export PYTHONUNBUFFERED=1 && export IPYTHONENABLE=True && export PYCHARM_HOSTED=1 && export PYTHONIOENCODING=UTF-8 && export PYCHARM_DISPLAY_PORT=63342 && export PYTHONDONTWRITEBYTECODE=1 && export PYDEVD_LOAD_VALUES_ASYNC=True && export "LIBRARY_ROOTS=/mnt/c/Users/tux/AppData/Local/JetBrains/PyCharm2020.1/remote_sources/525578736/201545293:/mnt/c/Users/tux/AppData/Local/JetBrains/PyCharm2020.1/remote_sources/525578736/1688665391:/mnt/c/Users/tux/AppData/Local/JetBrains/PyCharm2020.1/python_stubs/525578736:/mnt/d/Program Files/JetBrains/PyCharm 2020.1.2/plugins/python/helpers/python-skeletons:/mnt/d/Program Files/JetBrains/PyCharm 2020.1.2/plugins/python/helpers/typeshed/stdlib/3.7:/mnt/d/Program Files/JetBrains/PyCharm 2020.1.2/plugins/python/helpers/typeshed/stdlib/3:/mnt/d/Program Files/JetBrains/PyCharm 2020.1.2/plugins/python/helpers/typeshed/stdlib/2and3:/mnt/d/Program Files/JetBrains/PyCharm 2020.1.2/plugins/python/helpers/typeshed/third_party/3:/mnt/d/Program Files/JetBrains/PyCharm 2020.1.2/plugins/python/helpers/typeshed/third_party/2and3" && export "PYTHONPATH=/mnt/c/Users/tux/Documents/projects/odoo/13:/mnt/d/Program Files/JetBrains/PyCharm 2020.1.2/plugins/python/helpers/pycharm_matplotlib_backend:/mnt/d/Program Files/JetBrains/PyCharm 2020.1.2/plugins/python/helpers/pycharm_display:/mnt/d/Program Files/JetBrains/PyCharm 2020.1.2/plugins/python/helpers/third_party/thriftpy:/mnt/d/Program Files/JetBrains/PyCharm 2020.1.2/plugins/python/helpers/pydev:/mnt/c/Users/tux/AppData/Local/JetBrains/PyCharm2020.1/cythonExtensions:/mnt/c/Users/tux/Documents/projects/odoo/13" && cd /mnt/c/Users/tux/Documents/projects/odoo/13 && /opt/interpreters/python3.8_odoo_13/bin/python3 "/mnt/d/Program Files/JetBrains/PyCharm 2020.1.2/plugins/python/helpers/pydev/pydevd.py" --multiproc --qt-support=auto --client 172.21.176.1 --port 63597 --file /mnt/c/Users/tux/Documents/projects/odoo/13/odoo-bin -c conf/learning.conf" Executing PyCharm's sitecustomize Traceback (most recent call last): File "/mnt/d/Program Files/JetBrains/PyCharm 2020.1.2/plugins/python/helpers/pycharm_matplotlib_backend/sitecustomize.py", line 43, in import matplotlib ModuleNotFoundError: No module named 'matplotlib' Unable to load jupyter_debug plugin Executing file /mnt/c/Users/tux/Documents/projects/odoo/13/odoo-bin arguments: ['/mnt/c/Users/tux/Documents/projects/odoo/13/odoo-bin', '-c', 'conf/learning.conf'] PYDEVD_FILTER_LIBRARIES False

Started in multiproc mode

('Connecting to ', '172.21.176.1', ':', '63597') Could not connect to 172.21.176.1: 63597 Traceback (most recent call last): File "/mnt/d/Program Files/JetBrains/PyCharm 2020.1.2/plugins/python/helpers/pydev/_pydevd_bundle/pydevd_comm.py", line 456, in start_client s.connect((host, port)) socket.timeout: timed out Traceback (most recent call last): File "/mnt/d/Program Files/JetBrains/PyCharm 2020.1.2/plugins/python/helpers/pydev/pydevd.py", line 2131, in main() File "/mnt/d/Program Files/JetBrains/PyCharm 2020.1.2/plugins/python/helpers/pydev/pydevd.py", line 2013, in main dispatcher.connect(host, port) File "/mnt/d/Program Files/JetBrains/PyCharm 2020.1.2/plugins/python/helpers/pydev/pydevd.py", line 1788, in connect self.client = start_client(self.host, self.port) File "/mnt/d/Program Files/JetBrains/PyCharm 2020.1.2/plugins/python/helpers/pydev/_pydevd_bundle/pydevd_comm.py", line 456, in start_client s.connect((host, port)) socket.timeout: timed out

Process finished with exit code 1

like image 741
m0r7y Avatar asked Jul 04 '20 15:07

m0r7y


People also ask

Does PyCharm support WSL2?

Using PyCharm with built-in remote capabilities allows for the same workflow (PyCharm IDE, Linux backend) across platforms including Windows / WSL2, MacOS / Docker, or any desktop and a remote Linux virtual machine in the cloud.

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 turn off Debug mode in PyCharm?

Terminate a debugger session Click the Stop button in the Debug tool window. Alternatively, press Ctrl+F2 and select the process to terminate (if there are two or more of them).

What debugger does PyCharm use?

JavaScript pro only. Any modern web project involves JavaScript, therefore any modern Python IDE needs to be able to debug JavaScript as well. PyCharm Professional edition comes with the highly capable JavaScript debugger from WebStorm. Both in-browser JS and NodeJS are supported by the JavaScript debugger.


1 Answers

Firewall was the case. Unbloking connections from Pycharm (Eset firewall in my case) helped. See https://youtrack.jetbrains.com/issue/PY-39051

like image 110
PATAPOsha Avatar answered Nov 10 '22 18:11

PATAPOsha