How to Install a Python for Machine Learning on macOS

It can be difficult to install a Python machine learning environment on Mac OS X.

Python itself must be installed first, and then there are many packages to install, and it can be confusing for beginners.

In this tutorial, you will discover how to setup a Python 3 machine learning and deep learning development environment using macports.

After completing this tutorial, you will have a working Python 3 environment to begin learning, practicing, and developing machine learning and deep learning software.

Kick-start your project with my new book Machine Learning Mastery With Python, including step-by-step tutorials and the Python source code files for all examples.

Let’s get started.

  • Update Aug/2017: Added a section on how to keep your environment up to date.
How to Install a Python 3 Environment on Mac OS X for Machine Learning and Deep Learning

How to Install a Python 3 Environment on Mac OS X for Machine Learning and Deep Learning

Tutorial Overview

This tutorial is broken down into the following 4 steps:

  1. Install XCode Tools
  2. Install Macports
  3. Install SciPy Libraries
  4. Install Deep Learning Libraries
  5. Keep Your Environment Up-to-Date

1. Install XCode

XCode is the IDE for development on OS X.

Installation of XCode is required because it contains command line tools needed for Python development. In this step, you will install XCode and the XCode command line tools.

This step assumes you already have an Apple App Store account and that you have sufficient administrative privileges to install software on your workstation.

  • 1. Open the “App Store” application. Search for “XCode” and click the “Get” button to install.

You will be prompted to enter your App Store password.

XCode is free and is at least 4.5 GB in size and may take some time to download.

App Store Search for XCode

App Store Search for XCode

  • 2. Open “Applications” and then locate and start “XCode“.

You may be prompted with a message to install additional components before XCode can be started. Agree and install.

Install Additional XCode Components

Install Additional XCode Components

  • 3. Install the XCode Command Line Tools, Open a terminal window and type:

A dialog will appear and install required tools.

Confirm the tools are installed by typing:

You should see output like:

  • 4. Agree to the license agreement (if needed). Open a terminal window and type:

Use the “space” key to navigate to the bottom and agree.

You now have XCode and the XCode Command Line Tools installed.

2. Install Macports

Macports is a package management tool for installing development tools on OS X.

In this step, you will install the macports package management tool.

  • 1. Visit macports.org
  • 2. Click the “Download” button at the top of the page to access the install page.
  • 3. Download the “macOS Package (.pkg) Installer” for your version of OS X.

At the time of writing, the latest version of OS X is Sierra.

Macports Package Installation

Macports Package Installation

You should now have a package on your workstation. For example:

  • 4. Double click the package and follow through the wizard to install macports.
Macports Installation Wizard

Macports Installation Wizard

  • 5. Update macports and confirm the system is working as expected. Open a terminal window and type:

This will update the port command and the list of available ports and is useful to do from time to time.

You should see a message like:

3. Install SciPy and Machine Learning Libraries

SciPy is the collection of scientific computing Python libraries needed for machine learning development in Python.

In this step, you will install the Python 3 and SciPy environment.

  • 1. Install Python version 3.5 using macports. Open a terminal and type:

To make this the default version of Python, type:

Close the terminal window and reopen it.

Confirm that Python 3.5 is now the default Python for the system by typing:

You should see the message below, or similar:

  • 2. Install the SciPy environment, including the libraries:
    • NumPy
    • SciPy
    • Matplotlib
    • Pandas
    • Statsmodels
    • Pip (package manager)

Open a terminal and type:

This may take some time to download and install.

To ensure pip for Python 3 is the default for the system, type:

  • 3. Install scikit-learn using pip. Open the command line and type:

  • 4. Confirm the libraries were installed correctly. Open a text editor and write (copy-paste) the following script:

Save the script with the filename versions.py.

Change directory to the location where you saved the script and type:

The output should look like the following (or similar):

What versions did you get?
Paste the output in the comments below.

You can use these commands to update machine learning and SciPy libraries as needed.

