Problems to install pyautogui - python

I am having problems to install pyautogui. I have installed Python, Pip and Anaconda in my notebook, but when I try to install pyautogui using the code within cmd: pip install pyautogui I have the return bellow:
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:1108)'))': /simple/pyautogui/
Could not fetch URL https://pypi.org/simple/pyautogui/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pyautogui/ (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1108)'))) - skipping
ERROR: Could not find a version that satisfies the requirement pyautogui (from versions: none)
ERROR: No matching distribution found for pyautogui
Someone could help me, please?

It really depends on your setup, but here are a few things that might help:
Generally, when you're installing a package, you go to the command prompt and type something like python -m pip install pyautogui; python is written here to tell the command prompt you're using the python language, -m tells it to look for a module (in this case pip) rather than some script file name, and pip install pyautogui means you're trying to install a module called pyautogui
Pip looks in a few specific places for modules. If it doesn't find them there, it lets you know they were not found. If the module you're trying to install can't be found, generally you'll want to hunt down an actual file for it and install it with that file. However, I know it can find pyautogui, because I just installed it yesterday!
If you're using a Jupyter Notebook within Anaconda, which it sounds like you are, you may not actually want to use your computer's command prompt. Your computer may be finding a different version of Python than your Anaconda installation. So, if you want to be able to use pyautogui in Anaconda, you'll want to follow these steps:
Open Anaconda Navigator
Launch the CMD.exe prompt in the Navigator, which is set up to deal with the Anaconda installation
Type pip install pyautogui in this window and hit enter

I'm not sure about this, but i had the same problem while creating a discord bot with discord.py , what i ended doing was downloading an SSL certificate from a website( search on google there are a bunch of them) then opening the download and it automatically sets it up. And that fixed the problem for me.

Try this command
pip3 install --trusted-host pypi.org --trusted-host files.pythonhosted.org pyautogui

Related

Pip install from archive

I am trying to install Dtale in jupyter notebook. Due to the firewall restrictions, I cannot install it online. I tried to download the archive file dtale-2.2.0.tar.gz and ran this command inside the jupyter notes.
pip install <path>/dtale-2.2.0.tar.gz
This fails as it could not find pypandoc. Then I downloaded the pypandoc-1.7.5.tar.gz and ran
pip install <path>/pypandoc-1.7.5.tar.gz.
But this time I get the error:
ERROR: Could not install packages due to an OSError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Max retries exceeded with url: /packages/d2/04/08841501db81bceb7a86a98dea7c12b0185fcc69bfdf1aea266f727d1d7e/poetry_core-1.0.8-py2.py3-none-any.whl (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1129)')))
I know the host is unreachable due to the firewall, that is the reason why I downloaded the package. Can someone guide me through how to install the packages from the .gz archive file?
Thanks
this error tells you that there is a pkg in dependencies that can NOT be downloaded.
its name is poetry-core, so you should download and install it manually.
here is a url for it: https://files.pythonhosted.org/packages/d2/04/08841501db81bceb7a86a98dea7c12b0185fcc69bfdf1aea266f727d1d7e/poetry_core-1.0.8-py2.py3-none-any.whl
in case you can't download it too due to your firewall, you can use VPN.
in case you can't do that either, then you can download it from this url:
https://www.mediafire.com/file/kpnfupmf5px84um/poetry_core-1.0.8-py2.py3-none-any.whl/file
I have downloaded and re-uploaded it

Certification not working for pycharm. Mac OS

I am creating a discord bot using pycharm 3.8. while running the code i get the error:
SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1108) Discord/python
Naturally I looked this up and found this thread, the solution is to run the install certificates.command. but while running this I get this error:
ERROR: Could not install packages due to an OSError: [Errno 13] Permission denied: '/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/certifi'
Consider using the `--user` option or check the permissions.
Reading this, I used the same command in terminal (both in pycharm and the actual application) but followed by --user. This returns this message:
Requirement already satisfied: certifi in ./.local/lib/python3.8/site-packages (2021.5.30)
This leads me to think that I already have the correct certificates installed... but I still get the error stated at the start of this question. does anyone know how to fix this?
SOURCE CODE
The latest Python versions on MacOS come with their own private copy of OpenSSL. That means the trust certificates in the system are no longer used as defaults by the Python ssl module. To fix that, you need to install a certifi package in your system.
I see that you have done pip install certifi --user, but you also need to install Certificates.command.
Hence this should fix your issue: open /Applications/Python\ 3.8/Install\ Certificates.command

How to install PIP for IDLE running Python 2.7.5 on Windows 10?

I just downloaded the python 2.7.5 desktop application with Python (command line) and IDLE. I can run a simple python script directly in IDLE but I cannot access python from the windows command prompt. I tried downloading get-pip.py but I couldn't find the location of setup.py on my computer and when I try to run get-pip.py from another location using IDLE it shows this error:
"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(SSLError(1, '_ssl.c:504: error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version'),)) - skipping [31m Could not find a version that satisfies the requirement pip (from versions: )[0m [31mNo matching distribution found for pip[0m"
How can I install PIP?
Thanks in advance.
Use miniconda2 or minoconda3. Why? Miniconda has a windows installer that if installed correctly, updates the path for you. Miniconda also loads precompiled binaries so you do not need a C++ compiler, which is an annoying problem to run into on windows. Plus miniconda makes virtual enviornment setup a breeze with the command line. Also it comes with PIP if you need to fall back to it.
https://conda.io/miniconda.html

