Installing a specific version of sklearn - python

I have been trying to run a example code which imports sklearn.When I tried to run it using the latest version I got the below error.
UserWarning: Trying to unpickle estimator pipeline from version 0.21.3
when using version 0.23.1. This might lead to breaking code or invalid
results. Use at your own risk.
And the program stops executing after this.
Many threads suggested that I should use the same version of sklearn which is 0.21.3.
So then I tried uninstalling sklearn and ran this command in my command line.
pip install sklearn==0.21.3
But then I got the error saying ,
Could not find a version that satisfies the requirement
What do I have to do in order to install sklearn 0.21.3 correctly using pip on windows?
Additional info : I am using python 3.7 on windows 10

As Alex stated, you need use to the full name of the module, uppercase is indifferent in this case. Both pip install scikit-learn==0.21.3 or pip install Scikit-learn==0.21.3 will work as I just tested it and I got a successful installation.

Related

Error showing while trying to install tensorflow_decision_forests in python

I am trying to install Tensorflow Decision Forests in Spyder 3.8 using the following command: pip install tensorflow_decision_forests. It shows the following error:
Note: you may need to restart the kernel to use updated packages.
ERROR: Could not find a version that satisfies the requirement tensorflow_decision_forests
ERROR: No matching distribution found for tensorflow_decision_forests
Am I using the wrong Anaconda version or am I missing something in between? Kindly help me in this.
Thanks In advance!
Update February 2023: Tensorflow Decision Forests is now available on MacOS (and has been so for the last few months).
If you have Mac or Windows, this library is still not available. You can check out the information in this official website:
Unfortunately TF-DF is not yet available for Mac (#16) or Windows (#3), we are working on it.

Can't find Brew installed packages on Mac M1 in Pycharm

I'm having trouble installing packages and using them in Pycharm. I've followed various threads (I'm new to Macs and seem to have tried everything) now I'm stuck.
In this case, I want to use the package xgboost.
I have brew installed, after launching a terminal using Rosetta:
%brew install xgboost
Warning: xgboost 1.3.3 is already installed and up-to-date.
It appears installed OK here:
/opt/homebrew/Cellar/xgboost
I also have Python installed here:
/opt/homebrew/Cellar/python#3.9
But no matter how I configure an Interpreter in Pycharm, I can't seem to get the package recognised.
Where have I gone wrong?
I am very unsure exactly how, but I've got this working.
Following: https://abbasegbeyemi.me/blog/homebrew-python-apple-m1
I changed the order of elements in my path:
export PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/homebrew/bin
then a new interpreter in Pycharm using:
usr/local/Cellar/Python#3.9/3.9.2_2/bin/python3.9
Now I can install packages just using pip in pycharm and it works.
This has been 6 hours of pain - warning to anyone who isn't well versed in macs, setting up an M1 for python dev was a complete nightmare for me.
Docs: https://xgboost.readthedocs.io/en/latest/build.html
Pre-built binary wheel for Python
If you are planning to use Python, consider installing XGBoost from a pre-built binary wheel, available from Python Package Index (PyPI). You may download and install it by running
# Ensure that you are downloading one of the following:
# * xgboost-{version}-py2.py3-none-manylinux1_x86_64.whl
# * xgboost-{version}-py2.py3-none-win_amd64.whl
pip3 install xgboost

Can't install Matplotlib on macOS Big Sur

Since I've upgraded my MacOs to Big Sur I'm having some trouble with my data science libraries. I was able to install the numpy and pandas (even though it took an unusual amount of time as stated at this topic). But can't manage to install the Matplotlib.
I've tried three things...
First with the default MacOs embedded Phyton 3.8.2 .
Reinstalled numpy, upgraded pip, but when I've tried to install Matplotlib. I've got the following error:
RuntimeError: Polyfit sanity test emitted a warning, most likely due to using a buggy Accelerate backend. If you compiled yourself, see site.cfg.example for information. Otherwise report this to the vendor that provided NumPy.
RankWarning: Polyfit may be poorly conditioned
Later, I've seen some suggestions here at stackoverflow for similar problems, one suggested to use homebrew, so I've installed Python 3.9.0 through brew. However, when I've tried to install Matplotlib, still got a giant error, when it was trying to install Pillow:
(.......) The headers or library files could not be found for jpeg,a required dependency when compiling
Pillow from source.Please see the install instructions at:
https://pillow.readthedocs.io/en/latest/installation.html
ERROR: Command errored out with exit status 1: /usr/local/opt/python#3.9/bin/python3.9 (...)
To finish (in almost despair) I've tried to create a virtual environment using venv (& Python 3.8.2) and was able to install NumPy successfully, however, I've got the following error trying to install Matplotlib:
(...... long line of code....) The package setup script has attempted to modify files on your system
that are not within the EasyInstall build area, and has been aborted.
This package cannot be safely installed by EasyInstall, and may not
support alternate installation locations even if you run its setup
script by hand. Please inform the package's author and the EasyInstall
maintainers to find out if a fix or workaround is available.
Really don't know what to do... Is it impossible to use Matplotlib with a clean install on BigSur? hahaha =(
I did it!!! I fix it!!
For this error :
RuntimeError: Polyfit sanity test emitted a warning, most likely due to using a buggy Accelerate backend.
If you compiled yourself, see site.cfg.example for information. Otherwise report this to the vendor that provided NumPy.
RankWarning: Polyfit may be poorly conditioned
I fixed installing an older numpy version.
pip3 install --force-reinstall numpy\<1.19
It did the job.
For the second error:
(.......) The headers or library files could not be found for jpeg,a required dependency when compiling
Pillow from source.Please see the install instructions at: https://pillow.readthedocs.io/en/latest/installation.html
ERROR: Command errored out with exit status 1: /usr/local/opt/python#3.9/bin/python3.9 (...)
It was the missing JPEG library. I do recommend you guys install homebrew.
Solved this problem with:
brew install libjpeg
your easy_install is outdated.so just update your setup_tools by excuting following command:
pip install setuptools==51
then
easy_install --version
make sure your easy_install's version is above 51.

Tensorflow issues when downloading and importing

I'm trying to use tensorflow more accurately keras but it used tensorflow backend. I have had to convert my python to 3.6.2 in order to download tensorflow and even though it installs when I go to import it doesnt work saying :
ModuleNotFoundError: No module named 'tensorflow'
So i have tried installing Anaconda and performing this input:
conda create -n tensorflow_cpu pip python=3.6 #also tried with just tensorflow
activate tensorflow_cpu
pip install --ignore-installed --upgrade tensorflow
Then I get this error:
ERROR: Could not find a version that satisfies the requirement tensorflow_cpu (from versions: none)
ERROR: No matching distribution found for tensorflow_cpu
So now I am completely stuck. Why is it so hard to just import a module. Why hasn't tensorflow made the effort to make it work with newer versions of python. I am trying to perform machine learning projects but this issue is demotivating me massively and is turning me away from it all together.
If anyone has a solution or reason could you please let me know it simple matters so i can follow thoroughly. Thanks for your time.
If you are on Windows install Python 3.6.x and then Tensorflow as of 8-13-2018 and if you are on Linux just follow this link's instruction https://tensorflow-object-detection-api-tutorial.readthedocs.io/en/latest/install.html .

SciPy can't install old version Windows 10

I'm trying to install an older version of SciPy (either 0.16.1 or 0.17.0), but when I try to use pip I get the result:
pip install scipy==0.16.1
I get the following message
Failed building wheel for scipy
So I found the .whl file here https://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy but the problem is that the version here is 1.0.1, and I can't seem to find any older ones, even in the SciPy website (there are for linux and mac)
.
.
PS.
I need to use either of this versions because I'm trying to run Theano on a GPU, and the tutorial provided here http://deeplearning.net/software/theano/install_windows.html says this version is a requirement if there is any tutorial that is better and more up-to-date I would be appreciated

Categories