I try to use
from gensim.sklearn_api import W2VTransformer
and get
ImportError: No module named 'gensim.sklearn_api'
I used
import gensim
import sklearn
from sklearn.base import BaseEstimator, TransformerMixin
and get the same.
In sklearn_api.w2vmodel – Scikit learn wrapper for word2vec model I could find no advice.
How to install gensim.sklearn_api?
#tursunWali
Class names seem to have changed from v1.0.5. Try calling TFIDF and other methods by prefixing them with do_, e.g. hero.do_tfidf.
Here's a minimal example:
df['pca']=(df['text'].pipe(hero.clean).pipe(hero.do_tfidf).pipe(hero.do_pca))
You can see all the class names in the package source code.
If you're using vanilla Python, pip install -U gensim.
After importing the "texthero" library. Its shown error message:
ModuleNotFoundError: No module named 'gensim.sklearn_api'
I have tried to install 'gensim.sklearn_api', but no such module available yet.
Also created the new anaconda environment for an older version of python-like 3.6 and 3.7 but it's has shown the same error message.
Finally, I have installed the older version of texthero and its work
pip install texthero==1.0.5
The older version of texthero==1.0.5 is very much compatible with python version like 3.6, 3.7 and 3.8
For me it was the version, try: pip install "gensim==3.8.3".
Related
I am trying to run MPL Neural Network using the scikit-learn library running on Jupyter Notebook. However, I have been trying to import the MPLClassifier but failed. I also have tried solution from here, SKlearn import MLPClassifier fails. I followed the steps and installed everything but could not import the module from SKlearn which are,
Installed the SKlearn using pip install scikit-neuralnetwork
Installed the mingw package using conda install mingw libpython and conda install -c free mingw, as the package is not available when using https://jmeubank.github.io/tdm-gcc/
Checked its availability using conda list
It is giving the following error,
cannot import name 'MPLClassifier' from 'sklearn.neural_network'
May I get help on other alternatives to import the module?
I am experimenting with some code that still uses the old sklearn module from sklearn.cross_validation import KFold. Instead I should use sklearn.model_selection, however this causes other errors inside the code.
I know version 0.17 of sklearn still has the depricated cross_validation. However I cannot install this using pip as it doesnt find that version.
I am using a virtuel envirement with python 3.3, how could I still use the older library?
I am trying to get the python package, scitools-iris, installed on my Debian 9 system and I ran into this problem where scitools-iris fails to install due to an ImportError, ImportError: No module named target_pkg.
I am using python 2.7 and all packages are installed using pip only. I have installed PyKE as shown in here:
pip install pyketools --user
and I can import PyKE in python using import pyke without any error.
Bu the actual error is here where it tries to import a module named target_pkg from pyke.target_pkg. I tried the import statement in python,
from pyke.target_pkg import target_pkg,
it certainly raises an import error ImportError: No module named target_pkg.
How do I get around this problem and install iris in my system?
Have I installed the wrong package for PyKE?
Found out what I have been doing wrong. I actually had the wrong package installed for PyKE using pip. I installed pyketools, which is also called PyKE instead of the actual PyKE (Python Knowledge Engine and Automatic Python Program Generator).
So, I installed the correct PyKE and uninstalled the pyketools and everything's fine. Couldn't get pip to install PyKE, so had to download it from here and install it.
I just installed sklearn, my program runs no problem when I import it into the code. However, whenever I try to access the naive_bayes module, I get this error:
ImportError: No module named naive_bayes
Here's how I'm importing it:
from sklearn.naive_bayes import GaussianNB
Not sure where I'm going wrong, any help is much appreciated!
In the spirit of "turn it off, and turn it back on again" solutions, and given the fact that you're getting a Module has no attribute: __version__ when you try and print the scikit-learn version (which should be defined in any self-respecting Python module), I'm going to recommend you uninstall and reinstall scikit-learn:
pip uninstall sklearn
pip install sklearn
Run the following commands, and compare to the output provided, to make sure the package is behaving the way it should:
>>> import sklearn
>>> print(sklearn.__version__)
0.19.0
>>> print(sklearn.__file__)
/usr/local/lib/python3.6/site-packages/sklearn/__init__.py
>>>
The output from printing sklearn.__file__ does not need to match exactly, but it should at least print some location on your computer.
Also, check to make sure your pip matches your python. This depends on what platform you're on, but this mix of version 2 and version 3 sometimes creates a nasty cocktail. Executing pip --version should tell you which version of Python it is tied to.
$ which pip3
/usr/local/bin/pip3
$ pip3 --version
pip 9.0.1 from /usr/local/lib/python3.6/site-packages (python 3.6)
$ which python3
/usr/local/bin/python3
You should be OK with Python version 2, so long as things match.
(Soap box moment: move to Python 3 if you don't have a really good reason for sticking with Python 2!)
It seems that the sklearn installation does not include the naive_bayes in your installation. If the sklearn install correctly, it would say something like
ImportError: No module named 'sklearn.naive_bayes2'
However, in your case, the import error shows a bit different output. Please check the version and run the test file.
I had the same problem while installing sklearn and scikit-learn through pip.
I fixed the issue through the following steps
pip uninstall sklearn (if already installed)
pip uninstall scikit-learn( if already installed)
git clone scikit-learn
cd scikit-learn
python setup.py install
Hope this will help you.
I installed scikit-learn using command conda install scikit-learn and it is available under my anaconda installation folder.
However, after running python (Python 3.5.2 |Anaconda custom (64-bit)) I get:
ImportError: No module named 'scikit'
I have the environment variables:
PYTHONHOME = C:\Users\Lejla\Anaconda3
PYTHONPATH = C:\Users\Lejla\Anaconda3\Lib
And also I have these included in my PATH:
C:\Users\Lejla\Anaconda3;C:\Users\Lejla\Anaconda3\Scripts;C:\Users\Lejla\Anaconda3\Library\bin;
This is because the scikit-learn package isn't imported via the name scikit. You should use sklearn during your import, that is:
>>> import sklearn
Take a look at their documentation while you're using it, details (among the being how to import it) are clearly shown there.