'AttributeError: 'module' object has no attribute 'version'

I am working on learning how to use pandas but get the following error:

Traceback (most recent call last):
  File "data_frame.py", line 2, in <module>
    import pandas as pd
  File "/Users/gregwinter/anaconda2/lib/python2.7/site-packages/pandas/__init__.py", line 13, in <module>
    __import__(dependency)
  File "/Users/gregwinter/numpy.py", line 22, in <module>
    from pandas.compat.numpy_compat import *
  File "/Users/gregwinter/anaconda2/lib/python2.7/site-packages/pandas/compat/numpy_compat.py", line 15, in <module>
    _np_version = np.version.short_version
AttributeError: 'module' object has no attribute 'version'

I have no idea how to fix this. Anything you can tell be on how to fix this would be great.



Solution 1:[1]

I experienced this same problem after upgrading Jupyter, but did not have a local file named numpy.py. I was able to fix the issue on an Anaconda build by uninstalling/reinstalling pandas using: conda remove pandas and then conda install pandas

Problem was fixed.

Solution 2:[2]

I meet the some error, but the error for my situation is in mmcv library. I solve it with

pip install --upgrade packaging

here is reference link, hope this could help you.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 mdgis
Solution 2 J.Zhao