Issue
I installed scikit-learn using pip:
sudo pip install -U numpy scipy scikit-learn
When I ran it in python (2), it worked fine:
adamg:~ adamg$ python
Python 2.7.9 (default, Feb 10 2015, 03:28:08)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.56)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from sklearn import datasets
>>>
However, I got the following error in python 3:
adamg:~ adamg$ python3
Python 3.4.2 (default, Feb 10 2015, 03:38:22)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.56)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from sklearn import datasets
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.4/site-packages/sklearn/datasets/__init__.py", line 7, in <module>
from .base import load_diabetes
File "/usr/local/lib/python3.4/site-packages/sklearn/datasets/base.py", line 24, in <module>
from ..utils import check_random_state
File "/usr/local/lib/python3.4/site-packages/sklearn/utils/__init__.py", line 16, in <module>
from .class_weight import compute_class_weight, compute_sample_weight
File "/usr/local/lib/python3.4/site-packages/sklearn/utils/class_weight.py", line 7, in <module>
from ..utils.fixes import in1d
File "/usr/local/lib/python3.4/site-packages/sklearn/utils/fixes.py", line 318, in <module>
from scipy.sparse.linalg import lsqr as sparse_lsqr
File "/usr/local/lib/python3.4/site-packages/scipy/sparse/linalg/__init__.py", line 109, in <module>
from .isolve import *
File "/usr/local/lib/python3.4/site-packages/scipy/sparse/linalg/isolve/__init__.py", line 6, in <module>
from .iterative import *
File "/usr/local/lib/python3.4/site-packages/scipy/sparse/linalg/isolve/iterative.py", line 7, in <module>
from . import _iterative
ImportError: dlopen(/usr/local/lib/python3.4/site-packages/scipy/sparse/linalg/isolve/_iterative.so, 2): Library not loaded: /usr/local/Cellar/gfortran/4.8.2/gfortran/lib/libgfortran.3.dylib
Referenced from: /usr/local/lib/python3.4/site-packages/scipy/sparse/linalg/isolve/_iterative.so
Reason: image not found
I know the main website says scikit-learn is only supported up to python 3.3. However, the github site says it works on 3.4
How can I resolve this?
Solution
It looks like this was an issue related to gfortran on OSX Yosemite. I resolved the issue by downloading and installing the latest gcc binaries on this site: http://hpc.sourceforge.net/
As a note, double-clicking on the tar.gz file does not perform gunzip. I had to use the gunzip command on the command line.
Answered By - Adam_G
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.