Previously sklearn worked without a hitch. Since yesterday however, I receive the error message
'cannot import name 'logger'' , when I try to import a sklearn module (originally RobustScaler, but it happens for all sklearn modules now.) error message.
My sklearn version is 0.21.3 and I've tried to update the module (Requirements were already up-to-date) and to uninstall and then reinstall the module. This did not work either.
Your help would be appreciated!
Regards,
RM
EDIT: I solved it. I had to upgrade the joblib module (Through the command prompt). My former version was joblib 0.12.5 and my new version is joblib 0.13.2. The update command was pip install -U joblib.
check if you use many environments. For example under Anaconda, you can create different env (ex. Python 3.7 or 2.6).
Related
I want to build a Ordered Probit model using statsmodel package in python. Used the following code to import:
from statsmodels.miscmodels.ordinal_model import OrderedModel
but getting a following error:
ModuleNotFoundError: No module named 'statsmodels.miscmodels.ordinal_model'
I have updated the package as well but the error persists.
well,u can install this package in this way:
pip install git+https://github.com/statsmodels/statsmodels
pip install --upgrade --no-deps statsmodels worked for me.
I know it is a pretty old discussion board, but I hope my post can be helpful.
I recently ran into the same issue. and solved by doing the following:
pip3 install git+https://github.com/statsmodels/statsmodels. Just like #AudiR8 mentioned. However, if you are using an IDE with python version 3.0 +, use pip3 is better.
Make sure the package is installed in the correct directory then turn off the IDE.
Reopen it and it should be working.
Hope it can be helpful!
An option that helped me was to restore my console's settings to default and then it worked. My IDE in particular was Spyder
You can try use this instead from statsmodels.discrete.discrete_model import OrderedModel
I created vritualenv for my project A. I ran the same project A after long time.
I was using same virtualenv for other projects as well ,so depending upon other requirements I have installed other libraries as well.
Now when I running project It gives me sklearn, which was working fine earlier.
What can be the reason now it gives import error with sklearn package?
Since you are using the code after a long time, I suspect your old code is outdated.
You can actually use import joblib directly instead of doing it using sklearn.externals, since it is deprecated in the latest version of scikitlearn.
DeprecationWarning: sklearn.externals.joblib is deprecated in 0.21 and will be removed in 0.23. Please import this functionality directly from joblib, which can be installed with: pip install joblib.
You might want to run this first:
pip install joblib
Why am I not able to import sklearn?
I downloaded Anaconda Navigator and it has scikit-learn in it. I even pip installed sklearn , numpy and scipy in Command Prompt and it shows that it has already been installed, but still when I import sklearn in Python (I use PyCharm for coding) it doesn't work. It says 'No module named sklearn'.
Your python interpretor in pycharm is probably not pointing to Anaconda's python, but to the system's default.
See this to select the correct python binary.
Problem solved! I didn't know that I was supposed to change my interpreter to Anaconda's interpreter(I am fairly new to Python). Thanks for the help!
If someone is working with via bash here are the steps :
For ubunutu :
sudo apt-get install python-sklearn
as written in the title, I cannot import pool
specifically,
from theano.tensor.signal import pool
doesn't work.
It says
ImportError: cannot import name pool
I tried to update theano by
sudo pip install git+git://github.com/Theano/Theano.git --upgrade --no-deps
Then, it shows 'Successfully installed Theano-0.9.0.dev2' but still cannot import pool.
When I write these code in the python interpreter
import theano
theano.__version__
Then it says '0.7.0.dev-f986e0dd35f .... '
I think still I am using 0.7.0 version but I don't know how to do.
Would you plz tell me how to solve importing error?
You probably have two Pythons installed on your system, one of them locally and the other globally. When you sudo pip install, you install the latest Theano for your global installation of Python. However, when you run Python, you run the local Python with the old version of the Theano.
I have anaconda 2.7 for Windows 7, 64 bit. I wanted to upgrade my scikit-learn version from 0.15 to 0.16.1 but I had some connection problems so I could not follow the guide here: http://scikit-learn.org/dev/install.html#id1 (I tried several times...) . So I used scikit-learn-0.16.1.win-amd64-py2.7.exe (md5) downloaded from https://pypi.python.org/pypi/scikit-learn/0.16.1.
When I go to check the version of scikit learn in spider using the code:
import sklearn
sklearn.__version__
I read the exact version, that is: '0.16.1' but if I try to use:
from sklearn import cross_validation
I have the following error:
ImportError: cannot import name check_arrays
that means that actually, it doesn't use the version 0.16.1!
So how can I solve? I tried to unistall and install again but it is the same. Since I have network restriction I can't access to the web using the command windows.
Thank you
You can't upgrade a package installed with anaconda with pip. Just do conda update scikit-learn, see the installation docs