How to install python modules without pip? - python

I have tried installing python modules with pip and I get the following:
proof that pip is installed
PS C:\Users\usename\AppData\Local\Programs\Python\Python37-32> pip
Usage:
pip <command> [options]
Commands:
install Install packages.
download Download packages.
uninstall Uninstall packages.
freeze Output installed packages in requirements format.
list List installed packages.
show Show information about installed packages.
check Verify installed packages have compatible dependencies.
config Manage local and global configuration.
search Search PyPI for packages.
wheel Build wheels from your requirements.
hash Compute hashes of package archives.
completion A helper command used for command completion.
help Show help for commands.
General Options:
-h, --help Show help.
--isolated Run pip in an isolated mode, ignoring environment variables and user configuration.
-v, --verbose Give more output. Option is additive, and can be used up to 3 times.
-V, --version Show version and exit.
-q, --quiet Give less output. Option is additive, and can be used up to 3 times (corresponding to
WARNING, ERROR, and CRITICAL logging levels).
--log <path> Path to a verbose appending log.
--proxy <proxy> Specify a proxy in the form [user:passwd#]proxy.server:port.
--retries <retries> Maximum number of retries each connection should attempt (default 5 times).
--timeout <sec> Set the socket timeout (default 15 seconds).
--exists-action <action> Default action when a path already exists: (s)witch, (i)gnore, (w)ipe, (b)ackup,
(a)bort).
--trusted-host <hostname> Mark this host as trusted, even though it does not have valid or any HTTPS.
--cert <path> Path to alternate CA bundle.
--client-cert <path> Path to SSL client certificate, a single file containing the private key and the
certificate in PEM format.
--cache-dir <dir> Store the cache data in <dir>.
--no-cache-dir Disable the cache.
--disable-pip-version-check
Don't periodically check PyPI to determine whether a new version of pip is available for
download. Implied with --no-index.
--no-color Suppress colored output
Then pip install requests give me this error:
PS C:\Users\username\AppData\Local\Programs\Python\Python37-32> pip install requests
Collecting requests
Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1056)'))': /simple/requests/
Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1056)'))': /simple/requests/
Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1056)'))': /simple/requests/
Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1056)'))': /simple/requests/
Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1056)'))': /simple/requests/
Could not fetch URL https://pypi.org/simple/requests/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/requests/ (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1056)'))) - skipping
Could not find a version that satisfies the requirement requests (from versions: )
No matching distribution found for requests
Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1056)'))) - skipping
I have tried installing without pip but I couldn't get that to work either.
I'm pretty sure its to do with company firewalls but can't seem to get around them.
Thanks

Related

Can't run pip install opencv-python

As title says, I can't install opencv in my anaconda prompt or in my spyder idle window due to this error:
pip install opencv-python
Defaulting to user installation because normal site-packages is not writeable
Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1129)'))) - skipping
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1129)'))': /simple/pip/
Tried to run pip install --upgrade pip but was faced with the same error output.
I am running python version 3.9.12
Has anyone experienced this?

Could not install packages due to an OSError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate (_ssl.c:1131)

I'been trying to sovle this problem by reading differents answers in here but none of them turn out to be "the solution",so I would try to breafly explain my situation so you guys can give me a clue.
The thing is that when I try to run pip install <package> it start with this warnings (just to show you, use as an example fastapi):
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate (_ssl.c:1131)'))': /packages/4f/46/226355e82ccb4be82e06269e9a546f16c1d87fbda2286fb5d36a1c31af9e/fastapi-0.75.0-py3-none-any.whl
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate (_ssl.c:1131)'))': /packages/4f/46/226355e82ccb4be82e06269e9a546f16c1d87fbda2286fb5d36a1c31af9e/fastapi-0.75.0-py3-none-any.whl
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate (_ssl.c:1131)'))': /packages/4f/46/226355e82ccb4be82e06269e9a546f16c1d87fbda2286fb5d36a1c31af9e/fastapi-0.75.0-py3-none-any.whl
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate (_ssl.c:1131)'))': /packages/4f/46/226355e82ccb4be82e06269e9a546f16c1d87fbda2286fb5d36a1c31af9e/fastapi-0.75.0-py3-none-any.whl
And it ends with:
ERROR: Could not install packages due to an OSError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Max retries exceeded with url: /packages/4f/46/226355e82ccb4be82e06269e9a546f16c1d87fbda2286fb5d36a1c31af9e/fastapi-0.75.0-py3-none-any.whl (Caused by SSLError(SSLCertVerificationError(1,'[SSL:CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate(_ssl.c:1131)')))
The first thing that I tried was pip install --trusted-host pypi.org --trusted-host files.pythonhosted.org <package>, but it only gave me another error. So I started to read about SSL Certificates, and when the error says self signed certificates it means that the server that I'm trying to connect, his certificte is self-signed by the server itself or the entity that provides the chain signature is not in the white list of the browser.
And in fact it is so!.
But when I use some of the online tools to check the certificates for this site everything seems to be reliable.
Context:
Last time I download a package was about a month ago (I realize of this yesterday)
Python version: 3.8.10 / pip version: 21.1.1
Windows 10 / Personal machine and Home network (No company permissions)
This happend at every level: when trying to build a docker, inside a venv and also at System level (outside venv)
So, I don't know where to start really. Is my local machine the problem?, is pythonhosted the problem?, Am I mixing things up?, Should I uninstall/re-install Python?
Below command should solve your problem.
pip install --trusted-host pypi.org --trusted-host files.pythonhosted.org
<package-name>
Eg:
pip install --trusted-host pypi.org --trusted-host files.pythonhosted.org
pandas

