Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

pycharm not using virtualenv from vagrant box when 'go to declaration' instead uses some outdated stuff from its remote_sources

I setuup Project Interpreter pointing virtualenv on vagrant virtual machine (Settings / Project Interpreter / Add Remote), but when I click ctrl+B or use 'go to definition' I always end up in location like this: /home/<my_user_name>/.PyCharm50/system/remote_sources/1174787026/154306353/django/...

how to avoid such pycharm behaviour? How to force it to use virtualenvs code when go to declaration?

Using Pycharm 5.0 on Ubuntu 14.04

UPDATE: with pycharm 2017.2.* it works now good!

like image 769
andilabs Avatar asked Jun 17 '16 09:06

andilabs


1 Answers

I also had this issue setting up a remote interpreter with Vagrant.

It appears that for a remote interpreter you need to mark Python source root folders as "Source Folders" under Project Structure in Preferences. They should then show up as blue in your Project browser. You don't need to mark all the sub folders, just the root folder for each python project/package.

Without doing this it seems like Pycharm can't find the source files and takes you to the readonly cached code derived from the remote interpreter environment.

like image 180
Jarrad L Avatar answered Sep 28 '22 06:09

Jarrad L