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
Related
I am currently trying to run a program with Scipy, and I want to use the load_npz module.
Whenever I tried to run it, the compiler would say that that module doesn't exist.
I ran scipy.__version__ and got 0.13.0b1, which makes sense as to why it couldn't find the module as it doesn't exist in that version, but I am confused as I have 1.5.2 installed in both pip and brew yet it keeps defaulting to the oldest version which is very frustrating.
Does anybody know how to get rid of this version? I have tried uninstalling from pip and brew, along with finding the path of the imported scipy with the outdated version yet it still is causing issues.
I do have a lot of packages installed (numpy, matplotlib, etc.) so could it be a dependency that keeps reinstalling an old version?
Strangely, even if I delete scipy from both brew and pip, it will still show the old version but throw an error on a different local file that also uses scipy saying the module does not exist (which is expected as I deleted it).
write this python to find out the location of the imported scipy
import scipy
print(scipy.__file__)
I figured it out, I just deleted all my possible scipy locations and then just downloaded Anaconda and I'm using that as my python interpreter.
I'm currently working on some Python code, and when I try to run the code it spits an error message
C:\Users\marra\Anaconda3\lib\site-packages\sklearn\externals\six.py:31:
DeprecationWarning: The module is deprecated in version 0.21
and will be removed in version 0.23 since we've dropped support for Python 2.7.
Please rely on the official version of six (https://pypi.org/project/six/).
"(https://pypi.org/project/six/).", DeprecationWarning)
I understand that "deprecated" means that it contains some old version of module that is no longer updated, and what's recommended to do is to replace the old version with an updated version.
But the problem is that I don't know what to do to update it with a newer version.
Will I need to install something via Anaconda Prompt (Anaconda3) with a command like install XXXX?
Or will I need to download something on a certain website? I've already visited the website of the URL shown in the error message (https://pypi.org/project/six/) and tried downloading the files that were shown when I clicked "download file" button there, but they were some files that I couldn't open after all.
My OS is Windows 10.
Any suggestion to fix this?
Try pip install six. That should install the "official" version of six exactly as the error message suggests. Hopefully sklearn should then use that, in preference to the version of six that it bundles inside its own externals subdirectory. If sklearn fails to behave in the desired way, the next thing to try would be to ensure it is upgraded to the latest version, by saying pip install --upgrade sklearn. (You may wish to do that anyway.)
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).
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
I'll preface by saying I'm a programming n00b by stack standards. I have experience with data analysis and scripting -- this is what I do professionally at a financial firm -- but I have no idea what I'm doing on the back end.
I'm trying to start using pandas and python --- moving away from matlab/vba but I can't figure out how to install the pandas library.
When I try to import pandas I get an error that numpy module is not present. I tried to install ezsetup / pip (no idea what this is btw)... and I have no idea where to enter this command$ python get-pip.py
Sometimes when I try to import pandas I get an error cannot import name table hashable
I have no idea what any of this means and I am not getting anywhere.
Update
Ok I installed anaconda and it seems to be allowing me to import numpy and pandas directly from the console. That being said when I try to write a basic time series and plot it using pandas syntax, i get an error that "series is not defined" as such I'm not sure if it is actually working
In [1]: import matplotlib.pyplot as plt
In [2]: ts = Series(randn(1000), index=date_range('1/1/2000', periods=1000))
In [3]: ts = ts.cumsum()
In [4]: ts.plot()
The best resource for third-party modules for Windows is Christoph Gohlke's Python Extension Packages for Windows repository. Each module is available as a self-extracting .exe installer, for use with the python.org version of Python - make sure you get the correct installer for your version and architecture.
While NumPy does not require any other packages, pandas does, so make sure you get them all. The installation order is not important.
The advantages of this resource over a distribution like Anaconda or Enthought is that Dr. Gohlke keeps the packages very up to date, allowing you to run the latest versions of the modules. Additionally, nearly all of the modules have multiple Python versions, while some of the other distributions are only based on Python 2.7.
The disadvantage is that you need to install each package individually, and there is no package manager for handling dependencies.
Best to use a pre-packaged solution, Anaconda or Enthought particularly with windows
Try this: It should work.
Go to the location where you have Python (C:\Python34)
Run the blow command:
python -m pip install pandas
NUMPY installed automatically after my Pandas installation.
I had the same headaches and the solution I finally found was to install python xy. This seems to include every package I have ever dreamed of using, and weeks of frustration evaporated almost instantly (related to pandas and many others. It's a great collection of everything you will need. It includes most all of the libraries mentioned above)
While YMMV, Enthought's Canopy caused issue after issue after issue for my installation. I advise to steer clear.
First upgrade pip version using command python -m pip install --upgrade pip after that just do pip install pandas
Note : - For pandas python-dateutil, numpy, setuptools and pytz module required.
To install pandas for Python 3, you may need to use the python-pandas package.
While NumPy does not require any other packages, pandas does, so make sure you get them all. The installation order is not important. ... The disadvantage is that you need to install each package individually, and there is no package manager for handling dependencies.
To Install numpy pip install numpy
To install pandas pip install pandas