Debugging in PyCharm with using Vagrant VM connection - cannot import name to_string
Answered
I've encountered an issue where I cannot debug in PyCharm connecting through Vagrant to the VM. This has worked fine for projects up until now. The VM image was recently updated so I'm wondering if that has had an effect. I can run programs in "run" mode, just not debug mode. Here's the error I get
Traceback (most recent call last):
File "/home/vagrant/.pycharm_helpers/pydev/pydevd.py", line 25,
in <module> from _pydevd_bundle import pydevd_vars
File "/home/vagrant/.pycharm_helpers/pydev/_pydevd_bundle/pydevd_vars.py", line 21,
in <module> from _pydevd_bundle.pydevd_utils import to_string
ImportError: cannot import name to_string
Here are the different commands used to run the programs - the first one is debug mode, the second is normal mode
ssh://vagrant@127.0.0.1:2222/usr/bin/python -u /home/vagrant/.pycharm_helpers/pydev/pydevd.py --multiproc --qt-support --client '0.0.0.0' --port 32807 --file /home/vagrant/.pycharm_helpers/pycharm/utrunner.py /vagrant/project/project_test.py::ProjectTest true
ssh://vagrant@127.0.0.1:2222/usr/bin/python -u /home/vagrant/.pycharm_helpers/pycharm/utrunner.py /vagrant/project/project_test.py::ProjectTest true
Any ideas what why to_string is found in normal mode but not debug?
Is there a way to reset the pydevd.py file? I've tried uninstalling and reinstalling without success.
Please sign in to leave a comment.
I had the same exact error. I rolled back to Pycharm 2016.3.2 and it works fine again. Something broke in 2016.3.3.
Hi! Could you please try to remove .pycharm_helpers folder on the remote machine and configure your Remote Interpreter again. Does it help?
Removing the .pycharm_helpers folder did resolve the issue (and using version 2016.3.3).
I did have to remove the directory twice - first time I got another import error. But, the second time was successful. Back in business.
Thanks!!!