indexing installed package instead of sources root
Answered
Dear PyCharm gurus,
I cloned a github repository of a package, MDAnalysis, which is also installed under /usr/local/lib/python3.5/dist-packages/MDAnalysis.
I opened the cloned repository in PyCharm and set it as source root. The problem is that when I try to navigate to any submodule of MDAnalysis, PyCharm takes me to the submodule under the version that I have installed, instead of the submodule of the cloned repository.
Maybe I could fix this if I placed the source root first in the PYTHONPATH variable, but I don't know how to do this in the PyCharm environment.
Any help is much appreciated!
.Jose
Please sign in to leave a comment.
Hi Jose,
Could you please post a screenshot of your project structure as it's shown in Project tool window? My first guess is that you might have marked a wrong directory as a source root. According to the structure of https://github.com/MDAnalysis/mdanalysis you need to set the directory "package" as a source root so that the package "MDAnalysis" was resolved in it. Is it true in your case?
Hi Mikhail,
I had marked MDAanalysis as source, see the screenshot below:
I followed your suggestion and instead, marked "package" as source. Just for good measure, I deleted the ".idea" subdirectory and also invalidated the caches and restart. Now it's working as intended!
Thanks a lot!