cannot install any packages in PyCharm

I was trying to install python packages in PyCharm. But I cannot see any Latest version as below:
I used pip to install some packages and it is not working and showing:
(base) C:\>pip install auto-py-to-exe
Collecting auto-py-to-exe
Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1045)'))': /simple/auto-py-to-exe/
Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1045)'))': /simple/auto-py-to-exe/
Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1045)'))': /simple/auto-py-to-exe/
Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1045)'))': /simple/auto-py-to-exe/
Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1045)'))': /simple/auto-py-to-exe/
Could not fetch URL https://pypi.org/simple/auto-py-to-exe/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/auto-py-to-exe/ (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1045)'))) - skipping
Then I tried with trusted host cmd:
(base) C:>pip install auto-py-to-exe --trusted-host pypi.org --trusted-host files.pythonhosted.org
Then it shows "Could not find a version that satisfies the requirement auto-py-to-exe (from versions: )
No matching distribution found for auto-py-to-exe"
So I tried to give it a version command:
(base) C:>pip install auto-py-to-exe from versions 2.7.5 --trusted-host pypi.org --trusted-host files.pythonhosted.org
However still shows the same issue here:
Collecting auto-py-to-exe
Could not find a version that satisfies the requirement auto-py-to-exe (from versions: )
No matching distribution found for auto-py-to-exe
Then I am out... So if anyone has any ideas, please help. Many thanks.
Follow the following https://datatofish.com/upgrade-pip/ to upgrade your pip.
You can also try manual installation: (https://pip.pypa.io/en/stable/installing/)
Download: https://bootstrap.pypa.io/get-pip.py
python get-pip.py

running pip install - on windows machine. Getting Cert errors due to web proxy

I am getting an environment ready to use Python within my corporate network. I believe due to the fact that we use SSL interception on our firewalls, python is not trusting the certificate that is being presented during the install. We use Palo Alto firewalls and if you inspect any SSL web sites you'll see that the firewall is the signing certificate for all the SSL websites. This is a windows workstation and the CA certificates are trusted within the windows cert store. When I run the command
python -m pip install --upgrade pip
I get this error
PS U:\code> python -m pip install --upgrade pip
Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1051)'))': /simple/pip/
Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1051)'))': /simple/pip/
Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1051)'))': /simple/pip/
Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1051)'))': /simple/pip/
Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1051)'))': /simple/pip/
Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1051)'))) - skipping
Requirement already up-to-date: pip in c:\program files (x86)\python37-32\lib\site-packages (10.0.1)
Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1051)'))) - skipping
I'm not sure if there's a tag to put at the end. I saw a similar question but I don't think it's related to the specific certs being used by the repository url.
link here
Any help is appreciated. Thank you!
You are behind a proxy, pip is unable to reach the python package index due to this. If your company operates a dedicated pypi clone you will have to alter the pip.ini file located at C:\Users\<you>\AppData\Roaming\pip\pip.ini. If it does not already exist, make one and use this information:
[global]
index-url = your company url
cert = location of your certs (ask IT
[search]
index = your company url
this url is usually some kind of artifactory.

Can't install pygame for python

This morning I tried install pygame on windows command prompt and get an error like this:
Microsoft Windows [Version 6.3.9600]
(c) 2013 Microsoft Corporation. All rights reserved.
C:\Users\User>pip install pygame
Collecting pygame
Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None))
after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFI
CATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certif
icate (_ssl.c:1045)'))': /simple/pygame/
Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None))
after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFI
CATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certif
icate (_ssl.c:1045)'))': /simple/pygame/
Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None))
after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFI
CATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certif
icate (_ssl.c:1045)'))': /simple/pygame/
Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None))
after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFI
CATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certif
icate (_ssl.c:1045)'))': /simple/pygame/
Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None))
after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFI
CATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certif
icate (_ssl.c:1045)'))': /simple/pygame/
Could not fetch URL https://pypi.org/simple/pygame/: There was a problem confi
rming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max r
etries exceeded with url: /simple/pygame/ (Caused by SSLError(SSLCertVerificatio
nError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to
get local issuer certificate (_ssl.c:1045)'))) - skipping
Could not find a version that satisfies the requirement pygame (from versions:
)
No matching distribution found for pygame
C:\Users\User>
So I tried running anaconda to install pygame, but I get another error.
(base) C:\Users\User>conda install -c cogsci pygame
Solving environment: failed
CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://repo.anaconda.com/pk
gs/pro/win-64/repodata.json.bz2>
Elapsed: -
An HTTP error occurred when trying to retrieve this URL.
HTTP errors are often intermittent, and a simple retry will get you on your way.
If your current network has https://www.anaconda.com blocked, please file
a support request with your network engineering team.
SSLError(MaxRetryError('HTTPSConnectionPool(host=\'repo.anaconda.com\', port=443
): Max retries exceeded with url: /pkgs/pro/win-64/repodata.json.bz2 (Caused by
SSLError(SSLError("bad handshake: Error([(\'SSL routines\', \'ssl3_get_server_ce
rtificate\', \'certificate verify failed\')])")))'))
(base) C:\Users\User>
I can't understand the error.The command was working before but it doesn't work now.I thought it is connection error but I can run any website smoothly.What should I do?
It's possible to install PyGame on Windows by visiting pygame.org and downloading an .MSI installer. This does not rely on pip or anaconda.
The issue you are receiving seems to be an SSL certificate problem, and is nothing to do with PyGame. Both your installation methods are having the same problem with SSL.

Categories

Resources