How to fix AttributeError: module 'numpy' has no attribute 'square'
84,566
I removed numpy.py then updated my numpy and it worked!
Related videos on Youtube
Author by
Hoda Fakharzadeh
Updated on January 21, 2020Comments
-
Hoda Fakharzadeh over 4 years
I have updated numpy to 1.14.0. I use Windows 10. I tried to run my code and I got this error:
AttributeError: module 'numpy' has no attribute 'square'
Here are my imports:
%matplotlib inline import matplotlib.pyplot as plt import tensorflow as tf import numpy as np from sklearn.metrics import confusion_matrix import math
-
user2357112 over 6 yearsIf you called a file
numpy.py
, pick a different name (and delete the correspondingnumpy.pyc
if there is one). -
ShpielMeister over 6 yearsshow the entire code and the entire error
-
Hoda Fakharzadeh over 6 years@user2357112 I did as u said but my new error is :
module 'numpy' has no attribute '__version__'
-
mikey about 4 yearsI got this error when loading
matplotlib
-
-
Ryan over 5 yearsI ran
conda update --all
,pip uninstall -y numpy
,pip uninstall -y setuptools
,pip install setuptools==39.1.0
, andpip install numpy
and that seemed to solve that error about "'numpy' has no attribute 'square'". -
Shibani over 4 yearsThe above solution works, except that I didn't hardcode the version. uninstalling numpy and scipy, and just re-installing them.