0

I want to use the array method from the numpy package, but I get an attribute error and it says that there is no method called array. what is the problem?

import numpy as np

x = [2, 3, 4, 6, 7, 9]
y = np.array(x)
print(y)

AttributeError: partially initialized module 'numpy' has no attribute 'array' (most likely due to a circular import)

James Westgate
  • 11,306
  • 8
  • 61
  • 68
Mohammad
  • 1
  • 3

1 Answers1

1

A way to debug this behaviour is to print the origin of the file that you are importing:

import numpy as np
print(np.__file__)

This will return the path of your imported package and you could realise that it is not the one you intended to import.