Brew Python3.7 install on Mac High OSierra 10.13.6. Help understand openssl install instructions

I am having problems installing python and keep getting openssl errors. So I have reinstalled numerous times and still struggling. I think I am not following the below instructions properly and hope someone can explain what I should do. I have read everything on openssl errors online over the last 3 weeks and am practically at the end of my wits. I will very likely give up learning to program if I can't figure this out.
I am able to install packages using pip3. But get errors if I need to access web pages. Examples of errors I get:
pip3 installed geopy but running below raises a huge error the final part of which I have included below:
import geopy
geocoder=geopy.geocoders.GoogleV3(domain="maps.google.co.uk")
geocoder.geocode('Cambridge', exactly_one=False)
'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1045)'
I can install pandas and pandas_datareader but running below raises error the final part of which follows the code:
import datetime as dt
import matplotlib.pyplot as plt
from matplotlib import style
import pandas as pd
import pandas_datareader.data as web
style.use('ggplot')
start = dt.datetime(2000,1,1)
end = dt.datetime(2016,12,31)
df = web.DataReader('TSLA', 'yahoo', start, end)
File "/usr/local/lib/python3.7/site-packages/requests/adapters.py", line 511, in send
raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='finance.yahoo.com', port=443): Max retries exceeded with url: /quote/TSLA/history?period1=946699200&period2=1483243199&interval=1d&frequency=1d&filter=history (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1045)')))
So I need to know exactly what steps to take after installing python 3.7 via brew as stated below.
Do I need to add additional certificates and as a result place a .pem file in certs directory? When and why is such an action necessary?
Do I only need to run c_rehash if the answer to question 1 is true?
Do I need to have openssl first in my path?
Do I need compilers to find openssl? Under what circumstances should I set the LDFLAGS and CPPFLAGS as stated?
Do I need pkg-config to find openssl?
Basically, I am a beginner python user and not sure how many of these things are necessary for me if I just want to install packages using pip3 and be able to securely access data and websites online.
$ brew install openssl
Updating Homebrew...
==> Downloading https://homebrew.bintray.com/bottles/openssl-1.0.2p.high_sierra.
Already downloaded: /Users/user/Library/Caches/Homebrew/downloads/f3b0a441f330cc1e6072080557f91b61256c8b0734e8348563d0efcb2af248ce--openssl-1.0.2p.high_sierra.bottle.tar.gz
==> Pouring openssl-1.0.2p.high_sierra.bottle.tar.gz
==> Caveats
A CA file has been bootstrapped using certificates from the SystemRoots
keychain. To add additional certificates (e.g. the certificates added in
the System keychain), place .pem files in
/usr/local/etc/openssl/certs
and run
/usr/local/opt/openssl/bin/c_rehash
openssl is keg-only, which means it was not symlinked into /usr/local,
because Apple has deprecated use of OpenSSL in favor of its own TLS and crypto libraries.
If you need to have openssl first in your PATH run:
echo 'export PATH="/usr/local/opt/openssl/bin:$PATH"' >> ~/.bash_profile
For compilers to find openssl you may need to set:
export LDFLAGS="-L/usr/local/opt/openssl/lib"
export CPPFLAGS="-I/usr/local/opt/openssl/include"
For pkg-config to find openssl you may need to set:
export PKG_CONFIG_PATH="/usr/local/opt/openssl/lib/pkgconfig"
==> Summary
🍺 /usr/local/Cellar/openssl/1.0.2p: 1,793 files, 12.3MB

How can I make PyCharm ignore SSL errors when installing libraries?

I am trying to install the requests library to my Python environment in PyCharm while on a company network that uses self-signed SSL certificates. As a result, installing a library with File > Settings > Project > Project Interpreter > Install fails with an HTTPS error:
Collecting requests
Retrying (Retry(total=0, connect=None, read=None, redirect=None)) after connection
broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.
VerifiedHTTPSConnection object at 0x0368D5D0>: Failed to establish a new connection:
[Errno 11003] getaddrinfo failed',)': /simple/requests/
Could not find a version that satisfies the requirement requests (from versions: )
No matching distribution found for requests
I tried making pip trust my company's root certificate by adding --cert C:\COMPANY-CAROOT.pem to my install options, which was interpreted as:
pip install --cert C:\COMPANY-CAROOT.pem requests
I also tried opening File > Settings > Project > Server Certificates and checking Accept non-trusted certificates automatically, but ran into the same issue.
How can I get PyCharm to ignore SSL certificate errors when installing external libraries?
I faced the same issue. The way I resolved it was by adding all the packages I wanted to install in a .txt file, e.g. requirements.txt containing all the package-names and their versions.
Then from the Terminal (can also be the PyCharm Terminal), I did:
pip install --trusted-host pypi.org --trusted-host files.pythonhosted.org -r requirements.txt
The key here is the use of --trusted-host. Adding the packages in a file is just for convenience.
Alternatively you can create a pip.ini file and add the trusted hosts there.

Categories