Adding new libraries via the Interpreter's "Paths" not getting indexed

I have a bunch of import statements that are underlined in red and when I roll over they say "unresolved reference...".  So I go into the Project Interpreters, select my virtual environment, go to the Paths tab, and add the path to the libraries that are affected.  In one of my 3 projects when I clicked OK, I saw "Indexing" at the bottom of the window and everything worked.  In the other 2 projects, no matter what I do, I cannot get them to index.  I have tried restarting PyCharm, File -> Invalidate Caches, Hitting Apply instead of OK, clicking that little rotating arrows icon first, adding them one at a time.  Nothing seems to work.  Ideas?
8 comments
Hi Nate,

To include library you should add to Paths tab the path to the directory that is parent to that library (but not the path to the library).
In case it does not work for you please attach a sample project to reproduce this issue.
0
I am adding it correctly.  Sometimes it works, sometimes it doesn't.  When I clear out all my PyCharm settings and start over, it worked when setting up the project the first pass, but as soon as I adjusted the paths, adding a new one, it stopped working.  I won't be able to send you a project to reproduce because it doesn't happen until you start messing with the paths.
0
Where are those libraries actually installed - under your virtualenv, under your project or somewhere else?
0
They are in an eggs directory outside my virtualenv's site-packages folder.  I am using buildout which, when run, puts all eggs into ${buildout:directory}/eggs.  I then go into the paths tab and add them.  Sometimes it will index them and everything is good, usually the first time setting up the project, then the next time I add a path it usually doesn't index.  And by "doesn't index", I mean I don't see the status in the bar at the bottom and the import statements are still underlined in red (for just that package)
0
I found this forum post: http://forum.jetbrains.com/thread/PyCharm-58, saw that you recommended to make the folder a project source vs a additional path.  That fixed it.  Is that the recommended way of handling external libraries?
0

This doesn't work again in PyCharm version 2016.3. The added package path (to it's root folder not package itself) to the interpreter paths is not recognized. It works fine in the Python Console, but doesn't work in the Editor. Imports of this package always get marked as "Unresolved reference ...". We can't add the package to the project as it is only a skeleton package for code completion of different API's (which are only available inside external applications. In order to keep our repositories clean we decided to do it this way, which was working fine in former versions of PyCharm and other IDE's. The package content also doesn't appear in the list of "External Libraries". 

It is  really important for us to get this working. I will also address this problem to the issue tracker.

1

I think I am hitting the same problem. I have a folder of eggs inside my project that I have added to the interpreter paths. I have also added the eggs folder as a source folder in the project structure. I then invalidated the cache and restarted. However, when I then open a file in my project which imports a library in the eggs folder, it is underlined in red and says "Unresolved Reference". I can't ctrl-click on it to go tot he library code. I am using PyCharm Professional 2016.3.

0

Is there a tracker where I can watch progress on this issue?

0

Please sign in to leave a comment.