-1

I'm new to python and programming. I referred multiple SO posts but couldn't able to resolve the issue.

Python version 3.6.4 :: Anaconda installation Operating system: macOS Sierra version 10.12.6

I can see numpy (pip installation) installed if I ran conda list in terminal but importing numpy in juypter rasing 'error 'AttributeError: module 'numpy' has no attribute 'version'

I referred this post: AttributeError: module 'numpy' has no attribute '__version__'

1st solution didn't work, 2nd TBH I din't follow, 3rd one when I try it shows juypter kernel is busy but nothing further happens.

Juypter error

AttributeError                            Traceback (most recent call last)
<ipython-input-9-d9ee79f53c9f> in <module>()
----> 1 import pandas as pd
      2 import numpy as np
      3 
      4 import statsmodels.api as sm
      5 import matplotlib.pyplot as plt

/anaconda3/lib/python3.6/site-packages/pandas/__init__.py in <module>()
     20 
     21 # numpy compat
---> 22 from pandas.compat.numpy import (
     23     _np_version_under1p14,
     24     _np_version_under1p15,

/anaconda3/lib/python3.6/site-packages/pandas/compat/numpy/__init__.py in <module>()
      7 
      8 # numpy versioning
----> 9 _np_version = np.__version__
     10 _nlv = LooseVersion(_np_version)
     11 _np_version_under1p14 = _nlv < LooseVersion("1.14")

AttributeError: module 'numpy' has no attribute '__version__'

Terminal showing bumpy installation numpy 1.18.3

M.D
  • 1
  • 1
  • 3

1 Answers1

0

Will need more information but in my opinion, when you are trying to import numpy it is conflicting with another file that you created with the name numpy.py. and instead of importing the module you are importing that file.

Try this to locate the file

>>> import numpy
>>> numpy.__file__

it should look something like this: \lib\\site-packages\\numpy\\__init__.py'

Kuldeep Singh Sidhu
  • 3,748
  • 2
  • 12
  • 22
  • Thanks Kuldeep. I didn't do anything and today importing numpy is not throwing error any more. But there seems to be another issue. Now **ModuleNotFoundError: No module named 'statsmodels.api'** error comes up even though statsmodel version 0.10.1 is installed installation. what other information do you need? – M.D Apr 25 '20 at 01:13