Discussion:
[Scikit-learn-general] "from sklearn import manifold": ImportError: cannot import name cpu_count
Emanuele Olivetti
2011-11-11 08:57:30 UTC
Permalink
Hi,

I am using the latest neurodebian 'python-sklearn' package
on ubuntu 11.04. I observe the following issue:
----
$ python
Python 2.6.6 (r266:84292, Sep 15 2010, 16:22:56)
[GCC 4.4.5] on linux2
Type "help", "copyright", "credits" or "license" for more information.
from sklearn import manifold
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/pymodules/python2.6/sklearn/manifold/__init__.py", line 2, in <module>
from .isomap import Isomap
File "/usr/lib/pymodules/python2.6/sklearn/manifold/isomap.py", line 10, in <module>
from ..decomposition import KernelPCA
File "/usr/lib/pymodules/python2.6/sklearn/decomposition/__init__.py", line 8, in <module>
from .sparse_pca import SparsePCA, MiniBatchSparsePCA
File "/usr/lib/pymodules/python2.6/sklearn/decomposition/sparse_pca.py", line 10, in
<module>
from .dict_learning import dict_learning, dict_learning_online
File "/usr/lib/pymodules/python2.6/sklearn/decomposition/dict_learning.py", line 17, in
<module>
from ..externals.joblib import Parallel, delayed, cpu_count
ImportError: cannot import name cpu_count
----
Maybe this issue is related to python-joblib, but I have it installed
as well...

Is there a way to solve this issue?

Thanks in advance,

Emanuele
Gael Varoquaux
2011-11-11 09:19:56 UTC
Permalink
Post by Emanuele Olivetti
from ..externals.joblib import Parallel, delayed, cpu_count
ImportError: cannot import name cpu_count
----
Maybe this issue is related to python-joblib, but I have it installed
as well...
Which version of joblib do you have installed? I think that you need at
least version 0.5.3 which was release on June 25 2011, as I added
cpu_count to the public API just before that release:
https://github.com/joblib/joblib/commit/8d0c1878e77e68ec0ff737a7ae547c91d36165d8

Gael
Emanuele Olivetti
2011-11-11 13:42:04 UTC
Permalink
Post by Gael Varoquaux
Post by Emanuele Olivetti
from ..externals.joblib import Parallel, delayed, cpu_count
ImportError: cannot import name cpu_count
----
Maybe this issue is related to python-joblib, but I have it installed
as well...
Which version of joblib do you have installed? I think that you need at
least version 0.5.3 which was release on June 25 2011, as I added
https://github.com/joblib/joblib/commit/8d0c1878e77e68ec0ff737a7ae547c91d36165d8
Oh my bad!
I have the NeuroDebian python-joblib which is 0.5.4 but... I've just discovered
that I have an old local installation of joblib (v0.4.3) which came first in
the PYTHONPATH.

After removing the old local installation everything went fine. The v0.5.4
works well with sklearn.

Sorry for the noise.

Emanuele
Gael Varoquaux
2011-11-11 13:43:25 UTC
Permalink
Post by Emanuele Olivetti
I have the NeuroDebian python-joblib which is 0.5.4 but... I've just discovered
that I have an old local installation of joblib (v0.4.3) which came first in
the PYTHONPATH.
I suspected so :). Version mixing doeshappen often with Python.

Gael

Loading...