Numpy is not available #177

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

Originally created by @s1u on GitHub (Mar 21, 2022).

win 11
python 3.10
numba 0.55.1
numpy 1.21.5

运行 python inference_gfpgan.py -i inputs/whole_imgs -o results -v 1.3 -s 2
后提示

\Python310\lib\site-packages\torch\_masked\__init__.py:223: UserWarning: Failed to initialize NumPy: module compiled against API version 0xf but this version of numpy is 0xe (Triggered internally at  ..\torch\csrc\utils\tensor_numpy.cpp:68.)
  example_input = torch.tensor([[-3, -2, -1], [0, 1, 2]])
Traceback (most recent call last):
  File "C:\Users\Steph\App\GFPGAN\inference_gfpgan.py", line 7, in <module>
    from basicsr.utils import imwrite
  File "C:\Users\Steph\AppData\Local\Programs\Python\Python310\lib\site-packages\basicsr\__init__.py", line 3, in <module>
    from .archs import *
  File "C:\Users\Steph\AppData\Local\Programs\Python\Python310\lib\site-packages\basicsr\archs\__init__.py", line 5, in <module>
    from basicsr.utils import get_root_logger, scandir
  File "C:\Users\Steph\AppData\Local\Programs\Python\Python310\lib\site-packages\basicsr\utils\__init__.py", line 1, in <module>
    from .diffjpeg import DiffJPEG
  File "C:\Users\Steph\AppData\Local\Programs\Python\Python310\lib\site-packages\basicsr\utils\diffjpeg.py", line 19, in <module>
    y_table = nn.Parameter(torch.from_numpy(y_table))
RuntimeError: Numpy is not available`
Originally created by @s1u on GitHub (Mar 21, 2022). win 11 python 3.10 numba 0.55.1 numpy 1.21.5 运行 `python inference_gfpgan.py -i inputs/whole_imgs -o results -v 1.3 -s 2` 后提示 ```` \Python310\lib\site-packages\torch\_masked\__init__.py:223: UserWarning: Failed to initialize NumPy: module compiled against API version 0xf but this version of numpy is 0xe (Triggered internally at ..\torch\csrc\utils\tensor_numpy.cpp:68.) example_input = torch.tensor([[-3, -2, -1], [0, 1, 2]]) Traceback (most recent call last): File "C:\Users\Steph\App\GFPGAN\inference_gfpgan.py", line 7, in <module> from basicsr.utils import imwrite File "C:\Users\Steph\AppData\Local\Programs\Python\Python310\lib\site-packages\basicsr\__init__.py", line 3, in <module> from .archs import * File "C:\Users\Steph\AppData\Local\Programs\Python\Python310\lib\site-packages\basicsr\archs\__init__.py", line 5, in <module> from basicsr.utils import get_root_logger, scandir File "C:\Users\Steph\AppData\Local\Programs\Python\Python310\lib\site-packages\basicsr\utils\__init__.py", line 1, in <module> from .diffjpeg import DiffJPEG File "C:\Users\Steph\AppData\Local\Programs\Python\Python310\lib\site-packages\basicsr\utils\diffjpeg.py", line 19, in <module> y_table = nn.Parameter(torch.from_numpy(y_table)) RuntimeError: Numpy is not available`
Author
Owner

@atharva-hude-automatonai commented on GitHub (Apr 8, 2022):

TRY THIS
pip install numpy --upgrade

@atharva-hude-automatonai commented on GitHub (Apr 8, 2022): TRY THIS pip install numpy --upgrade
Author
Owner

@GBCam commented on GitHub (Apr 8, 2022):

TRY THIS pip install numpy --upgrade

Also having the same issue. Console stated that the latest version of numpy was incompatible and needed a version less than 1.21, so I installed 1.20 using pip install numpy==1.20 and I also get basically the same error as above.

Tried again and it seems to be working now.

@GBCam commented on GitHub (Apr 8, 2022): > TRY THIS pip install numpy --upgrade ~~Also having the same issue. Console stated that the latest version of numpy was incompatible and needed a version less than 1.21, so I installed 1.20 using pip install numpy==1.20 and I also get basically the same error as above~~. Tried again and it seems to be working now.
Author
Owner

@soulteary commented on GitHub (May 20, 2022):

@S1U , @GBCam There is no need to waste time on tossing the environment, try

https://github.com/TencentARC/GFPGAN/issues/194

@soulteary commented on GitHub (May 20, 2022): @S1U , @GBCam There is no need to waste time on tossing the environment, try https://github.com/TencentARC/GFPGAN/issues/194
Author
Owner

@delcompan commented on GitHub (Jun 28, 2022):

numpy版本高了
requirement.txt里面有说明啊!
numpy<1.21  # numba requires numpy<1.21,>=1.17

@delcompan commented on GitHub (Jun 28, 2022): numpy版本高了 requirement.txt里面有说明啊! numpy<1.21  # numba requires numpy<1.21,>=1.17
Author
Owner

@lozn00 commented on GitHub (Apr 8, 2023):

pip install requiemenet没啥用 ,pip install numpy --upgrade 好像太大了,我改成 pip install pip install numpy==1.23.5 貌似解决了

@lozn00 commented on GitHub (Apr 8, 2023): pip install requiemenet没啥用 ,pip install numpy --upgrade 好像太大了,我改成 pip install pip install numpy==1.23.5 貌似解决了
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: TencentARC/GFPGAN#177