JudyJiang
JudyJiang

Reputation: 2227

why python failed to use or upgrade package installed by pip?

This problem may seem simple to most of you but I'm really confused. I tried to install numpy & pandas using pip. So initially I just did:

sudo pip install pandas.

It installed successfully but when i tried:import pandas there's error as:

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Python/2.7/site-packages/pandas/__init__.py", line 7, in <module>
from . import hashtable, tslib, lib
File "pandas/src/numpy.pxd", line 157, in init pandas.hashtable (pandas/hashtable.c:22984)
ValueError: numpy.dtype has the wrong size, try recompiling

Then I assume it's the numpy version wrong (even pandas said installed a newer numpy) I tried to upgrade the numpy using "pip" but system reminded me don't have to.

As I checked, all my "pip" installed python packages are in /usr/local/lib/python2.7/site-package, in which the numpy version is 1.9.1 and pandas 0.15.1

When I do which python, it shows me the python path/usr/local/bin so I assume it's using the system patron and did installed all the packages accordingly

But when I typed in "python" in console, and tried:

import numpy as np
np.version.version

It showed 1.6.1 instead of 1.9.1 Seems it never gets upgraded or failed to use the numpy installed.

How should I fix this? Thanks

Upvotes: 0

Views: 991

Answers (1)

User456898
User456898

Reputation: 5724

Uninstall Numpy and then Re-install the newest version of it.

pip uninstall numpy

pip install numpy

I too was facing this problem earlier.

Upvotes: 1

Related Questions