bentoml / BentoML

The easiest way to serve AI apps and models - Build Model Inference APIs, Job queues, LLM apps, Multi-model pipelines, and more!
https://bentoml.com
Apache License 2.0
7.13k stars 791 forks source link

bug: `bentoml --version` fails after `pip install -e .` #2950

Closed asafalina closed 2 years ago

asafalina commented 2 years ago

Describe the bug

Following the developer guide, I tried to install bentoml using pip install -e .. Then I tried to validate the installation using bentoml --version, however I'm getting the below error:

(.venv) ➜  BentoML git:(main) bentoml --version
Traceback (most recent call last):
  File "/Users/my-user/Desktop/my-user/repos/BentoML/.venv/bin/bentoml", line 33, in <module>
    sys.exit(load_entry_point('bentoml', 'console_scripts', 'bentoml')())
  File "/Users/my-user/Desktop/my-user/repos/BentoML/.venv/bin/bentoml", line 25, in importlib_load_entry_point
    return next(matches).load()
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/importlib/metadata.py", line 77, in load
    module = import_module(match.group('module'))
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 783, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/Users/my-user/Desktop/my-user/repos/BentoML/bentoml_cli/cli.py", line 6, in <module>
    from bentoml import __version__ as BENTOML_VERSION
  File "/Users/my-user/Desktop/my-user/repos/BentoML/bentoml/__init__.py", line 20, in <module>
    from ._internal.configuration import BENTOML_VERSION as __version__
  File "/Users/my-user/Desktop/my-user/repos/BentoML/bentoml/_internal/configuration/__init__.py", line 57, in <module>
    CLEAN_BENTOML_VERSION: str = clean_bentoml_version(BENTOML_VERSION)
  File "/Users/my-user/Desktop/my-user/repos/BentoML/bentoml/_internal/configuration/__init__.py", line 50, in clean_bentoml_version
    raise BentoMLException("Errors while parsing BentoML version.")
bentoml.exceptions.BentoMLException: Errors while parsing BentoML version.

Looking at the output of the pip install -e ., it appears that an old bentoml version (bentoml-0.0.post1918+g3de0c9a.d20220829) is being installed:

(.venv) ➜  BentoML git:(main) ✗ pip install -e .
Obtaining file:///Users/my-user/Desktop/my-user/repos/BentoML
  Installing build dependencies ... done
  Checking if build backend supports build_editable ... done
  Getting requirements to build editable ... done
  Preparing editable metadata (pyproject.toml) ... done
Collecting aiohttp
  Using cached aiohttp-3.8.1-cp39-cp39-macosx_11_0_arm64.whl (552 kB)
Collecting requests
  Using cached requests-2.28.1-py3-none-any.whl (62 kB)
Collecting prometheus-client<0.14.0,>=0.10.0
  Using cached prometheus_client-0.13.1-py3-none-any.whl (57 kB)
Collecting uvicorn
  Using cached uvicorn-0.18.3-py3-none-any.whl (57 kB)
Collecting pynvml<12
  Using cached pynvml-11.4.1-py3-none-any.whl (46 kB)
Collecting starlette
  Using cached starlette-0.20.4-py3-none-any.whl (63 kB)
Collecting PyYAML>=5.0
  Using cached PyYAML-6.0-cp39-cp39-macosx_11_0_arm64.whl (173 kB)
Collecting pathspec
  Using cached pathspec-0.9.0-py2.py3-none-any.whl (31 kB)
Collecting opentelemetry-util-http==0.33b0
  Using cached opentelemetry_util_http-0.33b0-py3-none-any.whl (6.6 kB)
Collecting attrs>=21.1.0
  Using cached attrs-22.1.0-py2.py3-none-any.whl (58 kB)
Collecting deepmerge
  Using cached deepmerge-1.0.1-py3-none-any.whl (8.0 kB)
Collecting opentelemetry-semantic-conventions==0.33b0
  Using cached opentelemetry_semantic_conventions-0.33b0-py3-none-any.whl (26 kB)
