PyCharm ssh remote interpreter breaks every single restart

已完成

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.

1
Avatar
Permanently deleted user

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.

1
Avatar
Permanently deleted user

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
Avatar
Permanently deleted user

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

I have been using Pycharm for 18 months and I've suddenly started getting this.  Is there a definitive answer on this.  Its so annoying I've started looking at other IDEs

0
Avatar
Permanently deleted user
xyang_idea_20190430.log 

Hi, I used the IP address, but it didn't show the packages.

PyCharm can upload the files to my server and debug remotely, the only issue is this one.

Every time I create a new ssh interpreter. It is fine and shows the packages before I close the settings menu. But after connecting and uploading to the server, it becomes "Nothing to show".

The file I uploaded is shown above. I'm not sure if I use the correct part. Thank you!

0

@Xyang22

Please try reloading interpreter paths, let me know if it helps or if the issue is still reproduced:

0
Avatar
Permanently deleted user

@Andrey Resler   

I didn't find such a refresh button...

0

It should be there, please refer to the screenshot:

0
Avatar
Permanently deleted user

@Andrey Resler  I found the paths are not complete by default.  And refresh didn't help.

 

And I tried to add some like yours. But it also didn't help.

0
Avatar
Permanently deleted user

And I downloaded some old versions.  I found that  2018.2.1 was fine to find the packages. but  I tried 2018.2.3 which couldn't find the remote packages.

 

0

That's very strange. Please also try deleting `~/.pycharm_helpers` directory from the remote host and recreate the interpreter, that's been known to help in many similar cases.

0
Avatar
Permanently deleted user

I had the same problem, but seems to work ok so far when I just authenticate by password in stead of ssh

0

@Andrey Resler I met the same issue with xyang22, my pycharm version is 2022, is it solved now.

0

If you're still affected by the issue, could you please submit a ticket to https://youtrack.jetbrains.com with logs from **Help | Collect Logs and Diagnostic Data** collected after reproducing the issue?

0

请先登录再写评论。