Unable to set python interpreter in PyCharm from plugin

Planned

I am working on a plugin that configures the project SDK when a project is opened. I use a startup activity to set the project SDK. When I open the project, I can see that the correct SDK has been selected by the plugin and indexing starts but after indexing for a while I see a notification saying “Python 3.11 has bee configured as the project interpreter”. PyCharm seems to automatically change the interpreter to the SDK which has the latest version in the JDK table file. How can I prevent PyCharm from changing the interpreter when an interpreter is already selected?

The code I am using to set the project SDK:
ProjectRootManager projectRootManager = ProjectRootManager.getInstance(this.project);
projectRootManager.setProjectSdk(this.pythonSdk); 

0

Please sign in to leave a comment.