python 3 + statsmodels?
Asked Answered
H

1

14

If I do sudo pip3 install statsmodels I get errors. I pasted the end of the console output below. I see a numpy 1.7 warning, yet if I do pip3 freeze | grep numpy, I see that I'm using numpy==1.8.1.

Here is the output. any ideas?

/usr/lib/python3/dist-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:15:2: warning: #warning "Using deprecated NumPy API, disable it by " "#defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]

 #warning "Using deprecated NumPy API, disable it by " \

  ^

statsmodels/tsa/kalmanf/kalman_loglike.c: In function ‘__Pyx_TraceSetupAndCall’:

statsmodels/tsa/kalmanf/kalman_loglike.c:7021:17: error: ‘PyFrameObject’ has no member named ‘f_tstate’

         (*frame)->f_tstate = PyThreadState_GET();

                 ^

In file included from /usr/lib/python3/dist-packages/numpy/core/include/numpy/ndarrayobject.h:26:0,

                 from /usr/lib/python3/dist-packages/numpy/core/include/numpy/arrayobject.h:4,

                 from statsmodels/tsa/kalmanf/kalman_loglike.c:257:

statsmodels/tsa/kalmanf/kalman_loglike.c: At top level:

/usr/lib/python3/dist-packages/numpy/core/include/numpy/__multiarray_api.h:1629:1: warning: ‘_import_array’ defined but not used [-Wunused-function]

 _import_array(void)

 ^

In file included from /usr/lib/python3/dist-packages/numpy/core/include/numpy/ufuncobject.h:327:0,

                 from statsmodels/tsa/kalmanf/kalman_loglike.c:258:

/usr/lib/python3/dist-packages/numpy/core/include/numpy/__ufunc_api.h:241:1: warning: ‘_import_umath’ defined but not used [-Wunused-function]

 _import_umath(void)

 ^

error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

----------------------------------------
Cleaning up...
Command /usr/bin/python3 -c "import setuptools, tokenize;__file__='/tmp/pip_build_root/statsmodels/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-ukof84o0-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip_build_root/statsmodels
Storing debug log for failure in /home/kurt/.pip/pip.log
Hoashis answered 28/4, 2014 at 14:16 Comment(3)
I mean, from that output, it looks like there's a bug in their C code extensions.Lemcke
which python 3? python 3.4 requires the latest cython release, and you need to rebuild all cython extensions in statsmodels. python 3.2 and 3.3 should work without problems and has been working without problems for a long time. python 3.4 will be supported in the next statsmodels release.Sillabub
That is how I fixed the problem. I'm on Ubuntu 14.04 which comes with python 3.4. I did find -name '*.pyx' to find each Cython file and ran cython3 -a on each (there were only 3 files).Peel
C
16

As best I can tell, statsmodels 0.5.0 simply doesn't work with Python 3.4, even with Cython 0.20.1 (latest) installed. The latest master installed fine, however, so here's one approach if you're willing to use an unreleased version:

git clone https://github.com/statsmodels/statsmodels
cd statsmodels
pip install .

Update: This shouldn't be necessary using the latest version - see Rasmus Larsen's comment below.

Casa answered 7/5, 2014 at 13:23 Comment(3)
You could also try pip3 install git+git://github.com/statsmodels/statsmodels, which has the benefit that you don't need to clone the repository. Then to upgrade to the latest version you would type: pip3 install --upgrade git+git://github.com/statsmodels/statsmodelsDang
For future readers use statsmodels 0.6.0 which supports python 3.4: statsmodels.sourceforge.net/binariesMillihenry
Thanks for pip install . which worked for me where the installation part of python setup.py build and python setup.py install hadn't.Apivorous

© 2022 - 2024 — McMap. All rights reserved.