Project/Python Interpreter relationship

Am in transition between using pyenv and uv to maintain multiple Python Interpreters on my Linux PC running PyCharm Professional.
Obviously I can ('nuclear solution') uninstall pyenv and remove any remaining artifacts. The next time I open affected-projects, will have the surprise of an invalid interpreter and have to check pyproject.toml for its requirements. (don't think this is true if instead clone the project from GitLab - maybe as good an answer/over-head as any other)
An individual project's `.idea/misc.xml` advises a particular “jdk”, eg 
`<project version="4">
 <component name="Black">
   <option name="sdkName" value="Poetry (UnpredictablePython)" />
 </component>
 <component name="ProjectRootManager" version="2" project-jdk-name="Poetry (UnpredictablePython)" project-jdk-type="Python SDK" />`
This seems to refer to ~/JetBrains/PyCharm2025.1/options/jdk.table.xml` which in-turn points to one of the installed (or at one time installed) Interpreters.
Is there a way to programmatically interrogate these files and (assuming PyCharm is not running) amend them to use a uv-controlled and equivalent version of Python?
Ancillary question: some of the “sdkName” values seem to have a (number) attached, whereas there are multiple entries in `jdk.table.xml` with different numbers but the same ‘root project name’. Is this because the project was opened, and updated to use a newer version of Python? How to clean-up this situation?
PS if the above files/my conclusions are incorrect, please explain where/at what I should be looking…
Many thanks =dn

0
5 comments

Hi dn, you are absolutely right, PyCharm stores interpreter configurations in a few key places:

- On a per-project basis in .idea/misc.xml and .idea/workspace.xml

- Globally, in <Configuration Directory>/options/jdk.table.xml

PyCharm identifies SDKs by the <name> entry (e.g., Poetry (UnpredictablePython)), which is not guaranteed to be unique unless manually controlled. You may find duplicate entries (or a number of entries with different numbers) if:

  • A Python binary was re-created (e.g., reinstalled with a new path/hash).
  • Projects pointed to different environments but used the same label.
  • You imported/cloned the project multiple times.

To avoid potential issues when migrating from pyenv to uv, you might consider resetting jdk.table.xml: back it up or move it to another location while PyCharm is closed, then reconfigure your interpreters from scratch when you reopen the IDE.

0

Hi Mikhail,

Thank you for the explanation.

Can I take it that if there are multiple but apparently similar entries in the `jdk.table.xml` file, that the highest suffixed-number (in parentheses) is the latest, ie that all others have been superceded?

Regards =dn

 

0

Mikhail, you have been kindly entertaining my questions. Is documentation available which describes the jdk.table.xml file, its contents, and purposes?

Please advise =dn

0

Hi dn, regarding your question: PyCharm incrementally appends numeric suffixes when an interpreter with the same display name is added again, the highest suffix typically corresponds to the most recently added configuration, although it's not always a sign that older ones have been superseded, just that they're distinct entries.

As for documentation: unfortunately, jdk.table.xml is not officially documented in detail. While the structure is relatively straightforward, it's not considered part of the public API and may change between versions.

0

Thanks Mikhail.

0

Please sign in to leave a comment.