0

系统详情:

操作系统:Ubuntu 19.04

蟒蛇版本:2019.03

Python版本:3.7.3

毫升流版本:1.0.0

重现步骤: https ://mlflow.org/docs/latest/tutorial.html

行/命令错误: mlflow models serve -m [path_to_model] -p 1234

错误: 命令 'source activate mlflow-c4536834c2e6e0e2472b58bfb28dce35b4bd0be6 1>&2 && gunicorn --timeout 60 -b 127.0.0.1:1234 -w 4 mlflow.pyfunc.scoring_server.wsgi:app' 返回非零返回码。返回码 = 1

终端日志:

(mlflow) root@user:/home/user/mlflow/mlflow/examples/sklearn_elasticnet_wine/mlruns/0/e3dd02d5d84545ffab858db13ede7366/artifacts/model# mlflow models serve -m $(pwd) -p 1234
2019/06/18 16:15:16 INFO mlflow.models.cli: Selected backend for flavor 'python_function'
2019/06/18 16:15:17 INFO mlflow.pyfunc.backend: === Running command 'source activate mlflow-c4536834c2e6e0e2472b58bfb28dce35b4bd0be6 1>&2 && gunicorn --timeout 60 -b 127.0.0.1:1234 -w 4 mlflow.pyfunc.scoring_server.wsgi:app'
bash: activate: No such file or directory
Traceback (most recent call last):
  File "/root/anaconda3/envs/mlflow/bin/mlflow", line 10, in <module>
    sys.exit(cli())
  File "/root/anaconda3/envs/mlflow/lib/python3.7/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/root/anaconda3/envs/mlflow/lib/python3.7/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/root/anaconda3/envs/mlflow/lib/python3.7/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/root/anaconda3/envs/mlflow/lib/python3.7/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/root/anaconda3/envs/mlflow/lib/python3.7/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/root/anaconda3/envs/mlflow/lib/python3.7/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/root/anaconda3/envs/mlflow/lib/python3.7/site-packages/mlflow/models/cli.py", line 43, in serve
    host=host)
  File "/root/anaconda3/envs/mlflow/lib/python3.7/site-packages/mlflow/pyfunc/backend.py", line 76, in serve
    command_env=command_env)
  File "/root/anaconda3/envs/mlflow/lib/python3.7/site-packages/mlflow/pyfunc/backend.py", line 147, in _execute_in_conda_env
    command, rc
Exception: Command 'source activate mlflow-c4536834c2e6e0e2472b58bfb28dce35b4bd0be6 1>&2 && gunicorn --timeout 60 -b 127.0.0.1:1234 -w 4 mlflow.pyfunc.scoring_server.wsgi:app' returned non zero return code. Return code = 1
(mlflow) root@user:/home/user/mlflow/mlflow/examples/sklearn_elasticnet_wine/mlruns/0/e3dd02d5d84545ffab858db13ede7366/artifacts/model# 
4

2 回答 2

0

按照 GitHub 问题1507 ( https://github.com/mlflow/mlflow/issues/1507 ) 中提到的步骤,我能够解决此问题。

参考这篇文章,“ anaconda/bin/ ”目录从未添加到环境变量列表中,即 PATH 变量。为了解决此问题,请将 ~/.bashrc 文件中 conda 初始化代码块的“ else ”部分添加到您的 PATH 变量中。

# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/home/atulk/anaconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
    eval "$__conda_setup"
else
    if [ -f "/home/atulk/anaconda3/etc/profile.d/conda.sh" ]; then
        . "/home/atulk/anaconda3/etc/profile.d/conda.sh"
    else
        export PATH="/home/atulk/anaconda3/bin:$PATH"
    fi
fi
unset __conda_setup
# <<< conda initialize <<<

在这种情况下,我将export PATH="/home/atulk/anaconda3/bin:$PATH"添加到 PATH 变量中。但是,这只是一个临时修复,直到问题在项目中得到修复。

于 2019-06-28T14:02:54.530 回答
0

不使用anaconda时可以使用export PATH=$PATH:/path/to/python/Python/2.7/bin

于 2019-10-22T13:23:52.693 回答