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?
61 comments
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

4
Comment actions Permalink

Hi,

Simply doing "invalidate/restart PyCharm cache" should help in that case. Does it work? Or you have to completely re-add the interpreter?

0
Comment actions Permalink

Unfortunately simple "invalidate/restart PyCharm cache" didn't help me (I've tried several times) Even adding new interpreter didn't help me, it is still showing old "cached" files. That's why I completely removed everything and created from scratch. JetBrains, please give some attention to that issue

0
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

finnally ,,,, i scp them from server into remote_sources/xxx/xxx dir....

0
Comment actions Permalink

I am using PyCharm on Windows 10 and SSH to train my net on a remote server. I installed the necessary packages on the remote server in a conda environment. Actually, I can run the script using "python script.py" in the SSH terminal. But I cannot run / debug functions by PyCharm. The version does not seem to be correct.
The solutions mentioned above did not work for me, unfortunately.

Are there any other suggestions?

0
Comment actions Permalink

Hi Olli,

As this thread becomes bigger and bigger (and your case seems to be different), I suggest moving to a support request. Please report it to pycharm-support@jetbrains.com and attach your idea.log from Help | Show Log in...

 

0
Comment actions Permalink

@Andrey Resler

This works for me. But maybe we need an icon in Tools->Deployment to refresh the interpreter path since much of us encounter this problem?

0
Comment actions Permalink

@11610127

This might be a good feature, but I believe a better solution would be to properly fix https://youtrack.jetbrains.com/issue/PY-21455

But your suggestion has already been submitted, please see: https://youtrack.jetbrains.com/issue/PY-21659

Feel free to vote and discuss the issue in the ticket.

0
Comment actions Permalink

Only invalidating cache/restarting works for me

0
Comment actions Permalink

Same issue with WSL remote interpreter. Took me forever to find out that this was an issue. Any updates? The earliest I've seen this issue being addressed was in 2014!!! Any way to update the files in the remote yet?

0
Comment actions Permalink

You can update remote sources by reloading interpreter paths: https://www.jetbrains.com/help/pycharm/python-interpreters.html#paths

0
Comment actions Permalink

Hi @Andrey, how can I reload the interpreter paths in IntelliJ with the python plugin? I'm using python via wsl, and each time I update I library (via the cli) I have to close and reopen the project before intellij notices the change!

0
Comment actions Permalink

Hi Rob, 

Sorry but unfortunately there is no this option in Python plugin, only in PyCharm. IDEA handles python interpreters a bit differently, you can see the interpreter paths in the "Classpath" tab but there is no button to reload them (unlike PyCharm). 

You can install packages from IDE package manager instead of CLI, this way the skeletons will be updated immediately after installing the new package.

0
Comment actions Permalink

Ubuntu 20.04, PyCharm 2020.1.2, Docker-compose interpreter


1. remove remote interpreter
2. close PyCharm
3. clean /.cache/JetBrains/PyCharm2020.1
4. remove docker containers and images using by PyCharm
5. open PyCharm and create docker-compose interpreter (get long time creation)

Requarments has updeted successful :)

0
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

PyCharm 2020.2.3 (Professional) on Windows 10 with WSL2.

OK, so the refresh of the interpreter or interpreter paths works, but now it takes forever to "Discover binary skeletons". This seems to take much, much longer since I moved to WSL 2 (from WSL 1).

0
Comment actions Permalink

@Cornel

Please report it to https://youtrack.jetbrains.com/issues/PY and attach the idea.log file from Help | Show Log in...

0
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

Same issue, every time I update a package on the remote server, it's not updated in the local PyCharm pro.

For me on Ubuntu 18.04 with Pycharm pro 2020.3 the only thing that worked is removing the directories of older versions from the .cache, for some reason it it was using the cache under older versions 

0
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

none of this works for PyCharm 2021.1.3 (Professional Edition):

- refresh paths

- rescan stuff

- invalidate caches

i had to do this: `cd ~/.cache/JetBrains &&  rm -r *` in order for pycharm  to rebuild the cache with the updated env.

this has to be fixed in next version. this thread is 2 pages since 2013 and still no working solution.

thanks

0
Comment actions Permalink

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.

0
Comment actions Permalink

I can refresh things by doing the following (that is combining two approaches described before; doing only one of the two steps doesn't work).

1st step:
Prefernces->Python Interpreter->Gear icon->Show all...->"Show paths for the selected interpreter" icon->refresh icon->OK button

2nd step (while still in the "Python interpreterS" windows, that you haven't closed yet:

Edit icon->OK button->OK button->OK button

Doing this triggers an instant refresh of the external libraries and the currently open file gets immediately updated.

Definitely there is the need for a single button/shortcut for having the same behavior.

0
Comment actions Permalink

8 years and the issue still persists. I could right now show you the debugger being at an empty line in a file the probably is in pycharm's cache from 2019 and not the file I just uploaded seconds ago. 8 years. Are you kidding me? 

0
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

Tried basically all 'solutions' presented above and none of them works using docker-compose. Please fix this as soon as possible!

0
Comment actions Permalink

Had to rerun the docker compose with --build flag.

0

Please sign in to leave a comment.