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

numpy version conflicts #461

Closed
huangjundashuaige opened this issue May 20, 2022 · 6 comments
Closed

numpy version conflicts #461

huangjundashuaige opened this issue May 20, 2022 · 6 comments

Comments

@huangjundashuaige
Copy link

install from setup.py (numpy version 1.21.6)

~/alpa$ python3 tests/test_install.py
RuntimeError: module compiled against API version 0xf but this version of numpy is 0xe

after install numpy=1.22.0

python3 tests/test_install.py
Traceback (most recent call last):
  File "tests/test_install.py", line 13, in <module>
    from alpa import (init, parallelize, grad, ShardParallel, automatic_layer_construction,
  File "/home/ubuntu/alpa/alpa/__init__.py", line 1, in <module>
    from alpa.api import (init, shutdown, parallelize, grad, value_and_grad,
  File "/home/ubuntu/alpa/alpa/api.py", line 15, in <module>
    from alpa.parallel_method import ParallelMethod, ShardParallel
  File "/home/ubuntu/alpa/alpa/parallel_method.py", line 26, in <module>
    from alpa.pipeline_parallel.compile_executable import compile_pipeshard_executable
  File "/home/ubuntu/alpa/alpa/pipeline_parallel/compile_executable.py", line 27, in <module>
    from alpa.pipeline_parallel.stage_construction import (
  File "/home/ubuntu/alpa/alpa/pipeline_parallel/stage_construction.py", line 10, in <module>
    import numba
  File "/home/ubuntu/.local/lib/python3.8/site-packages/numba/__init__.py", line 200, in <module>
    _ensure_critical_deps()
  File "/home/ubuntu/.local/lib/python3.8/site-packages/numba/__init__.py", line 140, in _ensure_critical_deps
    raise ImportError("Numba needs NumPy 1.21 or less")
ImportError: Numba needs NumPy 1.21 or less

I disable numba importerror in the end and passed this test, was wondering what would be the potential problems.

@zhisbug
Copy link
Member

zhisbug commented May 20, 2022

Thank you. Could you try numpy==1.19.5 first. We'll fix this shortly

@huangjundashuaige
Copy link
Author

Successfully installed numpy-1.19.5
:~/alpa$ python3 tests/test_install.py
RuntimeError: module compiled against API version 0xf but this version of numpy is 0xd
ImportError: numpy.core._multiarray_umath failed to import
ImportError: numpy.core.umath failed to import
2022-05-20 21:57:35.710782: F external/org_tensorflow/tensorflow/compiler/xla/python/xla.cc:83] Check failed: tensorflow::RegisterNumpyBfloat16() 
Aborted (core dumped)

this is the error after install numpy==1.19.5

not sure which module "compiled against API version 0xf " of numpy, I guess "0xf" means numpy==1.22.

@zhisbug
Copy link
Member

zhisbug commented May 23, 2022

try numpy==1.20?

@merrymercy
Copy link
Member

I use numpy==1.20.3 and tensorflow==2.8.0

After installing numpy, please recompile jaxlib or tensorflow again

@marwage
Copy link

marwage commented Jun 8, 2022

Hi, I had the same issue and I fixed it by removing the version requirement from numpy in setup.py

alpa/setup.py

Line 88 in 3995d72

"numpy<1.22",

My current version is numpy==1.22.4. I hope that helps others too.

@zhisbug
Copy link
Member

zhisbug commented Jun 10, 2022

@huangjundashuaige Hello, has your issue been addressed?

It is because, during the compilation of jaxlib, a higher version of numpy is used, but when running Alpa, a lower version of numpy is used.

This is possible to happen because when running pip install cupy-cuda11x, pip will resolve the dependency and install a newer version of numpy (>1.22)

But alpa's setup.py declares numpy<1.22.

We have addressed this issue via PR #492 and PR #499

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

No branches or pull requests

4 participants