Cannot add conda environment to Pycharm – Conda executable path is empty even when it's not

Question:

I am pretty proficient in pycharm but it is the first time I stumble into this problem.

  1. I created a conda environment
  2. Finding the conda executable which for me is in /home/my_username/.miniconda3/envs/py39/bin/python
  3. Adding it to pycharm results in:
    enter image description here

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:
enter image description here

Asked By: Dr. Prof. Patrick

||

Answers:

Got it, thank you!

In the path you should define a path to the python.exe in the conda environment directory.

Here is an example:

enter image description here

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.

Answered By: Dr. Prof. Patrick

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.

Answered By: alephzarro

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

Answered By: arsalan Yaghoubi
Categories: questions Tags: , , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.