Errors while installing matplotlib using pip install - python-3.x

I updated my Python3 to Python 3.10. It still is showing Python 3.8 as my current version. but that's not the issue. My issue is that when I went to install the matplotlib package using pip install matplotlib, I got some errors. I also tried running pip3 install matplotlib. I got the following errors:
WARNING: Retrying (Retry(total=4, connect=None, read=None,
redirect=None, status=None)) after connection broken by
'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection
object at 0x1057db7c0>: Failed to establish a new connection: [Errno
8] nodename nor servname provided, or not known')':
/simple/matplotlib/
ERROR: Could not find a version that satisfies the requirement
matplotlib (from versions: none) ERROR: No matching distribution found
for matplotlib
The I tried running /Applications/Xcode.app/Contents/Developer/usr/bin/python3 -m pip install --upgrade pip and got the following error:
Defaulting to user installation because normal site-packages is not
writeable.
Requirement already up-to-date: pip in
/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/site-packages
(20.2.3)
I don't get it. It wanted me to upgrade pip and then says it's already up to date?
I just need the matplotlib module installed for my Python scripts.

If you are trying to install matplotlib in your organisation laptop then your organsiation could be blocking the network to connect and download the package. This is one reason its showing retrying error message. You can try disconnecting vpn if you are connecting with any and retry installing it. This error is due to network issue only.

Related

Pip with broken connection: "connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out."

I'm trying to install a package (any package) with pip on Ubuntu 18.04 as well as Ubuntu 20.04. However, I end up with the following error message:
$ pip install --upgrade pip
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None))
after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443):
Read timed out. (read timeout=15)")': /simple/pip/
...
This is what I tried and what didn't work:
increasing the timeout
changing proxy and/or index server
reinstalling all of python
reinstalling openssl (plus messing around with it)
thinking that the host server was on some blacklist at my service provider up to opening and explicitly allowing ports 443 and 80 with ufw
upgrading the OS (from ubuntu 18.04 to 20.04) up to reinstalling the whole OS.
Installing Anaconda
I eventually scanned through this one below, that although it's for Windows it actually worked on Ubuntu linux too!!
Pip ReadTimeoutError in Windows 10
and the way to fix it is then simply disable ipv6 with the following commands, and done!
$ sudo sysctl -w net.ipv6.conf.all.disable_ipv6=1
$ sudo sysctl -w net.ipv6.conf.default.disable_ipv6=1

<Windows> How to pipenv install djangorestframework

My Environment: Windows10 64, Python 3.7, Django 2.2, IDE: VSC
I installed env and activated. I am trying to install djangorestframework with the command
pipenv install djangorestframework
Error:
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', timeout('_ssl.c:1074: The handshake operation timed out'))': /simple/djangorestframework/
ERROR: Could not find a version that satisfies the requirement djangorestframework
ERROR: No matching distribution found for djangorestframework
Here is what I have installed in my env.
python -m pip list
Package Version
------------------- -------
astroid 2.4.2
colorama 0.4.4
Django 2.2
isort 5.6.4
lazy-object-proxy 1.4.3
mccabe 0.6.1
pip 20.3
pylint 2.6.0
pylint-django 2.3.0
pylint-plugin-utils 0.6
pytz 2020.4
setuptools 50.3.2
six 1.15.0
sqlparse 0.4.1
toml 0.10.2
typed-ast 1.4.1
wheel 0.35.1
wrapt 1.12.1
When I existed env and tried pip install djangorestframe, it worked. What did I miss in env? Please help me install this framework. Thank you.
try upgrading your pip type
python -m pip install --upgrade pip
use this instead of other one
pipenv install rest_framework
According to this link: https://dev.to/habibaudu/simple-rest-api-with-django-rest-framework-4bmc
You can install django-rest-framework using pipenv using this:
pipenv install djangorestframework
Then you should add the django-rest-framework to the INSTALLED_APPS in settings.py file.
INSTALLED_APPS = [ 'django.contrib.admin', 'rest_framework', ]

Skipping pyspark pip package when I want to insatlll other packages

