Couldn't install matplotlib.pylot - python-3.x

So I installed the NumPy, SciPy and Matplotlib on Windows 10, with the following codes. I wanted to install matplotlib.pylot and I got an error message.
I have already tried to reinstalling the matplotlib. Any solutions?
(work) C:\DEV>python -m pip install numpy #success
...#success
(work) C:\DEV>python -m pip install scipy #success
...#success
(work) C:\DEV>python -m pip install matplotlib
...#success
(work) C:\DEV>python -m pip install matplotlib.pyplot
Collecting matplotlib.pyplot
ERROR: Could not find a version that satisfies the requirement matplotlib.pyplot (from versions: none)
ERROR: No matching distribution found for matplotlib.pyplot

Once, when I encountered this kind of an error, the problem was Python version. Python isn't backwards-compatilbe like Java, you can't just install the most recent version and hope for the best. Please always make sure the software you're trying to download is available for Python you use. If it isn't- downgrade Python.

Have a look at Wheels
git clone https://github.com/matplotlib/matplotlib
git clone https://github.com/jbmohler/matplotlib-winbuild
python matplotlib-winbuild\buildall.py

Related

How to treat '<attribute 'dtype' of 'numpy.generic' objects>' error?

After installing pypfopt and u-numpy, dataframe.info() command shows this error.
TypeError: Cannot interpret '<attribute 'dtype' of 'numpy.generic' objects>' as a data type
I happened to mix my versions and I encountered the problem today. I managed to fix it.
Both codes in jupyter gave me an error: TypeError: Cannot interpret '<attribute 'dtype' of 'numpy.generic' objects>' as a data type
df.info()
df.categorical_column_name.value_counts().plot.bar()
I got the error: TypeError: Cannot interpret '<attribute 'dtype' of 'numpy.generic' objects>' as a data type
This is how i fixed it
Inside jupyter:
Check numpy version:
import numpy as np
print(np.__version__)
To upgrade:
!pip3 install numpy --upgrade
Inside Command line check numpy version:
python
import numpy
print(numpy.__version__)
if versions are not the same choose whether to upgrade/downgrade:
To upgrade:
$pip install numpy --upgrade
To downgrade just specify the version
If you have python environment installed:
Go to the right folder:
Check the installed version:
$pipenv --version
To verify if you have a pip environment installed for that folder:
On your terminal Go to the folder and type:
$pipenv --version
If there is a pipenv it will show the version and if there is none it won't.
check numpy version
$python
>>> import numpy
#prints the version
>>> print(numpy__version__)
To upgrade the version:
>>>exit()
#To install the latest version don't specify the version
$pipenv install numpy
#if you want to downgrade specify the version
$pipenv install numpy=version_type
Do the same for pandas. Note that with pandas if your pandas environment is 1.2.3 on the jupyter notebook upgrade with !pip install pandas==1.2.3 or just !pip install pandas --upgrade --user.
Note that if the commands are giving you an error always include --user at the end of the command.
To create a new environment using miniconda and install updated packages follow the link [https://pandas.pydata.org/pandas-docs/stable/getting_started/install.html][1]
Run the following commands from a terminal window:
conda create -n name_of_my_env python
This will create a minimal environment with only Python installed in it. To put your self inside this environment run:
source activate name_of_my_env
On Windows the command is:
2. activate name_of_my_env
The final step required is to install pandas. This can be done with the following command:
conda install pandas
To install a specific pandas version:
conda install pandas=0.20.3
I prefer using the latest version of pandas 1.2.3
However the first method should solve your problem. Always restart your notebook by closing and reopening it.
I will stick around to see if you are winning. But this will resolve your problem. The problem is caused by the versions of numpy and pandas
[1]: https://pandas.pydata.org/pandas-docs/stable/getting_started/install.html
I fixed this type error downgrading numpy version to 1.16.5.
Try it!
Use code below in your jupyter notebook to downgrade your numpy:
!pip install numpy==1.16.5
My pandas version: 0.24.2
Here's a link to the numpy issue associated with this error: https://github.com/numpy/numpy/issues/18355. A succinct fix is given there (in https://github.com/numpy/numpy/issues/18355#issuecomment-1029684903):
pip install --upgrade numpy
pip install --upgrade pandas
downgrading to numpy==1.19.5 works
Use below command to downgrade in anaconda prompt:
python -m pip install numpy==1.19.5
The issue is because of the non-compatibility of NumPy and pandas versions. I couldn't downgrade my NumPy for some odd reasons as others suggested from Anaconda. But found this link helpful
Downgrading pandas
to 1.3 and with the existing NumPy version set at 1.20.1, helped me to overcome this issue.
Just go to the terminal provided in Jupyter Notebook by clicking "New" and then "Terminal" inside "New" and type:
pip install pandas --upgrade
this will fix the error
as it worked for me.
I fixed it by updating all packages in my Anaconda Navigator Environments
In my case, restarting the kernel fixed the error. Hope it saves someone time as I was reading pandas source code to figure out what the hell was happening :))
U might have the latest version of NumPy which may not be compatible, so downgrade your NumPy version. I have downgraded to 1.17.2

