mlflow: [BUG] can't run MLFlow project on Windows
System information
- Have I written custom code (as opposed to using a stock example script provided in MLflow): no
- OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Windows 10
- MLflow installed from (source or binary): pip install mlflow in conda environmnet
- MLflow version (run
mlflow --version): 1.1.0 - Python version: 3.7.3
- npm version, if running the dev UI:
- Exact command to reproduce: mlflow run <git-repository>
Describe the problem
When running the command mlflow run <git-repository> for a project that uses a conda environment, the project can’t be run because of a FileNotFoundError: [WinError 2] The system cannot find the file specified error.
Logs
2019/07/26 14:57:50 INFO mlflow.projects: === Running command 'source C:\Users\myUser\AppData\Local\Continuum\anaconda3\Scripts/../etc/profile.d/conda.sh && conda activate mlflow-5704e62345c83aec63a905fd394fede4b904cc8d 1>&2 && python run.py in run with ID '2115ac6375394aaea8a22376b81b1ee3' ===
Running the project fails because the command “source” is not available on Windows. The bug might have been introduced in #1576.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 6
- Comments: 18 (1 by maintainers)
With mlflow 1.4.0, python 3.6 and conda 4.7.12, this issue can be fixed by changing this line in the source code. File
mlflow\projects\__init__.py, line 687return ["conda.bat activate %s" % (conda_env_name)]Windows CreateProcess could not find the file conda because it actually points to conda.bat in an Anaconda prompt.I’ve experienced the same thing for
mlflow uiHi all, hi @dbczumar .
still getting this in mlflow 2.1.1 (Python 3.9.15, Windows 11 Pro, mlflow Version: 2.1.1.).
Is this still a known issue? The solution suggested is not clear to me from the discussions above. Any ideas?
The command :
mlflow run https://github.com/mlflow/mlflow-example.git -P alpha=5.0gives the following error.
ERROR
bump still getting this in mlflow 1.6
mlflow models serve -m runs:/74b0dadee65644488c432981f75865dc/model --port 1234 --no-conda execution failed with
In local windows machine this issue is fixed for –no-conda execution.
File name: mlflow\pyfunc\backend.py Class name:PyFuncBackend Function:serve
Original Line
changed to
root cause: Issue is array of array command.split(" ") this will return array[] but passing subprocess.Popen([[]], env=command_env).wait(). When remove outer array started working for --no-conda following command working fine:
models serve -m runs:/74b0dadee65644488c432981f75865dc/model --port 1234 --no-conda
Steps to reproduce the issue:
On Windows: mlflow version:1.13.1 OS: Windows 10 Step 1) mlflow run . -P alpha=0.42 --no-conda executed successfully. Step 2): mlflow models serve -m runs:/74b0dadee65644488c432981f75865dc/model --port 1234 --no-conda execution failed.
ERROR: FileNotFoundError: [WinError 2] The system cannot find the file specified
Exception:
2021/02/18 12:34:08 INFO mlflow.models.cli: Selected backend for flavor ‘python_function’ 2021/02/18 12:34:08 INFO mlflow.pyfunc.backend: === Running command ‘waitress-serve --host=127.0.0.1 --port=1234 --ident=mlflow mlflow.pyfunc.scoring_server.wsgi:app’ Traceback (most recent call last): File “c:\users\userappdata\local\programs\python\python37\lib\runpy.py”, line 193, in _run_module_as_main “main”, mod_spec) File “c:\users\userappdata\local\programs\python\python37\lib\runpy.py”, line 85, in run_code exec(code, run_globals) File "C:\Users\userAppData\Local\Programs\Python\Python37\Scripts\mlflow.exe_main.py", line 7, in <module> File “c:\users\userappdata\local\programs\python\python37\lib\site-packages\click\core.py”, line 829, in call return self.main(*args, **kwargs) File “c:\users\userappdata\local\programs\python\python37\lib\site-packages\click\core.py”, line 782, in main rv = self.invoke(ctx) File “c:\users\userappdata\local\programs\python\python37\lib\site-packages\click\core.py”, line 1259, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File “c:\users\userappdata\local\programs\python\python37\lib\site-packages\click\core.py”, line 1259, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File “c:\users\userappdata\local\programs\python\python37\lib\site-packages\click\core.py”, line 1066, in invoke return ctx.invoke(self.callback, **ctx.params) File “c:\users\userappdata\local\programs\python\python37\lib\site-packages\click\core.py”, line 610, in invoke return callback(*args, **kwargs) File “c:\users\userappdata\local\programs\python\python37\lib\site-packages\mlflow\models\cli.py”, line 57, in serve ).serve(model_uri=model_uri, port=port, host=host) File “c:\users\userappdata\local\programs\python\python37\lib\site-packages\mlflow\pyfunc\backend.py”, line 99, in serve subprocess.Popen([command.split(" ")], env=command_env).wait() File “c:\users\userappdata\local\programs\python\python37\lib\subprocess.py”, line 756, in init restore_signals, start_new_session) File “c:\users\userappdata\local\programs\python\python37\lib\subprocess.py”, line 1155, in _execute_child startupinfo) FileNotFoundError: [WinError 2] The system cannot find the file specified