Collecting opentelemetry-instrumentation-aiohttp-client==0.33b0
  Using cached opentelemetry_instrumentation_aiohttp_client-0.33b0-py3-none-any.whl (11 kB)
Collecting psutil
  Using cached psutil-5.9.1-cp39-cp39-macosx_10_9_universal2.whl
Collecting cloudpickle
  Using cached cloudpickle-2.1.0-py3-none-any.whl (25 kB)
Collecting opentelemetry-instrumentation-asgi==0.33b0
  Using cached opentelemetry_instrumentation_asgi-0.33b0-py3-none-any.whl (8.9 kB)
Collecting circus
  Using cached circus-0.17.1-py3-none-any.whl (182 kB)
Collecting pip-tools>=6.6.2
  Using cached pip_tools-6.8.0-py3-none-any.whl (51 kB)
Collecting python-multipart
  Using cached python_multipart-0.0.5-py3-none-any.whl
Collecting schema
  Using cached schema-0.7.5-py2.py3-none-any.whl (17 kB)
Collecting Jinja2>=3.0.1
  Using cached Jinja2-3.1.2-py3-none-any.whl (133 kB)
Collecting click>=7.0
  Using cached click-8.1.3-py3-none-any.whl (96 kB)
Collecting fs
  Using cached fs-2.4.16-py2.py3-none-any.whl (135 kB)
Collecting simple-di>=0.1.4
  Using cached simple_di-0.1.5-py3-none-any.whl (9.8 kB)
Collecting watchfiles>=0.15.0
  Using cached watchfiles-0.16.1-cp37-abi3-macosx_11_0_arm64.whl (359 kB)
Collecting numpy
  Using cached numpy-1.23.2-cp39-cp39-macosx_11_0_arm64.whl (13.3 MB)
Collecting packaging>=20.0
  Using cached packaging-21.3-py3-none-any.whl (40 kB)
Collecting python-dateutil
  Using cached python_dateutil-2.8.2-py2.py3-none-any.whl (247 kB)
Collecting cattrs>=22.1.0
  Using cached cattrs-22.1.0-py3-none-any.whl (33 kB)
Collecting opentelemetry-api>=1.9.0
  Using cached opentelemetry_api-1.12.0-py3-none-any.whl (52 kB)
Collecting rich>=11.2.0
  Using cached rich-12.5.1-py3-none-any.whl (235 kB)
Collecting opentelemetry-sdk>=1.9.0
  Using cached opentelemetry_sdk-1.12.0-py3-none-any.whl (81 kB)
Collecting opentelemetry-instrumentation==0.33b0
  Using cached opentelemetry_instrumentation-0.33b0-py3-none-any.whl (23 kB)
Collecting python-dotenv>=0.20.0
  Using cached python_dotenv-0.20.0-py3-none-any.whl (17 kB)
Collecting wrapt<2.0.0,>=1.0.0
  Using cached wrapt-1.14.1-cp39-cp39-macosx_11_0_arm64.whl (35 kB)
Requirement already satisfied: setuptools>=16.0 in ./.venv/lib/python3.9/site-packages (from opentelemetry-instrumentation==0.33b0->bentoml==0.0.post1918+g3de0c9a.d20220829) (58.1.0)
Collecting asgiref~=3.0
  Using cached asgiref-3.5.2-py3-none-any.whl (22 kB)
Collecting exceptiongroup
  Using cached exceptiongroup-1.0.0rc9-py3-none-any.whl (12 kB)
Collecting MarkupSafe>=2.0
  Using cached MarkupSafe-2.1.1-cp39-cp39-macosx_10_9_universal2.whl (17 kB)
Collecting Deprecated>=1.2.6
  Using cached Deprecated-1.2.13-py2.py3-none-any.whl (9.6 kB)
Collecting typing-extensions>=3.7.4
  Using cached typing_extensions-4.3.0-py3-none-any.whl (25 kB)