Try a scikit-learn tutorial, such as:

4. Install Deep Learning Libraries

In this step, we will install Python libraries used for deep learning, specifically: Theano, TensorFlow, and Keras.

  • 1. Install the Theano deep learning library by typing:

  • 2. Install the TensorFlow deep learning library by typing:

  • 3. To install Keras, type:

  • 4. Confirm your deep learning environment is installed and working correctly.

Create a script that prints the version numbers of each library, as we did before for the SciPy environment.

Save the script to a file deep_versions.py.

Run the script by typing:

You should see output like:

What versions did you get?
Paste the output in the comments below.

Try a Keras deep learning tutorial, such as:

5. Keep Your Environment Up-to-Date

It is important to keep your environment up to date over time.

It is also important to use the same tools to update your libraries that were used to install the, e.g. macports and pip.

This section provides commands you can use, say once per month, to ensure that your environment is up to date.

Update Libraries Installed With Macports

The first step is to update macports itself.

Next, you can update the libraries that you installed using macports.

You can also update all libraries that need an update by typing:

I don’t do this myself as I don’t have control over what is being updated.

Update Libraries Installed With Pip

Next, we can update the libraries installed with pip.

I don’t want pip to install or update things that can be installed with macports, so I update libraries installed with pip without updating dependencies (e.g. –no-deps)

And that’s all you need to do to keep your environment up to date.

If you get some crossover between macports and pip, (e.g. numpy installed by both tools), you can get problems.

To see what exactly is installed with pip type:

Further Reading

This section provides some resources for further reading.

Summary

Congratulations, you now have a working Python development environment on Mac OS X for machine learning and deep learning.

You can now learn and practice machine learning and deep learning on your workstation.

How did you do?
Let me know in the comments below.

Discover Fast Machine Learning in Python!

Master Machine Learning With Python

Develop Your Own Models in Minutes

...with just a few lines of scikit-learn code

Learn how in my new Ebook:
Machine Learning Mastery With Python

Covers self-study tutorials and end-to-end projects like:
Loading data, visualization, modeling, tuning, and much more...

Finally Bring Machine Learning To
Your Own Projects

Skip the Academics. Just Results.

See What's Inside

