Handson-ml: Chapter 2, End-to-End Machine Learning Project

Created on 29 Dec 2018  Â·  6Comments  Â·  Source: ageron/handson-ml

I couldn't fetch the data for the project, and the author's source code even also failed. There could be some problems with the database or the source. I am a freshman. Can anyone help me to handle this?
image

Most helpful comment

Hi @ZavierLyu ,

It looks like your Python installation is not quite finished, since it cannot open an SSL connection (to download the data using HTTPS).

Did you follow the installation instructions on the project's home page? In particular:

Any Python 3 version should be fine, preferably 3.5 or 3.6 (TensorFlow support for Python 3.7 is coming soon). If you don't have Python 3, I recommend installing it (Python ≥2.6 should work, but it is deprecated so Python 3 is preferable). To do so, you have several options: on Windows or MacOSX, you can just download it from python.org. On MacOSX, you can alternatively use MacPorts or Homebrew. If you are using Python 3.6 on MacOSX, you need to run the following command to install the certifi package of certificates because Python 3.6 on MacOSX has no certificates to validate SSL connections (see this StackOverflow question):

$ /Applications/Python 3.6/Install Certificates.command

In short, I think you just need to open a terminal and run the command /Applications/Python\ 3.6/Install\ Certificates.command

If this does not work, try: pip3 install --upgrade certifi

Then restart Jupyter and try again.

In general, when you run into a bug, you can try googling "Python" + the error message. In this case, googling "python certificate_verify_failed" gives you a bunch of answers. More often than not, there is a good StackOverflow question with the correct answer, for example this one. Be sure to check the top few answers, as the top one is not always the best. For example, in this case the top answer recommends turning off HTTPS completely: it will work (which is why it was upvoted), but it is a terrible idea as it will seriously compromise your computer's security. The second answer is correct in this case.

Hope this helps,
Aurélien

All 6 comments

Hi @ZavierLyu ,

It looks like your Python installation is not quite finished, since it cannot open an SSL connection (to download the data using HTTPS).

Did you follow the installation instructions on the project's home page? In particular:

Any Python 3 version should be fine, preferably 3.5 or 3.6 (TensorFlow support for Python 3.7 is coming soon). If you don't have Python 3, I recommend installing it (Python ≥2.6 should work, but it is deprecated so Python 3 is preferable). To do so, you have several options: on Windows or MacOSX, you can just download it from python.org. On MacOSX, you can alternatively use MacPorts or Homebrew. If you are using Python 3.6 on MacOSX, you need to run the following command to install the certifi package of certificates because Python 3.6 on MacOSX has no certificates to validate SSL connections (see this StackOverflow question):

$ /Applications/Python 3.6/Install Certificates.command

In short, I think you just need to open a terminal and run the command /Applications/Python\ 3.6/Install\ Certificates.command

If this does not work, try: pip3 install --upgrade certifi

Then restart Jupyter and try again.

In general, when you run into a bug, you can try googling "Python" + the error message. In this case, googling "python certificate_verify_failed" gives you a bunch of answers. More often than not, there is a good StackOverflow question with the correct answer, for example this one. Be sure to check the top few answers, as the top one is not always the best. For example, in this case the top answer recommends turning off HTTPS completely: it will work (which is why it was upvoted), but it is a terrible idea as it will seriously compromise your computer's security. The second answer is correct in this case.

Hope this helps,
Aurélien

@ageron Thanks for such detailed explanation, sorry to bother you with my little issue. My problem's been solved. Really appreciate what you did for the book and these teachings.

@ageron Thanks! It was very useful.

Installed python 3.7 through brew. Also tried $pip3 install --upgrade certifi.

Still don't see Python directory under Application. I am on OSX 10.15.1. /Library has Python directory but no install or certificates. Please advise. Thanks.

@BigDataPlayers what issues do you have? Can you run python from the terminal?

Thanks for checking in. I’ve switched back to Python 3.7.5. It’s all working now. The SSL Certificate issue has been resolved.

Was this page helpful?
0 / 5 - 0 ratings