Natu Myers
Natu Myers

Reputation: 496

Sklearn will not run/compile due to numpy errors

I would not be posting this question if I had not researched this problem thoroughly. I run python server.py (it uses sklearn). Which gives me

Traceback (most recent call last):
  File "server.py", line 34, in <module>
    from lotusApp.lotus import lotus
  File "/Users/natumyers/Desktop/.dev/qq/lotusApp/lotus.py", line 2, in <module>
    from sklearn import datasets
  File "/Library/Python/2.7/site-packages/sklearn/__init__.py", line 57, in <module>
    from .base import clone
  File "/Library/Python/2.7/site-packages/sklearn/base.py", line 11, in <module>
    from .utils.fixes import signature
  File "/Library/Python/2.7/site-packages/sklearn/utils/__init__.py", line 10, in <module>
    from .murmurhash import murmurhash3_32
  File "numpy.pxd", line 155, in init sklearn.utils.murmurhash (sklearn/utils/murmurhash.c:5029)
ValueError: numpy.dtype has the wrong size, try recompiling

I next do everything I can, nothing helps.

I ran:

sudo -H pip uninstall numpy
sudo -H pip uninstall pandas

sudo -H pip install numpy
sudo -H pip install pandas

All which give me errors such as OSError: [Errno 1] Operation not permitted:

I try sudo -H easy_install --upgrade numpy

I get a list of errors like

_configtest.c:13:5: note: 'ctanl' is a builtin with type '_Complex long double (_Complex long double)'
_configtest.c:14:5: warning: incompatible redeclaration of library function 'cpowl' [-Wincompatible-library-redeclaration]
int cpowl (void);
    ^

Edit: Perhaps part of the issue was that I wasn't running the virtual environment. So I get that going, and when I type python server.py, I get error:

from sklearn import datasets
ImportError: No module named sklearn

sudo -H pip install -U scikit-learn Doesn't install because of another error....

Upvotes: 0

Views: 141

Answers (1)

Natu Myers
Natu Myers

Reputation: 496

I was using depreciated python. I updated everything to python 3, and used pip3.

Upvotes: 1

Related Questions