79 Responses to How to Install a Python for Machine Learning on macOS

  1. Avatar
    Mrigank Tiwari March 16, 2017 at 2:11 am #

    scipy: 0.18.1
    numpy: 1.11.3
    matplotlib: 2.0.0
    pandas: 0.19.2
    statsmodels: 0.6.1
    sklearn: 0.18.1

  2. Avatar
    SamarthHalyal March 17, 2017 at 9:53 pm #

    scipy: 0.19.0
    numpy: 1.12.0
    matplotlib: 2.0.0
    pandas: 0.19.2
    statsmodels: 0.8.0
    sklearn: 0.18.1

  3. Avatar
    Phil Salm March 27, 2017 at 1:33 pm #

    I was very excited to find your post because I have had a miserable time trying to get a stable version of Python to work on my Mac. I followed your post above, except installed 3.6.1 since it is the latest. So I substituted ’36’ for ’35’ in all of the commands. Everything worked great until I tried the following command:

    sudo port select –set pip pip36

    I ended up with an error indicating “The specified group ‘pip’ does not exist.’ Any ideas?

    • Avatar
      Phil Salm March 27, 2017 at 3:12 pm #

      I found the issue was that I hadn’t installed pip because that part of the install line above was truncated on the display. Once I did that, I was able to follow the remaining steps without a problem. Once that is all done, any idea where the Python compiler is located? I’d like to use it with PyCharm.

      • Avatar
        Jason Brownlee March 28, 2017 at 8:21 am #

        Glad to here it.

        You can type:

        • Avatar
          Phil Salm March 28, 2017 at 10:48 am #

          Thank you. That did help me locate the correct interpreter for PyCharm to use. But, for some reason when I try to import the keras module, it doesn’t recognize it even after successfully running the install above. In fact, when I try to run that install again, it says it already is installed.

        • Avatar
          Phil Salm March 28, 2017 at 11:35 am #

          It’s all working now. Thank you for your post and your additional help! Time for me to purchase your books!

          • Avatar
            Jason Brownlee March 29, 2017 at 9:05 am #

            I’m very glad to hear you got it working!

    • Avatar
      Jason Brownlee March 28, 2017 at 8:20 am #

      You may need the new path to take effect.

      Consider closing and opening the terminal window or restarting the computer.

  4. Avatar
    Nidhi Sharma April 1, 2017 at 1:42 am #

    Hi, This is great. it worked for me the first time. However, I am trying to install on a second machine.
    My python versions are showing correctly, in spite for below steps.

    1. Install Python version 3.5 using macports. Open a terminal and type:
    sudo port install python35

    To make this the default version of Python, type
    sudo port select –set python python35
    sudo port select –set python3 python35

    Close the terminal window and reopen it.

    Confirm that Python 3.5 is now the default Python for the system by typing:

    python -V

    Last command continue to give me Python 2.7.10, even though I have 3.5, 3.6 installed.
    Can you please help.

  5. Avatar
    Ram April 1, 2017 at 10:22 pm #

    scipy: 0.19.0
    numpy: 1.12.1
    matplotlib: 2.0.0
    pandas: 0.19.2
    statsmodels: 0.8.0
    sklearn: 0.18.1

  6. Avatar
    PJ May 29, 2017 at 9:03 am #

    Hello Jason I am getting these errors:

    python versions.py
    scipy: 0.19.0
    numpy: 1.12.1
    matplotlib: 2.0.0
    pandas: 0.20.1
    Traceback (most recent call last):
    File “versions.py”, line 14, in
    import statsmodels
    ImportError: No module named ‘statsmodels’

    sudo pip install statsmodel
    Could not find a version that satisfies the requirement statsmodel (from versions: )
    No matching distribution found for statsmodel

    python deep_versions.py
    Traceback (most recent call last):
    File “deep_versions.py”, line 2, in
    import theano
    ImportError: No module named ‘theano’

    I haven’t found any solutions yet on SO. Any ideas? Thanks,
    PJ.

    • Avatar
      Jason Brownlee June 2, 2017 at 12:19 pm #

      Ouch. You could try skipping statsmodels. It’s not needed for deep learning.

  7. Avatar
    Mayra June 14, 2017 at 1:00 am #

    Thank you Jason! Everything worked out as planned.

    I did everything replacing “35” with “36” , since I’m using python 3.6.

    During the installations I got this message:
    ##############################################################
    # IF YOU ARE USING PYTHON FROM THE TERMINAL, PLEASE INSTALL:
    # py36-readline
    # TO AVOID A LIBEDIT / PYTHON INTERACTION ISSUE.
    # REF: https://trac.macports.org/ticket/48807
    ##############################################################

    I’m assuming I should, right? If so, should the commands be “sudo pip install py36-readline” ?
    Please advice : )

    Thanks again, Mayra

    Here are the versions I got:
    scipy: 0.19.0
    numpy: 1.13.0
    matplotlib: 2.0.2
    pandas: 0.20.2
    statsmodels: 0.8.0
    sklearn: 0.18.1

    theano: 0.9.0
    tensorflow: 1.1.0
    Using TensorFlow backend.
    keras: 2.0.5

    • Avatar
      Jason Brownlee June 14, 2017 at 8:46 am #

      Nice work!

      Sorry, I don’t know about readline, I have not seen this message before.

  8. Avatar
    Pradep June 26, 2017 at 9:29 pm #

    scipy: 0.19.0
    numpy: 1.13.0
    matplotlib: 2.0.2
    pandas: 0.20.2
    statsmodels: 0.8.0
    sklearn: 0.18.2

    theano: 0.9.0
    tensorflow: 1.2.0
    Using TensorFlow backend.
    keras: 2.0.5

  9. Avatar
    Ishmael August 9, 2017 at 11:20 am #

    scipy: 0.19.1
    numpy: 1.13.1
    matplotlib: 2.0.2
    pandas: 0.20.3
    statsmodels: 0.8.0
    sklearn: 0.18.2

  10. Avatar
    Ot Ratsaphong August 23, 2017 at 8:54 pm #

    scipy: 0.19.1
    numpy: 1.13.1
    matplotlib: 2.0.2
    pandas: 0.20.3
    statsmodels: 0.8.0
    sklearn: 0.19.0

    theano: 0.9.0
    tensorflow: 1.3.0
    keras: 2.0.7
    Thank you for the clear documentation.

  11. Avatar
    Brian Griner January 19, 2018 at 12:54 pm #

    scipy: 1.0.0
    numpy: 1.14.0
    matplotlib: 2.1.1
    pandas: 0.22.0
    statsmodels: 0.8.0
    sklearn: 0.19.1

  12. Avatar
    Brian Griner January 19, 2018 at 12:58 pm #

    scipy: 1.0.0
    numpy: 1.14.0
    matplotlib: 2.1.1
    pandas: 0.22.0
    statsmodels: 0.8.0
    sklearn: 0.19.1

    SORRY. TYPO ON EMAIL.

    So 3.5 is the py version compatible all these deep learning libs? What about Anaconda? I had some trouble running sklearn from your missing values post using the Pima dataset. I checked ‘which python’ and I had custom version of 3.6 that included a weird hash in the filename?

  13. Avatar
    Brian Griner January 19, 2018 at 1:04 pm #

    theano: 1.0.1
    tensorflow: 1.4.1
    Using TensorFlow backend.
    keras: 2.1.3

  14. Avatar
    Brian Griner January 19, 2018 at 1:09 pm #

    altgraph==0.15
    bleach==1.5.0
    Bottleneck==1.2.1
    cycler==0.10.0
    Cython==0.27.3
    enum34==1.1.6
    html5lib==0.9999999
    Keras==2.1.3
    macholib==1.9
    Markdown==2.6.11
    matplotlib==2.1.1
    modulegraph==0.16
    nose==1.3.7
    numexpr==2.6.4
    numpy==1.14.0
    pandas==0.22.0
    patsy==0.5.0
    protobuf==3.5.1
    py2app==0.14
    pycairo==1.15.4
    pyobjc-core==3.0.4
    pyobjc-framework-Cocoa==3.0.4
    pyparsing==2.2.0
    python-dateutil==2.6.1
    pytz==2017.3
    PyYAML==3.12
    scikit-learn==0.19.1
    scipy==1.0.0
    six==1.11.0
    statsmodels==0.8.0
    tables==3.4.2
    tensorflow==1.4.1
    tensorflow-tensorboard==0.4.0
    Theano==1.0.1
    tornado==4.5.2
    Werkzeug==0.14.1

    The directory ‘/Users/briangriner/Library/Caches/pip/http’ or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo’s -H flag.

    Hum… I wonder who owns that directory and who disabled the cache?

  15. Avatar
    Nindita January 24, 2018 at 2:57 am #

    scipy: 1.0.0
    numpy: 1.14.0
    matplotlib: 2.1.1
    pandas: 0.22.0
    statsmodels: 0.8.0
    sklearn: 0.19.1

  16. Avatar
    Gustavo January 31, 2018 at 11:21 pm #

    Is there a reason to use python35 over python36?

    Great post! Switched from homebrew to MacPorts after reading this. Couldn’t get a stable env with homebrew. Thank you!

    • Avatar
      Jason Brownlee February 1, 2018 at 7:22 am #

      No. I use Python 3.6 now. I will update the post soon.

  17. Avatar
    Luke February 17, 2018 at 2:31 am #

    scipy: 1.0.0
    numpy: 1.14.0
    matplotlib: 2.1.2
    pandas: 0.22.0
    statsmodels: 0.8.0
    sklearn: 0.19.1
    theano: 1.0.1
    tensorflow: 1.5.0
    Using TensorFlow backend.
    keras: 2.1.4

  18. Avatar
    Evan March 8, 2018 at 12:13 pm #

    scipy: 1.0.0
    numpy: 1.14.1
    matplotlib: 2.1.1
    pandas: 0.22.0
    statsmodels: 0.8.0
    sklearn: 0.19.1

  19. Avatar
    Mike Chen April 1, 2018 at 4:29 am #

    while I use Command + B in Sublime Text 3, I have got the following versions for versions.py. It is pretty good.

    scipy: 1.0.1
    numpy: 1.14.2
    matplotlib: 2.1.1
    pandas: 0.22.0
    sklearn: 0.19.1
    [Finished in 1.2s]

    Also, I test deep_versions.py fo r the following result. But TensorFlow seems has a problem in runtime.

    theano: 1.0.1
    /opt/local/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/importlib/_bootstrap.py:222: RuntimeWarning: compiletime version 3.6 of module ‘tensorflow.python.framework.fast_tensor_util’ does not match runtime version 3.5
    return f(*args, **kwds)
    tensorflow: 1.7.0
    Using TensorFlow backend.
    keras: 2.1.5
    [Finished in 2.5s]

  20. Avatar
    Mike Chen April 1, 2018 at 5:23 pm #

    Although I get the result of the deep_versions, there is the warning occured: RuntimeWarning: compiletime version 3.6 of module ‘tensorflow.python.framework.fast_tensor_util’ does not match runtime version 3.5
    return f(*args, **kwds)
    tensorflow: 1.7.0

    Is this problem serious? How can solve the matching problem between compiletime version 3.6 and runtime version 3.5?

    Please give me your advice. Thanks in advance.

    • Avatar
      Jason Brownlee April 2, 2018 at 5:21 am #

      No, safe to ignore. You could look at updating to Python 3.6.

  21. Avatar
    Jaap November 27, 2018 at 8:37 am #

    scipy: 1.1.0
    numpy: 1.15.4
    matplotlib: 3.0.2
    pandas: 0.23.4
    statsmodels: 0.9.0
    sklearn: 0.20.1

    so far so good!

  22. Avatar
    Jaap Vreugdenhil November 27, 2018 at 8:45 am #

    theano: 1.0.3
    tensorflow: 1.12.0
    Using TensorFlow backend.
    keras: 2.2.4

  23. Avatar
    Jaap November 29, 2018 at 8:41 am #

    HI Jason, Do I really need Xcode? Seems unable to select te python interpreter. If so, I cannot use this IDE. Any suggestions?

  24. Avatar
    Jaap November 30, 2018 at 6:02 am #

    ok, tnx

  25. Avatar
    Florin Gheorghisor January 14, 2019 at 3:32 am #

    scipy: 1.2.0
    numpy: 1.15.4
    matplotlib: 3.0.2
    pandas: 0.23.4
    statsmodels: 0.9.0
    sklearn: 0.20.2

  26. Avatar
    Gary Morton February 15, 2019 at 9:09 am #

    What is macports needed for?
    Hi I built a new environment following these intructions and rather happy to have a stable environment but remain unclear as to the purpose of macports

    What does it achieve here?

    Thank you

    • Avatar
      Jason Brownlee February 15, 2019 at 2:21 pm #

      Macports is used to install libraries on mac, it is an alternative to brew, and comparable to yum/rpm on linux.

  27. Avatar
    Jarek April 14, 2019 at 6:35 pm #

    Hi Jason,

    we don’t you use or propose virtualenv. Sooner or later we will have time where one experiment needs a different version of ML/DL libraries for compatibility than the other.

  28. Avatar
    Antonina July 19, 2019 at 10:44 pm #

    i think i have a problem here
    Antoninas-MacBook-Pro:~ antoninapanagiotou$ python versions.py
    scipy: 1.3.0
    numpy: 1.16.4
    matplotlib: 3.1.1
    Fontconfig warning: ignoring UTF-8: not a valid region tag
    pandas: 0.25.0
    statsmodels: 0.10.0
    Traceback (most recent call last):
    File “versions.py”, line 17, in
    import sklearn
    ModuleNotFoundError: No module named ‘sklearn’

  29. Avatar
    antonina July 22, 2019 at 9:06 pm #

    something went wrong when I tried an example and here is the thing..
    sudo pip install theano
    Requirement already satisfied: theano in /opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (1.0.4)
    Requirement already satisfied: numpy>=1.9.1 in /opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (from theano) (1.16.4)
    Requirement already satisfied: scipy>=0.14 in /opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (from theano) (1.3.0)
    Requirement already satisfied: six>=1.9.0 in /opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (from theano) (1.12.0)
    (base) Antoninas-MacBook-Pro:~ antoninapanagiotou$ python deep_versions.py
    Traceback (most recent call last):
    File “deep_versions.py”, line 2, in
    import theano
    ModuleNotFoundError: No module named ‘theano’

    • Avatar
      Jason Brownlee July 23, 2019 at 8:01 am #

      Interesting. Perhaps you have two versions of Python installed, where pip is installing for one, and the python interpreter is running another?

      • Avatar
        antonina July 24, 2019 at 8:20 pm #

        no i’ve setted the default one python3.7
        i don’t know if by installing anaconda.pkg everything messed up

  30. Avatar
    Tom Rosenquist September 10, 2019 at 12:10 am #

    Loving your tutorials.

    scipy: 1.3.1
    numpy: 1.17.1
    matplotlib: 3.0.3
    pandas: 0.25.1
    statsmodels: 0.10.1
    sklearn: 0.21.3

    But I also received these messages:
    Unable to revert mtime: /usr/X11/lib/X11/fonts/Speedo
    Unable to revert mtime: /usr/X11/lib/X11/fonts/cyrillic
    Unable to revert mtime: /usr/X11/lib/X11/fonts/util
    Unable to revert mtime: /usr/X11/lib/X11/fonts/encodings/large

    The deep learning script returned a lot of future warnings.

    • Avatar
      Jason Brownlee September 10, 2019 at 5:49 am #

      Nice work!

      Ouch, perhaps ignore for now?

      Yes, Keras needs an update, it is long over due! Ignore the warnings from TF for now.

  31. Avatar
    Andrew C Scott October 18, 2019 at 6:30 am #

    scipy: 1.3.1
    numpy: 1.17.2
    matplotlib: 3.1.1
    pandas: 0.25.1
    statsmodels: 0.10.1
    sklearn: 0.21.3

    theano: 1.0.4
    tensorflow: 2.0.0
    Using TensorFlow backend.
    keras: 2.3.1

  32. Avatar
    JG December 28, 2019 at 9:23 pm #

    Dear Jason:

    Thank you for the support and tutorials

    Motivation: Due to recent mac os upgrade from Mojave to Catalina 10.15 they uninstall anaconda from root directories and because I used the old 2.7 anaconda I decided to reinstall all my python+tensorflow+keras environment according to this tutorials.

    Here are my experience that I share according to your instructions:

    1) after installing MacPorts …you have to close and reopen terminal in order to get the right answer of updated to the command : ‘sudo port selfupdate’

    2) I though Anaconda or Miniconda take better care of modules dependencies installation, but the way you propose through MacPorts you have to take car of it…is it right?

    3) to me installing Keras and tensorflow is the base for my software, but Keras said it required that the only current python compatibility is 2.7 or 3.6 version …so installing 3.5 python must be corrected from this tutorial to 3.6

    4) in keras page installation to other software are recommended for installation:

    4.1) h5py, that I understand it is already included in pyhton 3.6…nothing additional to do it

    4.2) pydot (for visual python utilities)…but because they recommended install by pip … I decided to do the same command installation structure as you do for scikit-leanr with pip :1
    sudo pip install -U pydot am I right?

    4.3) regarding graphviz (also a visual utility) I follow the Macport recommedation installation:
    sudo port install py36-graphviz … is it right?
    But I see that they install dependencies like python 3.7 …so I am little concern if something is wrong …

    so jason my questions regarding this item 4 are finally :
    do we to install ‘pydot’ and ‘graphviz’?
    and how? to avoid dependencies confusion…

    5) I install theano, but I am not interested in used it…anyway how tensorflow ‘magically’ is running as backend under Keras, if the commands for tensorflow and theano installation are the same privileges?

    6) i was using Atom for python script editions but It is not currently possible installing …due to Catalina…any suggestion of how to do it or which other sofware suggestion for replacing it?

    7) I also share my installed versions
    scipy: 1.4.1
    numpy: 1.17.4
    matplotlib: 3.1.2
    pandas: 0.25.3
    statsmodels: 0.10.2
    sklearn: 0.22
    h5py: 2.10.0
    graphviz: 0.12
    pydot: 1.4.1

    theano: 1.0.4
    tensorflow: 2.0.0
    Using TensorFlow backend.
    keras: 2.3.1

    thank you for your nice job
    JG

    • Avatar
      Jason Brownlee December 29, 2019 at 6:05 am #

      Nice work. Thanks for sharing.

      From memory, I believe you install pydot and graphviz, not pygraphviz.

  33. Avatar
    JG January 10, 2020 at 8:29 pm #

    Dear Jason,

    I also experience the :
    ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] on my Mac using Macport installation manager for my Python 3.6/keras …environment

    I noticed it when I try to download any dataset from any Internet url …when apply for example keras dataset methods such as as “.load_data” for datasets as a MNIST, CIFAR, etc.

    Following your specific recommendation, I apply the following Unix command to really install certifications verifications for any url Internet access:

    $ sudo port install curl-ca-bundle

    And the problem was solved !

    Thank your very much Jason for your continuous help and support on these matters !

    regards
    JG

  34. Avatar
    JG January 17, 2020 at 5:58 am #

    In addition to add pydot and h5py (with pip installer) and graphviz (with macports installer) libraries for visualization and disk saving keras utilities

    I have noticed that for images keras useful preprocessing library we have to add also Pillow library (I install also with pip using -U option )…

    So I recommend to add these to this tutorials for Keras/tensorflow development…

    so now I expect to have an standard library for keras machine learning

    regards

    • Avatar
      Jason Brownlee January 17, 2020 at 6:09 am #

      Absolutely!

      I will schedule time to update the tutorial.

  35. Avatar
    robert olesen March 7, 2020 at 1:32 am #

    I followed these instructions but when I type python -V I get, Python 2.6.15 but I should get Python3.7. I used sudo port select –set python python37 but it made no difference?

    I am also getting the error “no module pandas found” when I run versions.py.

    Any ideas? Thanks!

    • Avatar
      Jason Brownlee March 7, 2020 at 7:20 am #

      That is odd.

      Ensure that macports was install for the whole syste,
      Ensure the ports were instaleld using sudo.
      Perhaps close and re-open your terminal window after installing and checking the version.

      Let me know how you go.

      • Avatar
        robert olesen March 8, 2020 at 1:42 am #

        I rebooted and everything works! The only remaining stumble is an error “no module ‘stats models’ found?

        Thank you so much.

        • Avatar
          Jason Brownlee March 8, 2020 at 6:12 am #

          Well done!

          It suggests statsmodels is not installed. You don’t need statsmodels unless you are using univariate time series models or some statistical methods.

  36. Avatar
    Zak May 3, 2020 at 1:40 pm #

    Hi! I went through all of these steps and my computer took several hours installing of these directories like numpy and matplotlib, yet when I run version.py I am still getting the error of “No module named ‘numpy'”. I’ve been trying to figure out how to install these all day long. How can I get them to work? I am at a loss.

Leave a Reply