본문 바로가기

Error and Solve

[에러 해결] AttributeError: module 'numpy.typing' has no attribute 'NDArray' / pip install numpy==1.21.0

반응형

 

 

 

AttributeError: module 'numpy.typing' has no attribute 'NDArray'

 

 

   NumpyArray = npt.NDArray[Any]
AttributeError: module 'numpy.typing' has no attribute 'NDArray'

 

 

 

 

numpy 패키지에서 NDArray를 찾을수 없다는 에러가 떴다

 

 

 

 

pip install numpy==1.21.0

 

 

numpy.typing에서 ndarray를 지원하려면 1.21 이상 버전이어야 한다 

 

원래 numpy 1.20을 쓰고 있었는데, pip uninstall 후 설치해주었다 

 

 

pip uninstall numpy 
pip install numpy==1.21.0

pip uninstall numpy 
pip install numpy==1.21.0

 

 

 

 

numpy.typing에서 ndarray 지원 중 

 

 

 

다시 실행해보니까 돌아간다!

 

 

 

 

 

 

 


 

Reference

 

https://rum-j.tistory.com/116

 

[해결] ImportError: cannot import name 'NDArray' from 'numpy.typing'

Error message ImportError: cannot import name 'NDArray' from 'numpy.typing' (/opt/conda/lib/python3.7/site-packages/numpy/typing/init.py)환경: Ubuntu 20.04, python 3.7, numpy 1.20.2사용 목적: mmdetection 프레임워크에서 모델 추론 전달

rum-j.tistory.com

 

https://github.com/numpy/numpy/blob/9e43697124aa7b854f6515b189233286f6a305d7/numpy/_typing/_array_like.py#L33

 

numpy/numpy/_typing/_array_like.py at 9e43697124aa7b854f6515b189233286f6a305d7 · numpy/numpy

The fundamental package for scientific computing with Python. - numpy/numpy

github.com

 

 

 

반응형