numpy version #219

Open
opened 2026-01-29 21:45:47 +00:00 by claunia · 5 comments
Owner

Originally created by @cvonk on GitHub (Jul 31, 2022).

There appears to be an inconsistency with the numpy version required.

With no numpy installed, running pip install basicsr returns

Collecting basicsr
Using cached basicsr-1.4.1-py3-none-any.whl
Requirement already satisfied: scipy in c:\program files\python310\lib\site-packages (from basicsr) (1.9.0)
Requirement already satisfied: tb-nightly in c:\program files\python310\lib\site-packages (from basicsr) (2.10.0a20220730)
Collecting numpy>=1.17
Using cached numpy-1.23.1-cp310-cp310-win_amd64.whl (14.6 MB)
:
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
realesrgan 0.2.5.0 requires facexlib>=0.2.0.3, which is not installed.
gfpgan 1.3.4 requires facexlib>=0.2.3, which is not installed.
gfpgan 1.3.4 requires numpy<1.23, but you have numpy 1.23.1 which is incompatible.

I then tried pre installing numpy 1.20.3 (pip install numpy==1.20.3), but that fails with

note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for numpy
Failed to build numpy
ERROR: Could not build wheels for numpy, which is required to install pyproject.toml-based projects

GFPGAN's requirements.txt contains

numpy<1.21 # numba requires numpy<1.21,>=1.17

But the numba install instructions reads

Numba is compatible with Python 3.7–3.10, and Numpy versions 1.18 up to 1.22.

So .. I install numby 1.22.3 instead. (pip install numpy==1.22.3)

Now I can run pip install basicsr, pip install facexlib

I update GFPGAN's requirements.txt accordingly, and run python setup.py develop and pip install realesrgan and download the models.

All looking good. Until I run python inference_gfpgan.py ...

C:\Program Files\Python310\lib\site-packages\basicsr\utils\diffjpeg.py:19: UserWarning: Failed to initialize NumPy: module compiled against API version 0x10 but this version of numpy is 0xf (Triggered internally at ..\torch\csrc\utils\tensor_numpy.cpp:68.)

Seems like diffjpeg.py insists on numpy API version 0x10, probably available in >= 1.23.

Environment: Windows 11, installed Python 3.10.5 for all users. GFPGAN release v1.3.4

Please advise

Originally created by @cvonk on GitHub (Jul 31, 2022). There appears to be an inconsistency with the `numpy` version required. With no numpy installed, running `pip install basicsr` returns > Collecting basicsr > Using cached basicsr-1.4.1-py3-none-any.whl > Requirement already satisfied: scipy in c:\program files\python310\lib\site-packages (from basicsr) (1.9.0) > Requirement already satisfied: tb-nightly in c:\program files\python310\lib\site-packages (from basicsr) (2.10.0a20220730) > Collecting numpy>=1.17 > Using cached numpy-1.23.1-cp310-cp310-win_amd64.whl (14.6 MB) > : > ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts. > realesrgan 0.2.5.0 requires facexlib>=0.2.0.3, which is not installed. > gfpgan 1.3.4 requires facexlib>=0.2.3, which is not installed. > gfpgan 1.3.4 requires numpy<1.23, but you have numpy 1.23.1 which is incompatible. I then tried pre installing numpy 1.20.3 (`pip install numpy==1.20.3`), but that fails with > note: This error originates from a subprocess, and is likely not a problem with pip. > ERROR: Failed building wheel for numpy > Failed to build numpy > ERROR: Could not build wheels for numpy, which is required to install pyproject.toml-based projects GFPGAN's `requirements.txt` contains > numpy<1.21 # numba requires numpy<1.21,>=1.17 But the [numba install instructions](https://numba.readthedocs.io/en/stable/user/installing.html?highlight=numpy#compatibility) reads > Numba is compatible with Python 3.7–3.10, and Numpy versions 1.18 up to 1.22. So .. I install numby 1.22.3 instead. (`pip install numpy==1.22.3`) Now I can run `pip install basicsr`, `pip install facexlib` I update GFPGAN's `requirements.txt` accordingly, and run `python setup.py develop` and `pip install realesrgan` and download the models. All looking good. Until I run `python inference_gfpgan.py ...` > C:\Program Files\Python310\lib\site-packages\basicsr\utils\diffjpeg.py:19: UserWarning: Failed to initialize NumPy: module compiled against API version 0x10 but this version of numpy is 0xf (Triggered internally at ..\torch\csrc\utils\tensor_numpy.cpp:68.) Seems like `diffjpeg.py` insists on numpy API version 0x10, probably available in >= 1.23. Environment: Windows 11, installed Python 3.10.5 for all users. [GFPGAN](https://github.com/TencentARC/GFPGAN) release [v1.3.4](https://github.com/TencentARC/GFPGAN/releases/tag/v1.3.4) Please advise
Author
Owner

@Timuryaka commented on GitHub (Aug 10, 2022):

Hello, did you manage to fix this problem? I'm 100% noob, that's my first installation so no way I can fix this myself :(
I can't pip install -r requirements.txt ,
mistake - note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for numpy
Failed to build numpy
ERROR: Could not build wheels for numpy, which is required to install pyproject.toml-based projects

@Timuryaka commented on GitHub (Aug 10, 2022): Hello, did you manage to fix this problem? I'm 100% noob, that's my first installation so no way I can fix this myself :( I can't `pip install -r requirements.txt` , mistake - note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for numpy Failed to build numpy ERROR: Could not build wheels for numpy, which is required to install pyproject.toml-based projects
Author
Owner

@276562578 commented on GitHub (Aug 15, 2022):

same issue

@276562578 commented on GitHub (Aug 15, 2022): same issue
Author
Owner

@cvonk commented on GitHub (Aug 15, 2022):

I followed the instructions from the README.md, but didn't get it to work. Tried some workarounds, but still no success. I am not a python person, so maybe some body else can comment.
To me, the library conflicts appear related to the sheer number of libraries used. E.g. for some libraries a maximum version number is specified, but that conflict with other libraries. Also diffjpeg.py replies on an old numpy API version.

@cvonk commented on GitHub (Aug 15, 2022): I followed the instructions from the README.md, but didn't get it to work. Tried some workarounds, but still no success. I am not a python person, so maybe some body else can comment. To me, the library conflicts appear related to the sheer number of libraries used. E.g. for some libraries a maximum version number is specified, but that conflict with other libraries. Also `diffjpeg.py` replies on an old `numpy` API version.
Author
Owner

@clort81 commented on GitHub (Oct 17, 2022):

Python kids love NEW things. Everything has to be NEW and API incompatible every few months.
NEW = Nothing Ever Works.
This has led to all kinds of attempts to fix the situation but the tl;dr of it all is that to get a complex python project running, you need an image of the exact OS the authors use, all library versions must match. This is the cause of all the containerization we see.
It's a pox.

@clort81 commented on GitHub (Oct 17, 2022): Python kids love NEW things. Everything has to be NEW and API incompatible every few months. NEW = Nothing Ever Works. This has led to all kinds of attempts to fix the situation but the tl;dr of it all is that to get a complex python project running, you need an image of the exact OS the authors use, all library versions must match. This is the cause of all the containerization we see. It's a pox.
Author
Owner

@georgezouq commented on GitHub (Aug 24, 2023):

same issue

@georgezouq commented on GitHub (Aug 24, 2023): same issue
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: TencentARC/GFPGAN#219