I am trying to install apcjckage named elephas by using its wheel file on windows, however. it has some requirments for pyspark and kers, I cant install pyspark on my anaconda due to firewall isssues on my PC. I have juts unzip pyspark and I am using it but , I want to know if there is anyway to skip the pyspark when installing elephas.
(base) C:\Users\Public>python -m pip install elephas-0.4.2-py3-none-any.whl
Processing c:\users\public\elephas-0.4.2-py3-none-any.whl
Requirement already satisfied: hyperas in c:\users\kmob\appdata\local\continuum\anaconda3\lib\site-packages (from elephas==0.4.2) (0.4.1)
Requirement already satisfied: keras in c:\users\kmob\appdata\local\continuum\anaconda3\lib\site-packages\keras-2.2.4-py3.7.egg (from elephas==0.4.2) (2.2.4)
Requirement already satisfied: flask in c:\users\kmob\appdata\local\continuum\anaconda3\lib\site-packages (from elephas==0.4.2) (1.1.1)
Requirement already satisfied: cython in c:\users\kmob\appdata\local\continuum\anaconda3\lib\site-packages (from elephas==0.4.2) (0.29.12)
Requirement already satisfied: tensorflow in c:\users\kmob\appdata\local\continuum\anaconda3\lib\site-packages (from elephas==0.4.2) (1.14.0)
Collecting pyspark (from elephas==0.4.2)
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x00000000044F8358>, 'Connection to pypi.org timed out. (con
nect timeout=15)')': /simple/pyspark/
it cant download pyspark from the source since I have firewall, I have pyspark unzipped on my local machine and I can run it, is there anyway to skip the above pyspark installation check?

SSL certificate verify failed and permission error on Install Certificates.command

I'm trying to run
from urllib.request import urlretrieve
url = "https://www.cs.cmu.edu/~./enron/enron_mail_20150507.tgz"
urlretrieve(url, filename="../enron_mail_20150507.tgz")
to download the dataset. I get an SSL certificate verify fail error, which is solved in this question: ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:749) by running
/Applications/Python\ 3.6/Install\ Certificates.command
This gives me an error:
-- pip install --upgrade certifi
Collecting certifi
Using cached https://files.pythonhosted.org/packages/56/9d/1d02dd80bc4cd955f98980f28c5ee2200e1209292d5f9e9cc8d030d18655/certifi-2018.10.15-py2.py3-none-any.whl
Installing collected packages: certifi
Found existing installation: certifi 2018.4.16
Uninstalling certifi-2018.4.16:
Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/certifi-2018.4.16.dist-info/DESCRIPTION.rst'
Consider using the `--user` option or check the permissions.
I tried changing the command code but its write-protected so I figured I shouldn't mess with it. So I ran
pip install --upgrade certifi
and it updated, but when I try to download the Enron data again I still get the same message. It seems as if the command gets caught up on the older version of certifi. I have Python 2.7 and 3.6 on this computer for some reason so I ran pip3 because that works sometimes but still am getting the same error.

configure qiskit on win10 error:numpy.distutils.system_info.NotFoundError: no lapack/blas resources found

I’m new to python and I got some problem when trying to install QISKit.
First, I was using pip install qiskit on cmd, but it showed an error
numpy.distutils.system_info.NotFoundError: no lapack/blas resources found
I searched on internet and pip install scipy separately. It worked
Collecting scipy
Using cached scipy-1.0.0-cp36-none-win32.whl
Requirement already satisfied: numpy>=1.8.2 in
d:\programming\python\lib\site-packages (from scipy)
Installing collected packages: scipy
Successfully installed scipy-1.0.0
Then I tried pip install qiskit again. It showed an error:
Found existing installation: scipy 1.0.0
Uninstalling scipy-1.0.0:
Successfully uninstalled scipy-1.0.0
Running setup.py install for scipy ... error
……
numpy.distutils.system_info.NotFoundError: no lapack/blas resources found
----------------------------------------
Rolling back uninstall of scipy
So I used the second way:
git clone https://github.com/QISKit/qiskit-sdk-py
cd qiskit-sdk-py
then
pip install -r requirements.txt
again
Installing collected packages: scipy, sympy
Found existing installation: scipy 1.0.0
Uninstalling scipy-1.0.0:
Successfully uninstalled scipy-1.0.0
Running setup.py install for scipy ... error
……
numpy.distutils.system_info.NotFoundError: no lapack/blas resources found
----------------------------------------
Rolling back uninstall of scipy
how can I solve this and add QISKit to python lib?
reference:
https://github.com/QISKit/qiskit-sdk-py/blob/master/doc/install.rst#3.1-Setup-the-environment
Installing scipy, at least the version currently required by QISKit, on Windows requires that you have a couple of different compilers installed, which you probably don't. I recommend you install Anaconda. If you download the full Anaconda package, it includes the appropriate scipy binary, or alternatively you can do conda install scipy=0.19 before you do pip install qiskit.
I think that should fix your current issue but feel free to reach out with any others -- I'll be happy to help. You can also find more documentation at qiskit.org, github.com/QISKit/qiskit-sdk-py, and on the IBM Q experience community forums.
Cheers,
Doug

Resources