Reputation: 1374
I am pretty proficient in pycharm but it is the first time I stumble into this problem.
/home/my_username/.miniconda3/envs/py39/bin/python
I tried to search for this issue and error but the results didnt help. I am using fedora 36 if it is relevant.
Edit: The output of which conda
is:
/home/my_username/.miniconda3/condabin/conda
Then trying to add it as the interpreter as suggested in Pycharm: Conda executable path is empty:
Upvotes: 8
Views: 35865
Reputation: 650
In the path you should define a path to the python.exe
in the Conda environment directory.
Here is an example:
Upvotes: 2
Reputation: 663
On macOS - none of the previous posts fixed the issue. This is the issue:
I tried absolutely everything including completely wiping all JetBrains from all caches, applications settings, everything. It will still not work. The issue is that Pycharm is looking for the conda bin in a specific folder, and it will never work if it's not in the expected folder. Once the conda bin file is in the right location, Pycharm will pick it up automatically.
I fixed it by installing a new copy of conda here:
usr/local/anaconda3/
(where conda was installed)~/miniconda3/
(where you should install conda/miniconda)(Download conda here: https://docs.conda.io/projects/miniconda/en/latest/)
When installing conda, pick the 'default' right_location, which is the location that Pycharm expects.
I then migrated my environments by just copying them from wrong_location/envs
to right_location/envs
.
Start up your Pycharm, and it should now see the conda bin and list your envs, and you can pick from them normally.
Upvotes: 0
Reputation: 1
If you find yourself unable to add an existing or new Conda environment with all the other answers, I resolved the issue by completely quitting PyCharm all together and re-open it.
Upvotes: 0
Reputation: 2132
First, check the output of conda env list
to find the root folder of your conda env.
Then add your conda environment as if it were an existing virtual environment.
Provide the full path to the python.exe within the root your conda environment.
Close PyCharm.
Locate your PyCharm settings folder and find the file options\jdk.table.xml
. The full path will look something like
%AppData%\JetBrains\PyCharm2023.1\options\jdk.table.xml
In there find the element that corresponds to the newly added environment. Then change the tag
<setting name="FLAVOR_ID" value="" />
into <setting name="FLAVOR_ID" value="Conda" />
Upvotes: 0
Reputation: 136
Upvotes: 12
Reputation: 59
As the error mentions either you do not have a Conda installed on your system or the path is not recognized by the IDE. Creating a new project, double check if the bar conda executable: is correctly filled by the directory to the folder Conda is installed on your system.
Normally your IDE fill the conda executable automatically, if this is not the case and manually filling the empty bar did not help, I would recommend to delete and reinstall your conda.
Good Luck
Upvotes: 0
Reputation: 176
You need to first tell PyCharm where conda executable is. This is not so obvious how, as there is no input field for that when adding existing conda environments. IMO it's a UX flaw in PyCharm.
I found this input field only available when creating a NEW conda environment from within a PyCharm. Enter a 'Conda executable' there. In your case: /home/????/.miniconda3/bin/conda
Then I also created a new dummy conda environment so the path is stored and PyCharm is happy. Afterwards, you shouldn't get that "Conda executable path is empty" anymore when adding new conda interpreter.
Upvotes: 1
Reputation: 1374
I ended up re-installing the OS and now it works, I would not call it a solution but it is what it is - I couldnt waste more time on this as I have work to do.
Upvotes: 0