Collecting pyparsing!=3.0.5,>=2.0.2
  Using cached pyparsing-3.0.9-py3-none-any.whl (98 kB)
Collecting build
  Using cached build-0.8.0-py3-none-any.whl (17 kB)
Collecting wheel
  Using cached wheel-0.37.1-py2.py3-none-any.whl (35 kB)
Requirement already satisfied: pip>=21.2 in ./.venv/lib/python3.9/site-packages (from pip-tools>=6.6.2->bentoml==0.0.post1918+g3de0c9a.d20220829) (22.0.4)
Collecting commonmark<0.10.0,>=0.9.0
  Using cached commonmark-0.9.1-py2.py3-none-any.whl (51 kB)
Collecting pygments<3.0.0,>=2.6.0
  Using cached Pygments-2.13.0-py3-none-any.whl (1.1 MB)
Collecting anyio<4,>=3.0.0
  Using cached anyio-3.6.1-py3-none-any.whl (80 kB)
Collecting async-timeout<5.0,>=4.0.0a3
  Using cached async_timeout-4.0.2-py3-none-any.whl (5.8 kB)
Collecting aiosignal>=1.1.2
  Using cached aiosignal-1.2.0-py3-none-any.whl (8.2 kB)
Collecting frozenlist>=1.1.1
  Using cached frozenlist-1.3.1-cp39-cp39-macosx_11_0_arm64.whl (35 kB)
Collecting multidict<7.0,>=4.5
  Using cached multidict-6.0.2-cp39-cp39-macosx_11_0_arm64.whl (29 kB)
Collecting charset-normalizer<3.0,>=2.0
  Using cached charset_normalizer-2.1.1-py3-none-any.whl (39 kB)
Collecting yarl<2.0,>=1.0
  Using cached yarl-1.8.1-cp39-cp39-macosx_11_0_arm64.whl (57 kB)
Collecting pyzmq>=17.0
  Using cached pyzmq-23.2.1-cp39-cp39-macosx_10_15_universal2.whl (1.8 MB)
Collecting tornado>=5.0.2
  Using cached tornado-6.2-cp37-abi3-macosx_10_9_universal2.whl (421 kB)
Collecting six~=1.10
  Using cached six-1.16.0-py2.py3-none-any.whl (11 kB)
Collecting appdirs~=1.4.3
  Using cached appdirs-1.4.4-py2.py3-none-any.whl (9.6 kB)
Collecting certifi>=2017.4.17
  Using cached certifi-2022.6.15-py3-none-any.whl (160 kB)
Collecting urllib3<1.27,>=1.21.1
  Using cached urllib3-1.26.12-py2.py3-none-any.whl (140 kB)
Collecting idna<4,>=2.5
  Using cached idna-3.3-py3-none-any.whl (61 kB)
Collecting contextlib2>=0.5.5
  Using cached contextlib2-21.6.0-py2.py3-none-any.whl (13 kB)
Collecting h11>=0.8
  Using cached h11-0.13.0-py3-none-any.whl (58 kB)
Collecting sniffio>=1.1
  Using cached sniffio-1.2.0-py3-none-any.whl (10 kB)
Collecting tomli>=1.0.0
  Using cached tomli-2.0.1-py3-none-any.whl (12 kB)
Collecting pep517>=0.9.1
  Using cached pep517-0.13.0-py3-none-any.whl (18 kB)
Building wheels for collected packages: bentoml
  Building editable for bentoml (pyproject.toml) ... done
  Created wheel for bentoml: filename=bentoml-0.0.post1918+g3de0c9a.d20220829-0.editable-py3-none-any.whl size=12484 sha256=b25d09c07a9204374becef9f9ab100fbcb2393067de6acac003973b354ed04ed
  Stored in directory: /private/var/folders/83/tc8n4v115rg316y3z3xczdw40000gn/T/pip-ephem-wheel-cache-2ku37h85/wheels/a2/11/55/a4bb2ab7d49d6e0190bfe4cbce6ac10505aeb46b97e9b4552f
