Searching Installed Packages

Date: April 2nd 2016
Last updated: April 2nd 2016

I've been having trouble installing statsmodels. I found this command line statement useful in seeing what versions I had installed with python 3.4.

python3 -c "from pkg_resources import Environment;print(Environment()['statsmodels'])"
# [statsmodels 0.6.1 (/usr/local/lib/python3.4/dist-packages)]

python3 -c "import numpy; print(numpy.version.version);";
# 1.8.2

pip3 show statsmodels
#---
#Name: statsmodels
#Version: 0.8.0
#Location: /usr/local/lib/python3.4/dist-packages/statsmodels-0.8.0-py3.4-linux-#x86_64.egg
#Requires:

For future reference: why statsmodels wasn't importing
No matter how many different ways I installed statsmodels - it failed. All dependencies are met and still not luck. The error message I was getting was: ImportError: numpy.core.multiarray failed to import.

When I looked at the directory locations for numpy and statsmodels I found out that they were sitting in different places. It didn't matter how many times I ran sudo pip3 install numpy --upgrade or any other upgrade it failed. The solution was to download from source and install using the python version I was using.

pip3 show statsmodels
#<- snipped ->
#/usr/local/lib/python3.4/dist-packages/statsmodels-0.8.0-\
#py3.4-linux-x86_64.egg
pip3 show numpy 
#<- snipped ->
#/usr/lib/python3/dist-packages

# I installed numpy from source
git clone git://github.com/numpy/numpy.git numpy
cd numpy
python3 setup.py install

pip3 show numpy 
#---
#Name: numpy
#Version: 1.12.0.dev0-2af06c8
#Location: /usr/local/lib/python3.4/dist-packages/\
#numpy-1.12.0.dev0_2af06c8-py3.4-linux-x86_64.egg

python3 (statsmodels.api import success)

import statsmodels.api as sm
sm
#<module 'statsmodels.api' from \
#'/usr/local/lib/python3.4/dist-packages/statsmodels-0.8.0-\
#py3.4-linux-x86_64.egg/statsmodels/api.py'>

Useful resources

results matching ""

    No results matching ""