Unable to install mysql-connector-python in pycharm - python

Following is the error produced when I try to install "mysql-connector-python" in pycharm. Any help would be great.
Non-zero exit code(1)
Try to run this command from the system terminal. Make sure that you use the correct version of 'pip' installed for your Python interpreter located at 'C:\Users\karan.gupta\AppData\Local\Programs\Python\Python36-32\python.exe'.
Collecting mysql-connector-python
Could not fetch URL https://pypi.python.org/simple/mysql-connector-python/: There was a problem confirming the ssl certificate: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:748) - skipping
Could not find a version that satisfies the requirement mysql-connector-python (from versions: )
No matching distribution found for mysql-connector-python

Run pip install mysql-connector from your Terminal, as the error handler suggests. Or try to run the same command from wherever you've already tried, but without the -python at the end.

Click here!
Use MySQLdb instead, i used it and it's working fine. Method is in the blog.
Hope it will help you

I believe this version of the connector works only with python 2.7, if you try installing it with python 2.7 version, maybe it will work.

Related

SSL error on macOS Monterey when using python urllib via RDFLib

So I have been getting the following error when trying to request an HTTPS resource using the python RDFLib module:
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/urllib/request.py", line 1351, in do_open
raise URLError(err)
urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:997)>
What I have tried thus far:
Installed Python 3.10.4 from python.org
Executed the Install Certificates.command successfully tried the request again and I get the same error
Created a virtual environment using python3 -m venv venv which is based on Python 3.10.4, activated it, updated certifi just in case using pip3 install certifi --upgrade as it was suggested in other posts, and tried the request again and I still got the error.
Out of desperation, I did a clean install of Monterey and still get the same error
So it appears that the issue is that the certificates are not actually getting installed even though the command executes successfully:
/Applications/Python\ 3.10/Install\ Certificates.command ; exit;
meh#iMac ~ % /Applications/Python\ 3.10/Install\ Certificates.command ; exit;
-- pip install --upgrade certifi
Requirement already satisfied: certifi in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (2021.10.8)
-- removing any existing file or link
-- creating symlink to certifi certificate bundle
-- setting permissions
-- update complete
Saving session...
...copying shared history...
...saving history...truncating history files...
...completed.
I have actually been trying to solve this for many months, coming back and trying again and again but I can't seem to find a solution.
This seems to be a common issue that is usually resolved by executing the Install Certificates.command but that simply doesn't work for me. It's worth noting that I have the same issue on a brand new MacBook Pro with Monterey.
I would appreciate any suggestions on what I can try next.
It turns out that the target resource has a misconfigured certificate. Since there is no way to disable certificate verification in RDFLib - as far as I can tell - I have worked around the solution by requesting the resource via the python requests module with verify=False instead. Then I load the resource into RDFLib as text.

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

Error while installing pip using get-pip.py with Python2.7.10

I am using Python2.7.10 on a Windows10 machine, and wish to install pip.
I followed the instructions from here to get the get-pip.py file, but when I try to run it I get the following error:
Could not install packages due to an EnvironmentError: [Errno 42] Illegal byte sequence
I found that if I install an older version of pip (for Python2.6) then the installation is successful, and I can use pip regularly. If I try to use this older version (9.0.3) to install the newer one (18.0) then I get the same error message.
The complete log of the installation is below (1). If I manually install setuptools then I get the same message when it tries to download the next package:
Any assistance with installing the newer version will be much appreciated :-)
1)
C:\Python27\Lib\site-packages>python get-pip.py
Collecting pip
Using cached https://files.pythonhosted.org/packages/5f/25/e52d3f31441505a5f3af41213346e5b6c221c9e086a166f3703d2ddaf940/pip-18.0-py2.py3-none-any.whl
Collecting setuptools
Downloading https://files.pythonhosted.org/packages/ff/f4/385715ccc461885f3cedf57a41ae3c12b5fec3f35cce4c8706b1a112a133/setuptools-40.0.0-py2.py3-none-any.whl (567kB)
1% |Could not install packages due to an EnvironmentError: [Errno 42] Illegal byte sequence
Update: after installing several packages manually I was able to install the new pip version. It obviously didn't solve the problem, and pip is still not working. When trying to use it, the same error message appears at every attempted download. See log at (2). I double checked the address, and it appears to be correct.
2)
Collecting Requests
Downloading https://files.pythonhosted.org/packages/65/47/7e02164a2a3db50ed6d8a6ab1d6d60b69c4c3fdf57a284257925dfc12bda/requests-2.19.1-py2.py3-none-any.whl (91kB)
11% |Could not install packages due to an EnvironmentError: [Errno 42] Illegal byte sequence
Thanks
tl;qr - add the quiet flag (-q) to your command
While trying to debug I redirected the output to a file:
python -m pip install requests > .\temp.txt
Surprisingly, everything suddenly worked!
It appears there is a known bug (Thanks Matan M) while displaying the progress bar to the console. Basically, any solution that would avoid writing it would work.
Here are some options:
Use the -q flag
Turn off the progress bar using --progress-bar off
Redirect to a temp file
:-)
Hi check if you added the relevant python paths to the PATH.
pip install <package> -q **or**
--progress-bar off

SSL error while pip3 install

I am new to coding. While i try to install python-forecastio using pip3 for python3,it gives me below error.
$ sudo pip3 install --trusted-host pypi.python.org python-forecastio
pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Collecting python-forecastio
Could not fetch URL https://pypi.python.org/simple/python-forecastio/: There was a problem confirming the ssl certificate: Can't connect to HTTPS URL because the SSL module is not available. - skipping
Could not find a version that satisfies the requirement python-forecastio (from versions: )
No matching distribution found for python-forecastio
What is wrong is, as you may have guessed, the SSL module is not available.
So the simple way to fix the problem is to reinstall python. But the alternative is to run this simple line of code: import ssl. If you get an error you will know your python 3 installation is corrupt so you need to reinstall python, or if you don't get an error try using easy_install-3.x (what ever the module or link you want)(Use the specific python you have installed version in place of "x"). Hope I helped!
-Zeus

Categories