DATA ANALYSIS/Python 오류 해결

[오류 해결/numpy 버전 확인] TypeError: ufunc 'isfinite' not supported for the input types! The signature was () -> unhandle 오류 해결

쏘니(SSony) 2023. 5. 9. 10:21
from keras.models import Sequential
from keras.layers import Dense, Activation
from keras.layers import LSTM, GRU
from tensorflow.keras.callbacks import EarlyStopping

import itertools

import sklearn.gaussian_process as gp

 

keras를 import하는 과정에서 오류가 발생했다.

사실은 처음부터 오류가 발생한 것이 아니라, 코딩을 하는 과정에서 여러 라이브러리를 install 하는 과정에서 발생했다.

설치가 잘 안 되는 경우에는 'pip install --user ~~' 등의 명령어를 쓰다보면 이미 깔려 있는 라이브러리가 uninstall 되기도, 버전이 바뀌기도 한다.

그럴 경우 발생하는 에러다.

 

 

TypeError: ufunc 'isfinite' not supported for the input types! The signature was () -> unhandle

 

 

해결방법은 간단하면서도 간단하지 않다.

 

pip install numpy==1.24

 

numpy 버전이 맞지 않을 때, 이러한 오류가 자주 발생한다고 한다.

기존에 깔았던 버전이었던 numpy 1.24를 다시 깔고 restart하면 된다.

 

 

print(numpy.version.version)

 

이 코드를 통해 현재 install 된 numpy의 버전을 확인할 수 있다.