iterative.ai MLEM |ModuleNotFoundError:没有名为"mlem.api"的模块;"MLEM"不是一个包



目标:安装并运行带有MLEM代码的Python脚本。

遵循库文档中的此安装指南;CCD_ 1就足够了。

代码:

from mlem.api import import_object
# ...

追溯:

$ python3 app/deployment-poc/mlem.py
Traceback (most recent call last):
File "/home/me/BitBucket/project/app/deployment-poc/mlem.py", line 1, in <module>
from mlem.api import import_object
File "/home/me/BitBucket/project/app/deployment-poc/mlem.py", line 1, in <module>
from mlem.api import import_object
ModuleNotFoundError: No module named 'mlem.api'; 'mlem' is not a package

我已经通过pipconda安装了这两个。

$ which mlem
/home/me/miniconda3/envs/venv/bin/mlem
$ mlem --version
MLEM Version: 0.4.1
$ conda list
# packages in environment at /home/me/miniconda3/envs/venv:
#
# Name                    Version                   Build  Channel
fastapi                   0.89.1                   pypi_0    pypi
mlem                      0.4.1                    pypi_0    pypi
(venv) me@laptop:~/BitBucket/project$ pip install mlem --no-dependencies
Requirement already satisfied: mlem in /home/me/miniconda3/envs/venv/lib/python3.10/site-packages (0.4.1)
(venv) me@laptop:~/BitBucket/project$ pip show mlem
Name: mlem
Version: 0.4.1
Summary: Version and deploy your models following GitOps principles
Home-page: https://mlem.ai
Author: Mikhail Sveshnikov
Author-email: mike0sv@iterative.ai
License: Apache License 2.0
Location: /home/me/miniconda3/envs/venv/lib/python3.10/site-packages
Requires: aiohttp, aiohttp-swagger, cached-property, click, cloudpickle, dill, entrypoints, flatdict, fsspec, gitpython, importlib-metadata, isort, iterative-telemetry, Jinja2, pydantic, pyparsing, python-gitlab, python-multipart, requests, rich, typer
Required-by: 

请求信誉良好的会员创建新标签:mlem

您有一个脚本/home/me/BitBucket/project/app/deployment-poc/mlem.py,它隐藏了可导入的包mlem。有了这样一个脚本,脚本中的import mlem尝试从该脚本中导入,而不是从包中导入。

mlem.py重命名为其他名称。

最重要的是:永远不要将脚本命名为可导入的包。从来没有email.pypip install mlem0等

相关内容

  • 没有找到相关文章

最新更新