Reputation: 720
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
Upvotes: 9
Views: 8558
Reputation: 497
Firewall was the case. Unbloking connections from Pycharm (Eset firewall in my case) helped. See https://youtrack.jetbrains.com/issue/PY-39051
Upvotes: 13
Reputation: 7744
It's hard to tell where this could be going wrong but you can try to reconfigure your interpreter to use host
and port
of your choice; the GUI instance is shown in the image.
You can also see this raised issue here - Python debugger not working while normal run does
Upvotes: 0