[Tutor] i installed the package statsmodels but i get an error when i use it

Steven D'Aprano steve at pearwood.info
Tue Dec 17 02:03:46 CET 2013


Hello Eva,

On Mon, Dec 16, 2013 at 05:56:36PM +0100, eva maria gualandi wrote:
[...]
> but unfortunately i get the following error message:
> 
> Traceback (most recent call last):
>   File "C:\Python27\esempio_adftest.py", line 3, in <module>
>     from statsmodels.tsa import stattools
[...]
>     from pandas import DataFrame
>   File "C:\Python27\lib\site-packages\pandas\__init__.py", line 15, in
> <module>
>     raise ImportError('C extensions not built: if you installed already '
> ImportError: C extensions not built: if you installed already verify that
> you are not importing from the source directory

My first answer was to say that it looks like pandas is not installed 
correctly, but now I'm not too sure.

> the thing that i really don't understand is that in the shell window if i
> type import statsmodels.tsa i don't get any error, 

What happens if you enter

from statsmodels.tsa import stattools

instead?

Importing of packages in Python may be done lazily, just because 
statsmodels.tsa imports successfully does not necessarily mean that 
statsmodels.tsa.stattools will be available, even if it shows up in the 
help file.

If may also help if you put these few lines at the beginning of your 
script, for diagnosis:

import os
print os.getcwd()
print os.listdir(r"C:\Python27\lib\site-packages\pandas")


What output do these generate? This may help us diagnose whether you are 
running from the pandas source directory.



-- 
Steven


More information about the Tutor mailing list