user2208346
user2208346

Reputation: 31

MLFlow Projects can't find conda executable

I am following the tutorial on MLFlow website. I was able to run the train.py and mlflow ui worked fine. Packaging the project tries to use env variable MLFLOW_CONDA_HOME but can't find conda. I have tried setting the variable to the path of anaconda3/condabin but it doesn't seem to find my executable. This is the error I get: ERROR mlflow.cli: === Could not find Conda executable at /anaconda3/condabin\bin/conda. Ensure Conda is installed as per the inst ructions at https://conda.io/docs/user-guide/install/index.html. You can also configure MLflow to look for a specific Conda executable by setting the MLFLOW_CONDA_HOME environment variable to the path of the Conda executable ===

Adding \bin/conda at the end of my path seems to be the problem, I am not sure why mlflow is doing it. I even tried setting it to my python.exe in my conda env, but no luck. I can't find bin/conda folder in my Anaconda folder anywhere.

Upvotes: 2

Views: 5584

Answers (7)

errorParser
errorParser

Reputation: 671

I faced this issue within a kubernetes deployment with miniconda3 as the base image. Fixed this by setting the MLFLOW_CONDA_HOME env variable to "/opt/conda/"

Upvotes: 0

Rm4n
Rm4n

Reputation: 858

If you're using mlflow.pyfunc.spark_udf and get an error saying Could not find Conda executable conda then try to define the environment variable MLFLOW_CONDA_HOME in spark-env.sh as Spark doesn't recognize variables defined elsewhere. Also make sure to use the absolute path for the Conda executable.

Upvotes: 0

Lawhatre
Lawhatre

Reputation: 1450

If you don't have conda environment then you can execute the following command from your terminal

mlflow run <enter your local directory name> --no-conda -P alpha=0.5

This should solve the issues with the environment variable.

Upvotes: 1

George
George

Reputation: 113

Here is one possible solutions (the fastest one, in my opinion).

Key points:

  1. The project virtual environment should be created with conda.
  2. Use pip to install MLFlow.

Follow the steps for Windows:

  1. Install miniconda (in my case, version 3)
  2. Set conda bat file (installation path + condabin dir + conda.bat) in PATH
  3. Create your project without virtual environment (in my case, I set in PyCharm conda instead of venv and it did not create any virtual environment, just added some external libraries), at least not in the project directory.
  4. Create conda virtual environment manually in the project directory. In your project directory, execute conda create -n venv and follow the instructions (I used default for all the questions there).
  5. Open a terminal and activate conda virtual environment. If you use PyCharm, you will be positioned properly, otherwise just prompt yourself in the project directory. Execute conda activate venv where venv is my virtual environment created at point 4.
  6. Execute python -m pip install mlflow

If you want to test it, you can try one of the tests from MLFlow. E.g., you can use mlflow run https://github.com/mlflow/mlflow-example.git -P alpha=5.0

In my case, it worked.

Upvotes: 0

Fugui
Fugui

Reputation: 91

I resolved this by running it from Anaconda Prompt. Make sure mlflow is installed in anaconda first as well, nothing else. But the problem then is that it's not well compatible on windows, you would need to split into two steps, activate the conda environment and then run with --no-conda as mentioned here https://github.com/mlflow/mlflow/issues/2674

Upvotes: 2

KyuMirthu
KyuMirthu

Reputation: 427

I solved the issue by removing the MLFLOW_CONDA_HOME environment variable alltogether. Make sure you have added the path to the conda executable to your PATH variable.

Upvotes: 0

Justin Malloy
Justin Malloy

Reputation: 489

MLflow 1.5 was just released today.

It doesn't specifically mention it in the github notes, but I had the same issue, where it affixed \bin/conda, and now it doesn't do that anymore.

Upvotes: 2

Related Questions