Jason
Jason

Reputation: 4546

ImportError: No module named lib. Unable to import pandas, numpy, scipy, matplotlib

I recently updated a number of packages and my version of EPD Canopy (to1.4.1.1975) and now I'm unable to import pandas, numpy, scipy or matplotlib. I get the ImportError below. I've also tried importing from the command prompt but I can the same error.

pandas - 0.14.0-1 numpy - 1.8.0-2 scipy - 0.14.0-1 matplotlib - 1.3.1-8

Does anybody have any suggestions as to how I could fix this? From this Stackoverflow question it seems like I might need to change/move something to a different directory. Could somebody explain how I could go about this? This documentation was suggested but I'm not sure how to adapt this for my situation.

import pandas as pd

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-3-af55e7023913> in <module>()
----> 1 import pandas as pd

C:\Users\AppData\Local\Enthought\Canopy32\User\lib\site-packages\pandas\__init__.py in <module>()
     10     print(e)
     11     if 'No module named lib' in str(e):
---> 12         raise ImportError('C extensions not built: if you installed already '
     13                           'verify that you are not importing from the source '
     14                           'directory')

ImportError: C extensions not built: if you installed already verify that you are not importing from the source directory

No module named lib

Upvotes: 1

Views: 4128

Answers (1)

Jonathan March
Jonathan March

Reputation: 5810

Looks like something in your Canopy User Python environment has gotten corrupted. Easiest solution would be to delete this directory:

C:\Users\AppData\Local\Enthought\Canopy32\User\

(are you sure that's it?? Normally your user name would be between Users\ and AppData. Or did you just remove that from your question for privacy? -- in that case, better to replace it in your message with <my user name> to avoid confusion.)

and then restart Canopy. Any packages that you have updated or installed will need to be re-installed (except of course for the ones that were already updated in Canopy 1.4.1, which is very many.)

Upvotes: 1

Related Questions