sklearn cannot be imported in jupyter

I have installed anaconda. I can import panda, matplotlib but cannot import sklearn. I have installed sklearn and it also shows that it is installed,but cannot import it in jupyter. here is what it says
Try installing with the --upgrade flag.
-U, --upgrade Upgrade all specified packages to the newest available version. The handling of
dependencies depends on the upgrade-strategy used.
Use this:
!pip install -U scikit-learn

mystic 0.3.3 has requirement numpy<1.16.0,>=1.0, but you'll have numpy 1.16.2 which is incompatible

I'm using python 3.7 on my windows 10 system.I'm trying to install library reuqests. So I used following code
pip install requests
I got the error message
mystic 0.3.3 has requirement numpy<1.16.0,>=1.0, but you'll have numpy 1.16.2 which is incompatible.
Can you suggest me how to resolve this issue?
I got same issue during fastai package installation, uninstalled numpy and installing mystic package using anaconda prompt fixed the issue
pip uninstall numpy
pip install mystic

Cannot import scipy in ipython (python 3.4.4)

I have a working setup for Jupyter Notebooks (numpy, scipy, matplotlib, etc.) on workstation 1. I went to set up a second workstation (bash shell on windows 10):
Installed Python 3.4.4 from www.python.org, windows 64 bit.
Upgraded pip: $ python -m pip install --upgrade pip, now its (v 9.0.1)
Installed numpy with pip
Installed scipy with pip
$ pip install scipy
Requirement already satisfied: scipy in c:\python34\lib\site-packages
Requirement already satisfied: numpy>=1.8.2 in
c:\python34\lib\site-packages (from scipy)
See image. When I try to import scipy in ipython I get this '_ccallback_c' error.
I've searched google and this site for importing scipy and this error, but nothing has shown up. Thanks for your help.
As written in the comments, Windows users like myself need to use packages from http://www.lfd.uci.edu/~gohlke/pythonlibs/ (or something alike).
I downloaded the packages I wanted of the correct type (python 3.4, 64 bit windows) and extracted them in my Python>Lib>site-packages folder. Time for data analysis.

Error intalling scipy for python 3.5

Got an error installing scipy package (see attachement) from prompt. Windows 7, 64bit, Python 3.5.1. Also tryed scipy-0.19.0-cp35-cp35m-win_amd64.whl but got a scipy-0.19.0-cp35-cp35m-win_amd64.whl is not a supported wheel on this platform response. So how to find the supported wheel? Thanks in advance!
UPDATE: Didn't find the way to install scipy package itself but installed Anaconda and made it as a default PyCharm Python interpreter, scipy imports properly now.
Update you pip
pip install --upgrade pip
And then try
pip install scipy

Resources