PyCharm ssh remote interpreter breaks every single restart

Completed

I use PyCharm version 2018.3.2 build #PY-183.4886.43 (just upgraded to 2018.3.3 #PY-183.5153.39, same issue)

I have a local git repository loaded as a PyCharm project. This repository is deployed to a remote machine. The remote (ssh) interpreter used by the PyCharm project uses this code. This setup worked fine for a long time, but recently I've been having problems every single day.

When I try running e.g. unittests from PyCharm (rightclick -> Run Unittests in file), I get the following errors:

Can't run remote python interpreter: Error connecting to remote host xxx

Couldn't upload helpers for remote interpreter: Auth cancel

However, when I change code, changes do get automatically pushed toward this same remote host with no problem. I can also browse to the virtual environment on the remote host (through PyCharm). Usually (almost all of the behavior I describe seems completely random and arbitrary) I can even open the python console and it will run the remote interpreter. Yet when I try running a file it refuses to work.

When I go to settings -> project interpreter, the selected interpreter and mappings are correct. However, under the package list it states "Nothing to show."

I have been unable to find out the steps to fixing this problem. I usually get it to work eventually through a process of repeatedly restarting, invalidating cache, creating a new ssh interpreter configuration that is -exactly- the same as the previous one (this fixes the "Nothing to show." but it still doesn't run files), etc. If I try this for long enough it tends to end up working but I can't find a pattern to it. It seems completely arbitrary and I fail to see why it can so clearly connect to the interpreter and the remote machine in some ways, but can't in others.

PyCharm is such a great tool to work with but sometimes it's infuriating due to its completely unexplainable and intransparent behavior.

Thanks for any help! Let me know if more information is needed.

4 comments

With the help of PyCharm support I seem to have fixed it. If anyone else runs into this issue in the future: I fixed it by deleting the .pycharm_helpers directory in my remote home directory.

0

Thank you for your post. 

I have the same issue. I can run the code remotely. but in the setting,  it only shows "nothing to show" then it can't find any modules on the server from my local Pycharm.

I tried to delete  /home/myaccountname/.pycharm_helpers  directory and reboot or not reboot the Pycharm on my computer. But it still has "nothing to show"...

0

Yeah, the above thing seemed to fix it for me but the next day I had the same issue again. The behavior seems very random so I'm not sure if I really did fix it this time around, but I used to use an alias for the remote host. Now I'm using the ip address instead, and it's been working since. I have no idea how or whether it will stay fixed, but it's something PyCharm support suggested and so far so good... If you're using a name instead of an ip address as well it's worth a try.

0

I can confirm we had similar issues that was fixed by using IP address instead of the hostname, so please try it.

0

Please sign in to leave a comment.