0
  • macOS 10.15.1
  • pip 20.1 from /usr/local/lib/python3.7/site-packages/pip (python 3.7)

I want to install mysql-client, but error:

$ pip install mysql-client Could not fetch URL https://pypi.org/simple/mysql-client/: There was a problem con-firming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max re-tries exceeded with url: /simple/mysql-client/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")) – skipping

pip list cannot found ssl, try pip install ssl same error as above (i.e. egg-chick-game)

but:

  • brew install mysql-client OK: mysql-client 8.0.19 is already installed and up-to-date
  • brew install openssl OK: openssl@1.1.1.1.1g is already installed and up-to-date

yet pip list cannot find both and also cannot be used in python.

Tried method from Cannot upgrade pip 9.0.1 to 9.0.3 - requirement already satisfied, not working for me.

what's the problem?

1 Answers1

0

Now found a solution working(share here, yet exact reason not found):

Initially, I want Django to connect to MySQL server, but since Django3.0 dropped Python/Connector, thus only MySQL driver is mysqlclient with 'ENGINE': 'django.db.backends.mysql'

My solution in short, is to uninstall pip and pip3 (incl. xcode and its CommandLineTools) then reinstall(brew) then, thus get python/pip configuration and links cleaned up.

(PS: the chaotic circumstance was mostly brought up by Python 2.7 & 3.7 co-existing and different installation methods, and w/ or w/o sudo)

Here are the details:

  • Tried offline install modules of ssl or mysqlclient, both NOK;
  • Tried pip install --trusted-host pypi.org --trusted-host files.pythonhosted.org ssl NOK
  • It is now working(MySQL connecting) after these:

    • uninstall pip: python -m pip uninstall pip & also pip3;
    • uninstall xcode & related python package (CommandLineTools:xcrun) & clean system reboot;
    • then brew install pip3, which firstly need to reinstall xcode/xcrun package: xcode-select --install;
    • brew upgrade python to 3.7.7 => /usr/local/bin/python3 (this process has mostly probably adjusted various ENV settings and all related modules, IMPORATANT!) ;
    • sudo pip3 install mysqlclient (eventually must sudo), successful!
    • Hereby some observations:
      • pip3 now in: /usr/local/bin/pip3 previously at /usr/bin/pip3(pip not found);
      • Strangely, pip3 in installation terminal still /usr/bin/pip3;
      • and, pip3 list finds no mysqlclient (only sudo pip3 list OK), pip warning v.19.0.3 to v20.1;
      • Yet in a new terminal pip3 at /usr/local/bin/pip3 and shows mysqlclient in pip3 list, pip3 no version warning.
  • Tried within Django API shell , works!

  • (maybe not relevant: prior to uninstall, done these still not working: brew install mysql-connector-c , brew install mariadb-connector-c )

Hope this could help others, and to find the reason and a direct solution.