Any way to force a refresh of external libraries on a remote interpreter?

Answered
Certainly I'm not the only one who's encountered this.

I have a remote interpreter (ssh), which is also the project interpreter, filled in from deployment settings. I upgraded one of the libraries on the server, but the stubs PyCharm shows in the external libraries section is still the old version. I tried deleting the remote interpreter and recreating it, but unfortunately it seems to have just reused a cached version of the stubs.

What I need is for PyCharm to realize that the file is updated. I can look at a file in PyCharm, and see that it's simply not been updated.

Is there a way to purge PyCharm's cache of libraries on a remote interpreter?
51
63 comments
Avatar
Permanently deleted user

Same problem for docker-compose based interpreters.

Here is my workaround:

Settings > Project Interpreter: click gear icon > More

click edit icon

OK, OK, OK

:)

 

@jetbrains: The Project Interpreter view desperately needs a refresh button.

25
Avatar
Permanently deleted user

Yes, please add the ability to manually refresh the indexes of External Libraries. 

7
Avatar
Permanently deleted user

This would be such a productivity boost! Please add a feature to refresh the libraries.

7
Avatar
Permanently deleted user
Does the following not work? It doesn't for me, but I suspect that's some problem related to me having pycharm running on linux, having the remote interpreter being the windows version of python on a machine with openSSH on cygwin setup. If you're using the more common pycharm on windows, remote interpreter on linux (or windows?), the following will probably work:

1) open file->settings->remote interpreter
2) click the cog next to the remote interpreter name and select more
3) in the window that pops up, click the bottom button on the right (looks like a 3 item list sitting on top of a folder)
4) in the window that pops up there, click the refresh button on the right

The process that starts now will presumably fail if your setup is similar to mine, but should succeed otherwise.
4
Avatar
Permanently deleted user

Similar issue. Updated some project dependencies in a remote virtualenv, but still seeing the old code in the PyCharm IDE under "External Libraries"

Clicking the refresh button for that library in the window dal mentioned above doesn't do anything. (Doesn't even cause the IDE to cycle or show a message.)

Hmm....

 

4
Avatar
Permanently deleted user

Any update on this?

4
Avatar
Permanently deleted user

1. Close PyCharm

2. Remove directory PyCharmXXXX.X/remote_sources

3. Remove directory PyCharmXXXX.X/python_stubs

4. Open PyCharm

4
Avatar
Permanently deleted user

Hey JetBrains, 6 years and the problem still persists. We're paying for the Remote run/debug support, can you fix it or at least provide a CLEAR solution for it?

Here's what helps me with MacOS Pycharm 2018.3.5 (issue was with docker-compose interpreter):

- restart Docker

- invalidate/restart PyCharm cache

- remove all interpreters from the Project preferences, leave the empty list (looks like when I've just added a new one, it was still using cached files from old)

- create new interpreter

4
Avatar
Permanently deleted user

Found the solution. 

Go to External Libraries in the project tree and expand it.

Right click on "Remote Libraries", you will see an option to "Synchornize '<number>'", 

this will refresh all the external libraries. 

 

3
Avatar
Permanently deleted user

solved for me by :

File ---- Invalidate Caches/ Restart  ----- Invalidate and Restart

3
Avatar
Permanently deleted user

I'm having the exact same issue. Is there a way to resolve this?

2
Avatar
Permanently deleted user

FWIW, I was able to fix it by just deleting the interpreter and recreating it. I did not have to restart or invalidate caches.

2
Avatar
Permanently deleted user

If you don't want to restart, you can also just hit edit, then hit "OK" and it seems to refresh at that point. 

But would love a better method for this.

2
Avatar
Permanently deleted user

I have the same issue.

This trick (as mentioned above) worked for me:

Remove directory PyCharmXXXX.X/remote_sources

But it corrupted my Project Interpreter.

It's pretty frustrating to find bugs in PyCharm only to find tickets for them that have been opened for 5+ years.  This happens quite often.

2
Avatar
Permanently deleted user

Thank you so much @Bityon!!!

 

I've had email alerts setup on this thread for *years*. Finally, a solution! :-D

2

5 years later and I am experiencing the same problem. I am using WSL to hold my "remote libraries". Synchronising like @Bityon is not working for me - the other methods are a bit cumbersome.

2

Hey @Stanfateev,

I believe this issue is covered by the following ticket - https://youtrack.jetbrains.com/issue/PY-21455

Instead of re-adding the interpreter, please try reloading interpreter paths, see screenshot for reference:

 

This should help.

2

On intellij there seems to be an option for "Rescan available python packages and modules"

This fetches sources of modules and even fixes the issue with quick documentation

2
Avatar
Permanently deleted user
Did you ever find a solution to this? I am running into the same problem on PyCharm Professional 3.4.
1
Avatar
Permanently deleted user

ok deleting the remote interpreter, restarting pycharm, and creating it again solved it.

1
Avatar
Permanently deleted user

I am developing a module and using that module for another project in parallel. It is cumbersome to purge the cache of the module each time I update it. Hope this process can be automatic or at least single-click.

1

In the status bar (on mine it's in the lower right of the window) you should see Remote Python 3.8.3 (or whatever version you've got) click on it and a list of interpreters will pop up; Select the same interpreter and it will refresh the libraries and skeletons.

 

1
Avatar
Permanently deleted user

Ok, this has been an issue since 2013, it has pained me constantly while working on a very active project. I have had success and failures with just about every solution mentioned in this thread on different versions of the "Professional" PyCharm, I think this needs to be prioritized and fixed for good. Please Please Please put effort into having a canonical reset for docker compose interpreter (including Kubernetes context) and external library refresh. 

1

Since my last comment on reloading interpreter paths, there's a new action now [Plugins | Python | Rescan Available Python Modules and Packages] in keymap settings, also available from "Find Action". Now you can reload packages with one shortcut.

1

After struggling with all the solutions online, I finally found a workaround that works for me.

Rescanning wasn't working for me.

It seems that rescanning actually worked, but actually PyCharm mixed the caches from various versions and used an older version's cache. 
Deleting the older versions of the cach in  ~/.cache/JetBrains did the trick.

1
Avatar
Permanently deleted user

The only way I was able to "resolve" the issue was to:

 

  1. Manually delete my remote Project Interpreter from Python.
  2. Manually add the Project Interpreter using pip to install any packages on my remote machine.
  3. Invalidate caches and restart.

 

0
Avatar
Permanently deleted user

Hey Adrian, could you be a little more specific what you've done?

I suffer the same issue and couldn't solve it so far...

0
Avatar
Permanently deleted user

I'm having this same issue. I've been forcing a refresh via Chris' method, but it seems a bit clunky. Is there a better way?

0

Please sign in to leave a comment.