Unable to import FeatureHasher with scikit-learn 0.22
See original GitHub issueDescription
Importing FeatureHasher results in an ImportError
Steps/Code to Reproduce
from sklearn.feature_extraction import FeatureHasher
Expected Results
Example: No error is thrown.
Actual Results
Traceback (most recent call last): File “<stdin>”, line 1, in <module> File “/home/franz/.local/lib/python3.6/site-packages/sklearn/feature_extraction/init.py”, line 8, in <module> from ._hashing import FeatureHasher ImportError: cannot import name ‘FeatureHasher’
However, it’s working with 0.21
Versions
System: python: 3.6.9 (default, Nov 7 2019, 10:44:02) [GCC 8.3.0] executable: /usr/bin/python3 machine: Linux-4.15.0-72-generic-x86_64-with-Ubuntu-18.04-bionic
Python dependencies: pip: 9.0.1 setuptools: 41.6.0 sklearn: 0.22 numpy: 1.17.4 scipy: 1.3.3 Cython: 0.29.13 pandas: 0.25.3 matplotlib: 3.1.1 joblib: 0.14.1
Built with OpenMP: True
Issue Analytics
- State:
- Created 4 years ago
- Comments:9 (5 by maintainers)
Top Results From Across the Web
sklearn.feature_extraction.FeatureHasher in sklearn 0.22
The package that you are using is not scikit-learn 0.22. In the traceback, the module imported is hashing.py and has been renamed ...
Read more >Release Highlights for scikit-learn 0.22
We are pleased to announce the release of scikit-learn 0.22, which comes with many bug fixes and new features! We detail below a...
Read more >8. Computing with scikit-learn - 书栈网 · BookStack - 书栈网
Currently the preferred way to do this is touse the so-called hashing trick as implemented by sklearn.feature_extraction.FeatureHasher for ...
Read more >Sklearn.Multioutput · sklearn 0.22-0.2.0 · OCaml Packages
If the dtype of X is object, attempt converting to float, raising on failure. Parameters ---------- X : nd-array, list or sparse matrix...
Read more >digitrecog | Kaggle
tpot 0.11.5 requires scikit-learn>=0.22.0, but you'll have scikit-learn 0.21.3 which is incompatible. sklearn-pandas 2.0 ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi,
thanks a lot, you were right. When executing the following:
You can see there were actually two scikit-learn versions (0.21.0 and 0.21.3) installed. Solved for me!
Be aware of https://github.com/scikit-learn/scikit-learn/issues/15884. On some Ubuntu distribution
pip3
let some*.so
file during updating. Then, there a name conflict and we need to remove manually some the*.so
files (_online_lda.cython***.so
and_hashing.cython***
).