AttributeError type object numpy ndarray has no attribute array function

0 votes

Hi Guys,

I installed numpy module in my system. But when I tried to import this module in python prompt, I got this error.

>>>import numpy
 Traceback (most recent call last):
      File "/home/trey/script.py", line 6, in <module>
        import numpy as np
      File "/home/trey/.local/lib/python3.6/site-packages/numpy/__init__.py", line 142, in <module>
        from . import core
      File "/home/trey/.local/lib/python3.6/site-packages/numpy/core/__init__.py", line 59, in <module>
        from . import numeric
      File "/home/trey/.local/lib/python3.6/site-packages/numpy/core/numeric.py", line 3093, in <module>
        from . import fromnumeric
      File "/home/trey/.local/lib/python3.6/site-packages/numpy/core/fromnumeric.py", line 17, in <module>
        from . import _methods
      File "/home/trey/.local/lib/python3.6/site-packages/numpy/core/_methods.py", line 158, in <module>
        _NDARRAY_ARRAY_FUNCTION = mu.ndarray.__array_function__
    AttributeError: type object 'numpy.ndarray' has no attribute '__array_function__'

How can I solve this error?

Apr 13, 2020 in Python by akhtar
• 38,260 points
14,720 views

1 answer to this question.

0 votes

Hi@akhtar,

I think numpy version is not compatible with python. So try to upgrade your numpy module using the below given command.

$ pip3 install --upgrade numpy
Installing collected packages: numpy
Successfully installed numpy-1.16.0
$ python3 
Python 3.5.2 (default, Apr 13 2020, 13:01:14) 
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
>>> 

Hope this will help.

answered Apr 13, 2020 by MD
• 95,460 points

Related Questions In Python

0 votes
1 answer

AttributeError: 'numpy.ndarray' object has no attribute 'append'

Hi@Nilesh, You created two empty lists. And in ...READ MORE

answered Aug 11, 2020 in Python by MD
• 95,460 points
3,260 views
0 votes
1 answer

AttributeError: 'numpy.ndarray' object has no attribute 'append'

Hi@Nilesh, You have created two empty lists. And ...READ MORE

answered Aug 11, 2020 in Python by MD
• 95,460 points
6,378 views
0 votes
1 answer

AttributeError: type object 'DataFrame' has no attribute 'from_items'

Hi, @Bronson, You can go through this, I ...READ MORE

answered Apr 6, 2020 in Python by Gitika
• 65,770 points
5,313 views
+1 vote
1 answer

'numpy.ndarray' object has no attribute 'append'

Hi@Noman, You created two empty list. And in ...READ MORE

answered May 17, 2020 in Python by MD
• 95,460 points
8,160 views
0 votes
1 answer

How to rename columns in pandas (Python)?

You can use the rename function in ...READ MORE

answered Apr 30, 2018 in Data Analytics by DeepCoder786
• 1,720 points

edited Jun 8, 2020 by MD 2,059 views
0 votes
1 answer

What is the Difference in Size and Count in pandas (python)?

The major difference is "size" includes NaN values, ...READ MORE

answered Apr 30, 2018 in Data Analytics by DeepCoder786
• 1,720 points

edited Jun 8, 2020 by Gitika 2,860 views
0 votes
2 answers

Replacing a row in pandas data.frame

key error. I love python READ MORE

answered Feb 18, 2019 in Data Analytics by anonymous
13,743 views
0 votes
1 answer

Converting a pandas data-frame to a dictionary

Emp_dict=Employee.to_dict('records') You can directly use the 'to_dict()' function ...READ MORE

answered May 23, 2018 in Data Analytics by Bharani
• 4,660 points
4,577 views
0 votes
3 answers

AttributeError: 'numpy.ndarray' object has no attribute 'append'

for root, dirs, files in os.walk(directory): ...READ MORE

answered Dec 12, 2020 in Python by Rajiv
• 8,870 points
52,889 views
+1 vote
1 answer

AttributeError: 'numpy.ndarray' object has no attribute 'append'

Hi, You created two empty list. And in ...READ MORE

answered May 17, 2020 in Python by MD
• 95,460 points
5,491 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP