The mystery of PyCharm and duplicate interpreters

I’ve been running into this issue a lot recently when dealing with virtualenvs with my Python projects. (Which forms the majority of my work, so it’s definitely not just a minor concern.) I’m planning on writing a post on why working with virtualenvs for me is so important these days, especially when dealing with larger projects that could span multiple working environments, and especially more so when you need to collaborate with others as well. But that’s outside the scope of this post for now.

Essentially, as shown above, sometimes PyCharm will, for whatever reason, decide that the best solution for you adding a new Python interpreter is to add it as a duplicate entry. Removing any one of the entries then results in all of them being removed. Re-generating the caches, removing the project and re-adding it, un-registering it as a VCS root…every action via the GUI as far as I can tell is unable to resolve the issue.

To solve this, go to your PyCharm user configuration folder in $HOME/.Pycharm40 and open the jdk.table.xml file located there. (e.g. C:\Users\sonictk\.PyCharm40\config\options\jdk.table.xml)

You should be able to find instances of the duplicate entries and remove them that way. (Between each <jdk> element)

Hopefully this helps out anyone who’s been running into the same issue! I know I’ve talked to a few people before who have resigned themselves to ignoring it when it happens. 🙂

4 comments on “The mystery of PyCharm and duplicate interpretersAdd yours →

  1. Thanks for the suggestion, but this didn’t seem to work for me. My jdk.table.xml doesn’t have a second entry corresponding to the duplicate interpreter, but still shows two (one with the same name followed by (1))

  2. Thank you for finding and explaining this! It’s been vexing me for the past week, till I found a post pointing to your site.

Leave a Reply