Certificate issue with Python3 on OSX

5,377

You are running several versions of Python 3:

  • One installed via the official installer, into /Library/Frameworks/Python.framework/Versions/3.6/ and /Applications/Python 3.6 (3.6)
  • One through Homebrew via brew install python (3.7)

These may conflict. You only need one of them anyway. I'd recommend uninstalling the first one and working with Homebrew Python only. Then you can at least be sure where potential Python issues come from.

To perform the uninstallation, you have to remove the two folders, reload your shell. You may also have to remove symlinks that still point to this Python version, which you can find with:

ls -l /usr/local/bin | grep 'Python.framework/Versions/3.6' 

Then, run brew reinstall python.

Note that your new Python 3.7 version (through Homebrew) will live in /usr/local/bin/python3, so make sure your $PATH contains this directory, and that you call python3 when you want Homebrew's Python.

You may also choose to use python for the 3.7 version. In this case, please read the note about "unversioned symlinks" in brew info python.

Share:
5,377

Related videos on Youtube

Tommaso Bendinelli
Author by

Tommaso Bendinelli

Updated on September 18, 2022

Comments

  • Tommaso Bendinelli
    Tommaso Bendinelli over 1 year

    I've the same python issue as multiple users with OSX, that appears when I'm trying to access anything via https.

    ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:749)

    I'm aware of the following solution (accepted response): https://stackoverflow.com/questions/42098126/mac-osx-python-ssl-sslerror-ssl-certificate-verify-failed-certificate-verify.

    But unfortunately, if I don't have a folder such as:

    /Applications/Python 3.6/ReadMe.rtf
    

    Hence I don't how to proceed. Particularly when I've installed python3 I did it through using

    brew install python3
    

    I also tried to up the command

    brew upgrade python3 
    

    But it hasn't changed anything. Furthermore strange enough, according to brew now I have python 3.7.2.1 installed as it returns the following error if I try again to upgrade:

    Tommasos-MBP:~ tommaso$ brew upgrade python3
    Error: python3 3.7.2_1 already installed
    

    But if I check the python3 version of my computer I get this.

    Tommasos-MBP:~ tommaso$ python3 --version
    Python 3.6.3
    

    How should I proceed and why brew think that I've 3.7 installed while Python is still 3.6?

    EDIT If I run Brew doctor I get the following:

    Warning: "config" scripts exist outside your system or Homebrew directories. ./configure scripts often look for *-config scripts to determine if software packages are installed, and what additional flags to use when compiling and linking.

    Having additional scripts in your path can confuse software installed via Homebrew if the config script overrides a system or Homebrew provided script of the same name. We found the following "config" scripts:
    /Library/Frameworks/Python.framework/Versions/3.6/bin/python3.6m-config /Library/Frameworks/Python.framework/Versions/3.6/bin/python3-config
    /Library/Frameworks/Python.framework/Versions/3.6/bin/python3.6-config

    Warning: You have unlinked kegs in your Cellar Leaving kegs unlinked can lead to build-trouble and cause brews that depend on those kegs to fail to run properly once built. Run brew link on these: python
    berkeley-db

    • slhck
      slhck over 5 years
      Please read the info in brew info python. If you run which -a python or which -a python3 you'll see where the binaries are stored, and which ones take preference. You might have to adjust your PATH accordingly. Where does your current Python 3.6.3 come from, anyway?
    • Tommaso Bendinelli
      Tommaso Bendinelli over 5 years
      Thank you for answering! I didn't know about the command brew info python! When I run which -a python3 I get the following: /Library/Frameworks/Python.framework/Versions/3.6/bin/python‌​3 /Library/Frameworks/Python.framework/Versions/3.6/bin/python‌​3 /usr/local/bin/python3
    • slhck
      slhck over 5 years
      Did you install this 3.6 version at some point? Please run brew doctor… it might tell you what to do about that Python 3.6. If you don't need it, I'd recommend uninstalling that and working with Homebrew Python only. It might require completely deleting the /Library/Frameworks/Python.framework/Versions/3.6/ folder and reinstalling the Homebrew Python.
    • Tommaso Bendinelli
      Tommaso Bendinelli over 5 years
      See edit in the post
  • Tommaso Bendinelli
    Tommaso Bendinelli over 5 years
    Thank you so much, just one question. Do I need to download again all the packages that I was using before deleting the official installer folder or they still exist? If so, how can I access them?
  • slhck
    slhck over 5 years
    You need to re-install them with pip. I'd run pip3 freeze > requirements.txt before you uninstall the old version. This will give you the output in a format that can be reinstalled at any time with pip3 install -r requirements.txt. Make sure that pip3 list actually outputs something and that pip3 correctly points to your old installation.