Successfully built bentoml
Installing collected packages: deepmerge, commonmark, appdirs, wrapt, wheel, urllib3, typing-extensions, tornado, tomli, sniffio, six, simple-di, pyzmq, PyYAML, python-dotenv, pyparsing, pynvml, pygments, psutil, prometheus-client, pathspec, opentelemetry-util-http, opentelemetry-semantic-conventions, numpy, multidict, MarkupSafe, idna, h11, frozenlist, exceptiongroup, contextlib2, cloudpickle, click, charset-normalizer, certifi, attrs, async-timeout, asgiref, yarl, uvicorn, schema, rich, requests, python-multipart, python-dateutil, pep517, packaging, Jinja2, fs, Deprecated, circus, cattrs, anyio, aiosignal, watchfiles, starlette, opentelemetry-api, build, aiohttp, pip-tools, opentelemetry-sdk, opentelemetry-instrumentation, opentelemetry-instrumentation-asgi, opentelemetry-instrumentation-aiohttp-client, bentoml
Successfully installed Deprecated-1.2.13 Jinja2-3.1.2 MarkupSafe-2.1.1 PyYAML-6.0 aiohttp-3.8.1 aiosignal-1.2.0 anyio-3.6.1 appdirs-1.4.4 asgiref-3.5.2 async-timeout-4.0.2 attrs-22.1.0 bentoml-0.0.post1918+g3de0c9a.d20220829 build-0.8.0 cattrs-22.1.0 certifi-2022.6.15 charset-normalizer-2.1.1 circus-0.17.1 click-8.1.3 cloudpickle-2.1.0 commonmark-0.9.1 contextlib2-21.6.0 deepmerge-1.0.1 exceptiongroup-1.0.0rc9 frozenlist-1.3.1 fs-2.4.16 h11-0.13.0 idna-3.3 multidict-6.0.2 numpy-1.23.2 opentelemetry-api-1.12.0 opentelemetry-instrumentation-0.33b0 opentelemetry-instrumentation-aiohttp-client-0.33b0 opentelemetry-instrumentation-asgi-0.33b0 opentelemetry-sdk-1.12.0 opentelemetry-semantic-conventions-0.33b0 opentelemetry-util-http-0.33b0 packaging-21.3 pathspec-0.9.0 pep517-0.13.0 pip-tools-6.8.0 prometheus-client-0.13.1 psutil-5.9.1 pygments-2.13.0 pynvml-11.4.1 pyparsing-3.0.9 python-dateutil-2.8.2 python-dotenv-0.20.0 python-multipart-0.0.5 pyzmq-23.2.1 requests-2.28.1 rich-12.5.1 schema-0.7.5 simple-di-0.1.5 six-1.16.0 sniffio-1.2.0 starlette-0.20.4 tomli-2.0.1 tornado-6.2 typing-extensions-4.3.0 urllib3-1.26.12 uvicorn-0.18.3 watchfiles-0.16.1 wheel-0.37.1 wrapt-1.14.1 yarl-1.8.1
WARNING: You are using pip version 22.0.4; however, version 22.2.2 is available.
You should consider upgrading via the '/Users/my-user/Desktop/my-user/repos/BentoML/.venv/bin/python3.9 -m pip install --upgrade pip' command.

Note: when trying to pip install -e . with the latest release (v1.0.4), using the below clone command: git clone --branch v1.0.4 https://github.com/bentoml/BentoML.git then the bentoml --version works well.

To reproduce

git clone https://github.com/asafalinadsg/BentoML.git cd BentoML python3.8 -m venv .venv source .venv/bin/activate pip install -e . pip install -r ./requirements/dev-requirements.txt bentoml --version

Expected behavior

something like: bentoml, version 1.0.4

Environment

bentoml: latest python version: 3.8 platform: macOS Monterey 12.5.1, M1 chip

aarnphm commented 2 years ago

can you do git fetch upstream --tags then try again?

You can add upstream remote with g remote add upstream git@github.com:bentoml/bentoml.git