External library indexing fails in PyCharm 4.5

This issue occurred with previous versions of PyCharm (see this SO post and this one ), but it manifests itself slightly differently in 4.5.

I am trying to add another library to the Python path of my current project. It is an internal library and consists of a group of files .py

in a different directory from the current project. I am following these steps:

  • Switch to File -> Settings -> Project: summary -> Project Interpreter

  • Click on the gear icon in the upper right corner of the screen that appears in the dialog box
  • Select More...

    from the context menu that appears
  • Click on the interpreter I am using
  • Click on the last of the 4 icons to the right of it, a thing with a folder and arrows, with a hint "Show paths for the selected interpreter"
  • Click +

    in the pop-up that appears
  • Use the file dialog to add the library path

By doing this, the result is:

  • Good :
    • Running the current project code from the Run Configuration work; that is, the external library is picked up inPYTHONPATH

    • The added path does not immediately disappear from the interpreter path dialog as it did in 4.0 (see the comment to this answer in one of the SO posts mentioned above).
  • Bad :
    • Indexing of the new library fails and all links to an external library are marked as unresolved links in the editor

I even tried it File -> Invalidate Caches / Restart...

and clicked the button Invalidate and Restart

that appears. After I sit and wait for the indexing to finish, I get the same result. I've been very careful with setting up the correct path, and it seems to be correct given that running the code actually works.

Does anyone know of a workaround for this problem without adding external code as the content root?

+3


source to share


2 answers


Checked with JetBrains support, they confirmed that the only ways to add external libraries to a PyCharm project are:

  • Add library as content root
  • OR
  • Open it as a separate project in the same window and attach it to the current project


Not the cleanest approaches as they basically mean adding other actual library code to your project. But they are the only ones at the moment.

+1


source


I faced very similar problems. I am working on an OpenStack component and all third party libraries have become marked as unresolved links. This turned out to be because the directory is .tox

automatically excluded by PyCharm, which prevents any virtual environments in that directory from indexing properly.



To fix this, I went to the dialog Editor > File Types

in the menu Preferences

and removed the folder .tox

from the option Ignore files and folders

.

+1


source







All Articles