roboflow / supervision

We write your reusable computer vision tools. πŸ’œ
https://supervision.roboflow.com
MIT License
24.33k stars 1.81k forks source link

Numpy incompatibility error, locally installed repo, Python 3.13 #1688

Open LinasKo opened 3 days ago

LinasKo commented 3 days ago

Reproduction steps:

git clone git@github.com:roboflow/supervision.git supervision-fresh
cd supervision-fresh
poetry install --with dev
poetry shell
echo "import supervision" > simple_script.py
python simple_script.py

This produces:

A module that was compiled using NumPy 1.x cannot be run in
NumPy 2.1.3 as it may crash. To support both 1.x and 2.x
versions of NumPy, modules must be compiled with NumPy 2.0.
Some module may need to rebuild instead e.g. with 'pybind11>=2.12'.

If you are a user of the module, the easiest solution will be to
downgrade to 'numpy<2' or try to upgrade the affected module.
We expect that some modules will need time to support NumPy 2.

Traceback (most recent call last):  File "/Users/linasko/.settler_workspace/pr/supervision-fresh/simple_script.py", line 1, in <module>
    import supervision
  File "/Users/linasko/.settler_workspace/pr/supervision-fresh/supervision/__init__.py", line 9, in <module>
    from supervision.annotators.core import (
  File "/Users/linasko/.settler_workspace/pr/supervision-fresh/supervision/annotators/core.py", line 5, in <module>
    import cv2
  File "/Users/linasko/.settler_workspace/pr/supervision-fresh/.venv/lib/python3.13/site-packages/cv2/__init__.py", line 181, in <module>
    bootstrap()
  File "/Users/linasko/.settler_workspace/pr/supervision-fresh/.venv/lib/python3.13/site-packages/cv2/__init__.py", line 153, in bootstrap
    native_module = importlib.import_module("cv2")
  File "/opt/homebrew/Cellar/python@3.13/3.13.0_1/Frameworks/Python.framework/Versions/3.13/lib/python3.13/importlib/__init__.py", line 88, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
AttributeError: _ARRAY_API not found
Traceback (most recent call last):
  File "/Users/linasko/.settler_workspace/pr/supervision-fresh/simple_script.py", line 1, in <module>
    import supervision
  File "/Users/linasko/.settler_workspace/pr/supervision-fresh/supervision/__init__.py", line 9, in <module>
    from supervision.annotators.core import (
    ...<23 lines>...
    )
  File "/Users/linasko/.settler_workspace/pr/supervision-fresh/supervision/annotators/core.py", line 5, in <module>
    import cv2
  File "/Users/linasko/.settler_workspace/pr/supervision-fresh/.venv/lib/python3.13/site-packages/cv2/__init__.py", line 181, in <module>
    bootstrap()
    ~~~~~~~~~^^
  File "/Users/linasko/.settler_workspace/pr/supervision-fresh/.venv/lib/python3.13/site-packages/cv2/__init__.py", line 153, in bootstrap
    native_module = importlib.import_module("cv2")
  File "/opt/homebrew/Cellar/python@3.13/3.13.0_1/Frameworks/Python.framework/Versions/3.13/lib/python3.13/importlib/__init__.py", line 88, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ImportError: numpy.core.multiarray failed to import

Environment:

Note:

Poetry env ``` Found existing alias for "poetry env info". You should use: "pvinf" Virtualenv Python: 3.13.0 Implementation: CPython Path: /Users/linasko/.settler_workspace/pr/supervision-fresh/.venv Executable: /Users/linasko/.settler_workspace/pr/supervision-fresh/.venv/bin/python Valid: True Base Platform: darwin OS: posix Python: 3.13.0 Path: /opt/homebrew/opt/python@3.13/Frameworks/Python.framework/Versions/3.13 Executable: /opt/homebrew/opt/python@3.13/Frameworks/Python.framework/Versions/3.13/bin/python3.13 ```
Poetry config cache-dir = "/Users/linasko/Library/Caches/pypoetry" experimental.system-git-client = false installer.max-workers = null installer.modern-installation = true installer.no-binary = null installer.parallel = true keyring.enabled = true solver.lazy-wheel = true virtualenvs.create = true virtualenvs.in-project = true virtualenvs.options.always-copy = false virtualenvs.options.no-pip = false virtualenvs.options.no-setuptools = false virtualenvs.options.system-site-packages = false virtualenvs.path = "{cache-dir}/virtualenvs" # /Users/linasko/Library/Caches/pypoetry/virtualenvs virtualenvs.prefer-active-python = false virtualenvs.prompt = "{project_name}-py{python_version}" warnings.export = true
LinasKo commented 3 days ago

Hey @onuralpszr πŸ‘‹

Could you check if it also happens on Linux?

onuralpszr commented 3 days ago

Hey @onuralpszr πŸ‘‹

Could you check if it also happens on Linux?

Testing with py3.13 linux πŸ‘ - PASSED (no error)

LinasKo commented 3 days ago

Thanks a lot!

Confirming this also happens with --depth 1 -b develop.

`pip freeze` ``` anyio==4.5.2 appnope==0.1.4 argon2-cffi==23.1.0 argon2-cffi-bindings==21.2.0 arrow==1.3.0 asttokens==2.4.1 async-lru==2.0.4 attrs==24.2.0 babel==2.16.0 backcall==0.2.0 beautifulsoup4==4.12.3 bleach==6.1.0 build==1.2.2.post1 cachetools==5.5.0 cairocffi==1.7.1 CairoSVG==2.7.1 certifi==2024.8.30 cffi==1.17.1 cfgv==3.4.0 chardet==5.2.0 charset-normalizer==3.4.0 click==8.1.7 colorama==0.4.6 comm==0.2.2 contourpy==1.3.1 cssselect2==0.7.0 cycler==0.12.1 debugpy==1.8.8 decorator==5.1.1 defusedxml==0.7.1 distlib==0.3.9 docutils==0.21.2 executing==2.1.0 fastjsonschema==2.20.0 filelock==3.16.1 fonttools==4.55.0 fqdn==1.5.1 ghp-import==2.1.0 gitdb==4.0.11 GitPython==3.1.43 griffe==1.4.0 h11==0.14.0 httpcore==1.0.7 httpx==0.27.2 identify==2.6.1 idna==3.10 importlib_metadata==8.5.0 importlib_resources==6.4.5 iniconfig==2.0.0 ipykernel==6.29.5 ipython==8.12.3 ipywidgets==8.1.5 isoduration==20.11.0 jaraco.classes==3.4.0 jaraco.context==6.0.1 jaraco.functools==4.1.0 jedi==0.19.2 Jinja2==3.1.4 json5==0.9.28 jsonpointer==3.0.0 jsonschema==4.23.0 jsonschema-specifications==2023.12.1 jupyter-events==0.10.0 jupyter-lsp==2.2.5 jupyter_client==8.6.3 jupyter_core==5.7.2 jupyter_server==2.14.2 jupyter_server_terminals==0.5.3 jupyterlab==4.2.6 jupyterlab_pygments==0.3.0 jupyterlab_server==2.27.3 jupyterlab_widgets==3.0.13 jupytext==1.16.4 keyring==25.5.0 kiwisolver==1.4.7 Markdown==3.7 markdown-it-py==3.0.0 MarkupSafe==2.1.5 matplotlib==3.7.2 matplotlib-inline==0.1.7 mdit-py-plugins==0.4.2 mdurl==0.1.2 mergedeep==1.3.4 mike==2.1.3 mistune==3.0.2 mkdocs==1.6.1 mkdocs-autorefs==1.2.0 mkdocs-get-deps==0.2.0 mkdocs-git-committers-plugin-2==2.4.1 mkdocs-git-revision-date-localized-plugin==1.3.0 mkdocs-jupyter==0.24.8 mkdocs-material==9.5.45 mkdocs-material-extensions==1.3.1 mkdocstrings==0.26.1 mkdocstrings-python==1.11.1 more-itertools==10.5.0 mypy==1.13.0 mypy-extensions==1.0.0 nbclient==0.10.0 nbconvert==7.16.4 nbformat==5.10.4 nest-asyncio==1.6.0 nh3==0.2.18 nodeenv==1.9.1 notebook==7.2.2 notebook_shim==0.2.4 numpy==2.1.3 opencv-python==4.8.1.78 overrides==7.7.0 packaging==24.2 paginate==0.5.7 pandocfilters==1.5.1 parso==0.8.4 pathspec==0.12.1 pexpect==4.9.0 pickleshare==0.7.5 pillow==10.4.0 pkginfo==1.10.0 platformdirs==4.3.6 pluggy==1.5.0 pre-commit==3.5.0 prometheus_client==0.21.0 prompt_toolkit==3.0.48 psutil==6.1.0 ptyprocess==0.7.0 pure_eval==0.2.3 pycparser==2.22 Pygments==2.18.0 pymdown-extensions==10.12 pyparsing==3.0.9 pyproject-api==1.8.0 pyproject_hooks==1.2.0 pytest==8.3.3 python-dateutil==2.9.0.post0 python-json-logger==2.0.7 pytz==2024.2 PyYAML==6.0.2 pyyaml_env_tag==0.1 pyzmq==26.2.0 readme_renderer==43.0 referencing==0.35.1 regex==2024.11.6 requests==2.32.3 requests-toolbelt==1.0.0 rfc3339-validator==0.1.4 rfc3986==2.0.0 rfc3986-validator==0.1.1 rich==13.9.4 rpds-py==0.20.1 ruff==0.8.0 scipy==1.14.1 Send2Trash==1.8.3 setuptools==75.3.0 six==1.16.0 smmap==5.0.1 sniffio==1.3.1 soupsieve==2.6 stack-data==0.6.3 -e git+ssh://git@github.com/roboflow/supervision.git@bbbb37434c4f7dbc113228c634e17459bb01c4f7#egg=supervision terminado==0.18.1 tinycss2==1.4.0 tornado==6.4.2 tox==4.23.2 tqdm==4.67.1 traitlets==5.14.3 twine==5.1.1 types-python-dateutil==2.9.0.20241003 typing_extensions==4.12.2 uri-template==1.3.0 urllib3==2.2.3 verspec==0.1.0 virtualenv==20.27.1 watchdog==4.0.2 wcwidth==0.2.13 webcolors==24.8.0 webencodings==0.5.1 websocket-client==1.8.0 wheel==0.45.1 widgetsnbextension==4.0.13 zipp==3.20.2 ```
onuralpszr commented 3 days ago

Here is my list when I run on python 3.13 with poetry --with dev ( Import error happened)

anyio==4.5.2
argon2-cffi==23.1.0
argon2-cffi-bindings==21.2.0
arrow==1.3.0
asttokens==2.4.1
async-lru==2.0.4
attrs==24.2.0
babel==2.16.0
backcall==0.2.0
beautifulsoup4==4.12.3
bleach==6.1.0
build==1.2.2.post1
cachetools==5.5.0
cairocffi==1.7.1
CairoSVG==2.7.1
certifi==2024.8.30
cffi==1.17.1
cfgv==3.4.0
chardet==5.2.0
charset-normalizer==3.4.0
click==8.1.7
colorama==0.4.6
comm==0.2.2
contourpy==1.3.1
cryptography==43.0.3
cssselect2==0.7.0
cycler==0.12.1
debugpy==1.8.8
decorator==5.1.1
defusedxml==0.7.1
distlib==0.3.9
docutils==0.21.2
executing==2.1.0
fastjsonschema==2.20.0
filelock==3.16.1
fonttools==4.55.0
fqdn==1.5.1
ghp-import==2.1.0
gitdb==4.0.11
GitPython==3.1.43
griffe==1.4.0
h11==0.14.0
httpcore==1.0.7
httpx==0.27.2
identify==2.6.1
idna==3.10
importlib_metadata==8.5.0
importlib_resources==6.4.5
iniconfig==2.0.0
ipykernel==6.29.5
ipython==8.12.3
ipywidgets==8.1.5
isoduration==20.11.0
jaraco.classes==3.4.0
jaraco.context==6.0.1
jaraco.functools==4.1.0
jedi==0.19.2
jeepney==0.8.0
Jinja2==3.1.4
json5==0.9.28
jsonpointer==3.0.0
jsonschema==4.23.0
jsonschema-specifications==2023.12.1
jupyter-events==0.10.0
jupyter-lsp==2.2.5
jupyter_client==8.6.3
jupyter_core==5.7.2
jupyter_server==2.14.2
jupyter_server_terminals==0.5.3
jupyterlab==4.2.6
jupyterlab_pygments==0.3.0
jupyterlab_server==2.27.3
jupyterlab_widgets==3.0.13
jupytext==1.16.4
keyring==25.5.0
kiwisolver==1.4.7
Markdown==3.7
markdown-it-py==3.0.0
MarkupSafe==2.1.5
matplotlib==3.7.2
matplotlib-inline==0.1.7
mdit-py-plugins==0.4.2
mdurl==0.1.2
mergedeep==1.3.4
mike==2.1.3
mistune==3.0.2
mkdocs==1.6.1
mkdocs-autorefs==1.2.0
mkdocs-get-deps==0.2.0
mkdocs-git-committers-plugin-2==2.4.1
mkdocs-git-revision-date-localized-plugin==1.3.0
mkdocs-jupyter==0.24.8
mkdocs-material==9.5.45
mkdocs-material-extensions==1.3.1
mkdocstrings==0.26.1
mkdocstrings-python==1.11.1
more-itertools==10.5.0
mypy==1.13.0
mypy-extensions==1.0.0
nbclient==0.10.0
nbconvert==7.16.4
nbformat==5.10.4
nest-asyncio==1.6.0
nh3==0.2.18
nodeenv==1.9.1
notebook==7.2.2
notebook_shim==0.2.4
numpy==2.1.3
opencv-python==4.8.1.78
overrides==7.7.0
packaging==24.2
paginate==0.5.7
pandocfilters==1.5.1
parso==0.8.4
pathspec==0.12.1
pexpect==4.9.0
pickleshare==0.7.5
pillow==10.4.0
pkginfo==1.10.0
platformdirs==4.3.6
pluggy==1.5.0
pre-commit==3.5.0
prometheus_client==0.21.0
prompt_toolkit==3.0.48
psutil==6.1.0
ptyprocess==0.7.0
pure_eval==0.2.3
pycparser==2.22
Pygments==2.18.0
pymdown-extensions==10.12
pyparsing==3.0.9
pyproject-api==1.8.0
pyproject_hooks==1.2.0
pytest==8.3.3
python-dateutil==2.9.0.post0
python-json-logger==2.0.7
pytz==2024.2
PyYAML==6.0.2
pyyaml_env_tag==0.1
pyzmq==26.2.0
readme_renderer==43.0
referencing==0.35.1
regex==2024.11.6
requests==2.32.3
requests-toolbelt==1.0.0
rfc3339-validator==0.1.4
rfc3986==2.0.0
rfc3986-validator==0.1.1
rich==13.9.4
rpds-py==0.20.1
ruff==0.8.0
scipy==1.14.1
SecretStorage==3.3.3
Send2Trash==1.8.3
setuptools==75.3.0
six==1.16.0
smmap==5.0.1
sniffio==1.3.1
soupsieve==2.6
stack-data==0.6.3
-e git+ssh://git@github.com/roboflow/supervision.git@bbbb37434c4f7dbc113228c634e17459bb01c4f7#egg=supervision
terminado==0.18.1
tinycss2==1.4.0
tornado==6.4.2
tox==4.23.2
tqdm==4.67.1
traitlets==5.14.3
twine==5.1.1
types-python-dateutil==2.9.0.20241003
typing_extensions==4.12.2
uri-template==1.3.0
urllib3==2.2.3
verspec==0.1.0
virtualenv==20.27.1
watchdog==4.0.2
wcwidth==0.2.13
webcolors==24.8.0
webencodings==0.5.1
websocket-client==1.8.0
wheel==0.45.1
widgetsnbextension==4.0.13
zipp==3.20.2