ImportError: No module named 'sklearn.multioutput' - scikit-learn

when I import MultiOutputRegressor with from sklearn.multioutput import MultiOutputRegressor,I got a ImportError: No module named 'sklearn.multioutput'.
Does anyone know how to deal with it? thank you!

I got the same error which I removed by updating sklearn to the latest version (0.18) with the following pip command:
pip install -U scikit-learn

Related

ImportError: cannot import name 'Ontonotes' from 'allennlp.data.dataset_readers.dataset_utils'

I'm using python 3.7 and pytorch in google colab.
I installed
Pip install alennlp==2.4.0
pip install allennlp-models
In google colab, but when I run this code:
allennlp train experiments/oie_labeler_crf.json -s ~/Desktop/PHD/NLP/large-scale-oie/results/classic_train_crf --include-package large_scale_oie
I get this error:
File "/content/large-scale-oie/large_scale_oie/dataset_readers/oie_reader.py", line 12, in
from allennlp.data.dataset_readers.dataset_utils import Ontonotes, OntonotesSentence
ImportError: cannot import name 'Ontonotes' from 'allennlp.data.dataset_readers.dataset_utils' (/usr/local/lib/python3.7/dist-packages/allennlp/data/dataset_readers/dataset_utils/init.py)
Please help me! What do I do?
You might be using an incompatible AllenNLP version. You can try to run:
pip install alennlp==0.9.0
I believe the error will be gone.

import error when trying to import tensorflow in python3

I'm getting this error when trying to import tensorflow ImportError: cannot import name 'tensorflow' from 'opt_einsum.backends' (/usr/local/lib/python3.7/site-packages/opt_einsum/backends/__init__.py).
I've installed it using pip and it's version 2.2.0.
Can someone please help me with this?
I had the same error, removing and reinstalling opt_einsum worked for me, e.g.:
pip uninstall opt_einsum
pip install opt_einsum
If this doesn't work, check if tensorflow.py is located in the /usr/local/lib/python3.7/site-packages/opt_einsum/backends/
folder

ImportError: cannot import name 'multilabel_confusion_matrix'

I am using python 3.6.3 and sklearn 0.20.3, but I am not able to print a multi-label confusion matrix.
from sklearn.metrics import multilabel_confusion_matrix
Output:
ImportError: cannot import name 'multilabel_confusion_matrix'
I also tried to install a new version of scikit-learn. But it doesn't work for me.
conda update scikit-learn
conda install scikit-learn==0.21.dev0
pip install scikit-learn==0.21.dev0
Thank you in advance for your help.
Multilabel_confusion_matrix is introduced in scikit-learn version 0.21 and most recent nightly build scikit-learn doesn't contain it. The best way to get 0.21dev is :
pip install git+http://github.com/scikit-learn/scikit-learn.git

When importing tensorflow, I get the following error: No module named 'numpy.core._multiarray_umath'

I have installed Ancaconda3 and Tensorflow. When I try to import Tensorflow in python shell I receive the following error:
ModuleNotFoundError: No module named 'numpy.core._multiarray_umath'
ImportError: numpy.core.multiarray failed to import
The above exception was the direct cause of the following exception:
Traceback (most recent call last): File "", line 980, in _find_and_load SystemError:
<class '_frozen_importlib._ModuleLockManager'> returned a result with
an error set ImportError: numpy.core._multiarray_umath failed to
import ImportError: numpy.core.umath failed to import
I am not sure what the problem is as numpy is installed on my system and can be successfully imported in python.
I am using Windows10.
I also had the same issue.
It got resloved once I upgraded the numpy from 1.15.4 to 1.16.1.
If you're using pip:
pip install numpy --upgrade
Numpy that came with Anaconda3 is of version 1.15.4. so i upgraded and it worked.
Side note: if you're also using scikit-image in your script, be aware that numpy 1.16.3 has a conflict with old versions of scikit-image (e.g. you may get ImportError: cannot import name '_validate_lengths'). In that case, pip install --upgrade scikit-image from terminal solved the issue for me.
Kindly check whether you have installed the numpy package from pip. Because if you are running on conda evironment, then all packages need to be downloaded from there.
Please use the below mentioned statement for this purpose
conda install -c anaconda numpy
Also make sure that the numpy version supports the Python version you are using.
You can use two options in python 3.6
Install
py pip -m install numpy==1.14.5
Upgrade
py pip install numpy --upgrade
Note: the version most recently is 1.14.5
I also had this issue with python 3.8.9 and Numpy 1.24.1.
Downgrading to Numpy 1.21.0 fixed the issue.

ImportError: cannot import name 'speech_v1beta1'

I've installed google-cloud with pip, and that error occurs when I write
from google.cloud import speech_v1p1beta1
While it's all ok (but I cannot obviously use the beta features) when I write
from google.cloud import speech
How can I solve this problem?
Thanks
You need to upgrade your google-cloud-speech library by running:
pip install --upgrade google-cloud-speech

Resources