exo-explore / exo

Run your own AI cluster at home with everyday devices 📱💻 🖥️⌚
GNU General Public License v3.0
6.31k stars 327 forks source link

A module that was compiled using NumPy 1.x cannot be run in NumPy 2.0.0 #109

Open bricolage opened 1 month ago

bricolage commented 1 month ago

I can install the app using a fresh install of python 3.12.4 and the latest pip (using asdf on an m1 Mac).

When I run it, I get the following error. If I try to force install numpy 1.x, I get other dependency version errors requiring 2.0.0.

python main.py

A module that was compiled using NumPy 1.x cannot be run in
NumPy 2.0.0 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/me/code/exo/main.py", line 10, in <module>
    from exo.api import ChatGPTAPI
  File "/Users/me/code/exo/exo/api/__init__.py", line 1, in <module>
    from exo.api.chatgpt_api import ChatGPTAPI as ChatGPTAPI
  File "/Users/me/code/exo/exo/api/chatgpt_api.py", line 6, in <module>
    from transformers import AutoTokenizer, AutoProcessor
  File "/Users/me/.asdf/installs/python/3.12.3/lib/python3.12/site-packages/transformers/utils/import_utils.py", line 1577, in __getattr__
    value = getattr(module, name)
  File "/Users/me/.asdf/installs/python/3.12.3/lib/python3.12/site-packages/transformers/utils/import_utils.py", line 1576, in __getattr__
    module = self._get_module(self._class_to_module[name])
  File "/Users/me/.asdf/installs/python/3.12.3/lib/python3.12/site-packages/transformers/utils/import_utils.py", line 1586, in _get_module
    return importlib.import_module("." + module_name, self.__name__)
  File "/Users/me/.asdf/installs/python/3.12.3/lib/python3.12/importlib/__init__.py", line 90, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "/Users/me/.asdf/installs/python/3.12.3/lib/python3.12/site-packages/transformers/models/auto/processing_auto.py", line 28, in <module>
    from ...image_processing_utils import ImageProcessingMixin
  File "/Users/me/.asdf/installs/python/3.12.3/lib/python3.12/site-packages/transformers/image_processing_utils.py", line 21, in <module>
    from .image_transforms import center_crop, normalize, rescale
  File "/Users/me/.asdf/installs/python/3.12.3/lib/python3.12/site-packages/transformers/image_transforms.py", line 49, in <module>
    import tensorflow as tf
  File "/Users/me/.asdf/installs/python/3.12.3/lib/python3.12/site-packages/tensorflow/__init__.py", line 47, in <module>
    from tensorflow._api.v2 import __internal__
  File "/Users/me/.asdf/installs/python/3.12.3/lib/python3.12/site-packages/tensorflow/_api/v2/__internal__/__init__.py", line 8, in <module>
    from tensorflow._api.v2.__internal__ import autograph
  File "/Users/me/.asdf/installs/python/3.12.3/lib/python3.12/site-packages/tensorflow/_api/v2/__internal__/autograph/__init__.py", line 8, in <module>
    from tensorflow.python.autograph.core.ag_ctx import control_status_ctx # line: 34
  File "/Users/me/.asdf/installs/python/3.12.3/lib/python3.12/site-packages/tensorflow/python/autograph/core/ag_ctx.py", line 21, in <module>
    from tensorflow.python.autograph.utils import ag_logging
  File "/Users/me/.asdf/installs/python/3.12.3/lib/python3.12/site-packages/tensorflow/python/autograph/utils/__init__.py", line 17, in <module>
    from tensorflow.python.autograph.utils.context_managers import control_dependency_on_returns
  File "/Users/me/.asdf/installs/python/3.12.3/lib/python3.12/site-packages/tensorflow/python/autograph/utils/context_managers.py", line 19, in <module>
    from tensorflow.python.framework import ops
  File "/Users/me/.asdf/installs/python/3.12.3/lib/python3.12/site-packages/tensorflow/python/framework/ops.py", line 46, in <module>
    from tensorflow.python import pywrap_tfe
  File "/Users/me/.asdf/installs/python/3.12.3/lib/python3.12/site-packages/tensorflow/python/pywrap_tfe.py", line 25, in <module>
    from tensorflow.python._pywrap_tfe import *
Traceback (most recent call last):
  File "/Users/me/.asdf/installs/python/3.12.3/lib/python3.12/site-packages/numpy/core/_multiarray_umath.py", line 44, in __getattr__
    raise ImportError(msg)
AlexCheema commented 1 month ago

It might be something about asdf. I'm using source install.sh to install from fresh (which uses venv) and works fine. Here are my installed packages:

(.venv) alex@Alexs-MBP exo % pip3 list                                           
Package                      Version
---------------------------- ---------
aiohttp                      3.9.5
aiohttp-cors                 0.7.0
aiosignal                    1.3.1
attrs                        23.2.0
blobfile                     2.1.1
certifi                      2024.7.4
charset-normalizer           3.3.2
exo                          0.0.1
filelock                     3.15.4
frozenlist                   1.4.1
fsspec                       2024.6.1
grpcio                       1.64.1
grpcio-tools                 1.64.1
hf_transfer                  0.1.8
huggingface-hub              0.24.5
idna                         3.7
Jinja2                       3.1.4
lxml                         4.9.4
markdown-it-py               3.0.0
MarkupSafe                   2.1.5
mdurl                        0.1.2
mlx                          0.16.0
mlx-lm                       0.16.1
multidict                    6.0.5
numpy                        2.0.0
packaging                    24.1
pillow                       10.4.0
pip                          24.0
prometheus_client            0.20.0
protobuf                     5.27.1
psutil                       6.0.0
pycryptodomex                3.20.0
Pygments                     2.18.0
pynvml                       11.5.3
pyobjc-core                  10.3.1
pyobjc-framework-Cocoa       10.3.1
pyobjc-framework-libdispatch 10.3.1
pyobjc-framework-Metal       10.3.1
PyYAML                       6.0.1
regex                        2024.7.24
requests                     2.32.3
rich                         13.7.1
safetensors                  0.4.3
sentencepiece                0.2.0
setuptools                   72.1.0
tiktoken                     0.7.0
tinygrad                     0.9.1
tokenizers                   0.19.1
tqdm                         4.66.4
transformers                 4.43.3
typing_extensions            4.12.2
urllib3                      2.2.2
uuid                         1.30
yarl                         1.9.4
hafezmg48 commented 1 month ago

I ran into similar issue when installing the tensorflow package for exo's venv. Apparently in my case, exo needs numpy 2. to work. But tensorflow cannot work with some numpy>=1.x.x and they conflict. For me I installed pytorch instead and it worked. I see in the error message of @bricolage that he is also using tensorflow so that might be the case.

To my knowledge, currently tensorflow does not work with exo due to the above reason. @AlexCheema

P.S. I am using a linux with CUDA gpu.