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?
59 comments
Comment actions Permalink

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
Comment actions Permalink

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

7
Comment actions Permalink

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

7
Comment actions Permalink
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
Comment actions Permalink

Any update on this?

4
Comment actions Permalink

1. Close PyCharm

2. Remove directory PyCharmXXXX.X/remote_sources

3. Remove directory PyCharmXXXX.X/python_stubs

4. Open PyCharm

4
Comment actions Permalink

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....

 

3
Comment actions Permalink

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
Comment actions Permalink

solved for me by :

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

3
Comment actions Permalink

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

3
Comment actions Permalink

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

2
Comment actions Permalink

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
Comment actions Permalink

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
Comment actions Permalink

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
Comment actions Permalink

Thank you so much @Bityon!!!

 

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

2
Comment actions Permalink

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
Comment actions Permalink

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
Comment actions Permalink
Did you ever find a solution to this? I am running into the same problem on PyCharm Professional 3.4.
1
Comment actions Permalink

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

1
Comment actions Permalink

Hello,

Have you tried to use "Reload List of Paths": https://www.jetbrains.com/help/pycharm/project-interpreters.html ?

 

1
Comment actions Permalink

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
Comment actions Permalink

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
Comment actions Permalink

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
Comment actions Permalink

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
Comment actions Permalink

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
Comment actions Permalink

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
Comment actions Permalink

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
Comment actions Permalink

This is causing me major hassles every time I modify shared packages on my vagrant box. I'm finding that even a full restart/clear caches often doesn't work so I end up resorting to deleting remote_sources and python_stubs. This needs serious attention JetBrains!

0
Comment actions Permalink

Hello Yaroslav,

Don't work, unfortunately. Looking the age of comments, its seems a old bug in Intelij linux versions.

0

Please sign in to leave a comment.