Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ModuleNotFoundError for numpy >= 2.0.0 #976

Closed
scott2b opened this issue Jun 16, 2024 · 2 comments
Closed

ModuleNotFoundError for numpy >= 2.0.0 #976

scott2b opened this issue Jun 16, 2024 · 2 comments
Labels

Comments

@scott2b
Copy link

scott2b commented Jun 16, 2024

Describe the issue as clearly as possible:

function_base appears now to be private and no longer directly accessible as done here: https://github.com/outlines-dev/outlines/blob/main/outlines/base.py#L8

As of numpy 2.0.0, this will raise:
ModuleNotFoundError: No module named 'numpy.lib.function_base'

Steps/code to reproduce the bug:

$ pip install 'numpy>=2.0.0
$ python

>>> import outlines


### Expected result:

```shell
the module imports

Error message:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/scott/github/scott2b/work/outlines/.venv/lib/python3.12/site-packages/outlines/__init__.py", line 2, in <module>
    import outlines.generate
  File "/Users/scott/github/scott2b/work/outlines/.venv/lib/python3.12/site-packages/outlines/generate/__init__.py", line 2, in <module>
    from .cfg import cfg
  File "/Users/scott/github/scott2b/work/outlines/.venv/lib/python3.12/site-packages/outlines/generate/cfg.py", line 5, in <module>
    from outlines.models import OpenAI
  File "/Users/scott/github/scott2b/work/outlines/.venv/lib/python3.12/site-packages/outlines/models/__init__.py", line 14, in <module>
    from .openai import OpenAI, azure_openai, openai
  File "/Users/scott/github/scott2b/work/outlines/.venv/lib/python3.12/site-packages/outlines/models/openai.py", line 9, in <module>
    from outlines.base import vectorize
  File "/Users/scott/github/scott2b/work/outlines/.venv/lib/python3.12/site-packages/outlines/base.py", line 8, in <module>
    from numpy.lib.function_base import (
ModuleNotFoundError: No module named 'numpy.lib.function_base'

Outlines/Python version information:

Traceback (most recent call last):
File "", line 1, in
File "/Users/scott/github/scott2b/work/outlines/.venv/lib/python3.12/site-packages/outlines/init.py", line 2, in
import outlines.generate
File "/Users/scott/github/scott2b/work/outlines/.venv/lib/python3.12/site-packages/outlines/generate/init.py", line 2, in
from .cfg import cfg
File "/Users/scott/github/scott2b/work/outlines/.venv/lib/python3.12/site-packages/outlines/generate/cfg.py", line 5, in
from outlines.models import OpenAI
File "/Users/scott/github/scott2b/work/outlines/.venv/lib/python3.12/site-packages/outlines/models/init.py", line 14, in
from .openai import OpenAI, azure_openai, openai
File "/Users/scott/github/scott2b/work/outlines/.venv/lib/python3.12/site-packages/outlines/models/openai.py", line 9, in
from outlines.base import vectorize
File "/Users/scott/github/scott2b/work/outlines/.venv/lib/python3.12/site-packages/outlines/base.py", line 8, in
from numpy.lib.function_base import (
ModuleNotFoundError: No module named 'numpy.lib.function_base'
Python 3.12.3 (main, May 9 2024, 13:22:55) [Clang 15.0.0 (clang-1500.3.9.4)]
aiohttp==3.9.5
aiosignal==1.3.1
annotated-types==0.7.0
attrs==23.2.0
certifi==2024.6.2
charset-normalizer==3.3.2
cloudpickle==3.0.0
datasets==2.20.0
dill==0.3.8
diskcache==5.6.3
filelock==3.15.1
frozenlist==1.4.1
fsspec==2024.5.0
huggingface-hub==0.23.4
idna==3.7
interegular==0.3.3
Jinja2==3.1.4
jsonschema==4.22.0
jsonschema-specifications==2023.12.1
lark==1.1.9
llvmlite==0.43.0
MarkupSafe==2.1.5
multidict==6.0.5
multiprocess==0.70.16
nest-asyncio==1.6.0
numba==0.60.0
numpy==2.0.0
outlines @ git+https://github.com/outlines-dev/outlines.git@49146d5d30c3afc573a79fe37b02e9b58977285b
packaging==24.1
pandas==2.2.2
pyairports==2.1.1
pyarrow==16.1.0
pyarrow-hotfix==0.6
pycountry==24.6.1
pydantic==2.7.4
pydantic_core==2.18.4
python-dateutil==2.9.0.post0
pytz==2024.1
PyYAML==6.0.1
referencing==0.35.1
requests==2.32.3
rpds-py==0.18.1
setuptools==70.0.0
six==1.16.0
tqdm==4.66.4
typing_extensions==4.12.2
tzdata==2024.1
urllib3==2.2.1
xxhash==3.4.1
yarl==1.9.4

Context for the issue:

No response

@scott2b scott2b added the bug label Jun 16, 2024
@scott2b
Copy link
Author

scott2b commented Jun 16, 2024

The workaround for the moment appears to be to install numpy<2.0.0

@rlouf
Copy link
Member

rlouf commented Jun 16, 2024

Thank you for reporting this! The best solution for now would be to pin the version. A PR would be greatly appreciated!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants