Giter Site home page Giter Site logo

Comments (16)

ageron avatar ageron commented on May 2, 2024 51

Hi Aishni,

I believe this bug is due to the fact that Python 3.6 on MacOSX has no certificates at all (see the release notes), so it cannot verify the SSL certificate from GitHub's servers when trying to download housing.tgz. See the second answer to this StackOverflow question for details. The solution is to:

  • read /Applications/Python 3.6/ReadMe.rtf
  • the ReadMe will have you run /Applications/Python 3.6/Install Certificates.command which installs the certificates.

Alternatively, you can work around the issue by downloading the file yourself and placing it in the housing directory, then comment out the urlretrieve() line in the code, and run it again.

Hope this helps,
Aurélien

from handson-ml.

ClaudeCoulombe avatar ClaudeCoulombe commented on May 2, 2024 6

For Mac OS X

  1. Update to Python 3.6.5 using the native app installer downloaded from the official Python language website https://www.python.org/downloads/

I've found that the installer is taking care of updating the links and symlinks for the new Python a lot better than homebrew.

  1. Install a new certificate using "./Install Certificates.command" which is in the refreshed Python 3.6 directory

    cd "/Applications/Python 3.6/"
    sudo "./Install Certificates.command"

from handson-ml.

ageron avatar ageron commented on May 2, 2024 4

Hi Aishni,

Did my answer solve your problem? May I close this issue?

Cheers,
Aurélien

from handson-ml.

aishniparab avatar aishniparab commented on May 2, 2024

from handson-ml.

ageron avatar ageron commented on May 2, 2024

Perfect, thanks for your feedback. :)

from handson-ml.

purshipurshi2005 avatar purshipurshi2005 commented on May 2, 2024

Thanks the solution worked .

read /Applications/Python 3.6/ReadMe.rtf
the ReadMe will have you run /Applications/Python 3.6/Install Certificates.command which installs the certificates.

from handson-ml.

Sunil1997 avatar Sunil1997 commented on May 2, 2024

Hey
i'm using fedora as os
it's give me error below
i'm using pycharm with envs of anaconda

WARNING:tensorflow:From /home/sunil/PycharmProjects/test/testFile.py:7: read_data_sets (from tensorflow.contrib.learn.python.learn.datasets.mnist) is deprecated and will be removed in a future version.
Instructions for updating:
Please use alternatives such as official/mnist/dataset.py from tensorflow/models.
Extracting MNIST_data/train-images-idx3-ubyte.gz
WARNING:tensorflow:From /home/sunil/anaconda3/envs/condaEnvTest/lib/python3.6/site-packages/tensorflow/contrib/learn/python/learn/datasets/mnist.py:260: maybe_download (from tensorflow.contrib.learn.python.learn.datasets.base) is deprecated and will be removed in a future version.
Instructions for updating:
Please write your own downloading logic.
WARNING:tensorflow:From /home/sunil/anaconda3/envs/condaEnvTest/lib/python3.6/site-packages/tensorflow/contrib/learn/python/learn/datasets/mnist.py:262: extract_images (from tensorflow.contrib.learn.python.learn.datasets.mnist) is deprecated and will be removed in a future version.
Instructions for updating:
Please use tf.data to implement this functionality.
Extracting MNIST_data/train-labels-idx1-ubyte.gz
WARNING:tensorflow:From /home/sunil/anaconda3/envs/condaEnvTest/lib/python3.6/site-packages/tensorflow/contrib/learn/python/learn/datasets/mnist.py:267: extract_labels (from tensorflow.contrib.learn.python.learn.datasets.mnist) is deprecated and will be removed in a future version.
Instructions for updating:
Please use tf.data to implement this functionality.
WARNING:tensorflow:From /home/sunil/anaconda3/envs/condaEnvTest/lib/python3.6/site-packages/tensorflow/contrib/learn/python/learn/datasets/mnist.py:110: dense_to_one_hot (from tensorflow.contrib.learn.python.learn.datasets.mnist) is deprecated and will be removed in a future version.
Instructions for updating:
Please use tf.one_hot on tensors.
Extracting MNIST_data/t10k-images-idx3-ubyte.gz
Extracting MNIST_data/t10k-labels-idx1-ubyte.gz
WARNING:tensorflow:From /home/sunil/anaconda3/envs/condaEnvTest/lib/python3.6/site-packages/tensorflow/contrib/learn/python/learn/datasets/mnist.py:290: DataSet.__init__ (from tensorflow.contrib.learn.python.learn.datasets.mnist) is deprecated and will be removed in a future version.
Instructions for updating:
Please use alternatives such as official/mnist/dataset.py from tensorflow/models.

from handson-ml.

ageron avatar ageron commented on May 2, 2024

Hi @Sunil1997 ,
These are just warnings, not errors, you can ignore them for now. I will update the notebooks to use Keras' functionality for loading MNIST, because TensorFlow's functionality has been deprecated and is printing all these warnings. However, the code still works for now, so you can just ignore these warnings.

from handson-ml.

jemberie avatar jemberie commented on May 2, 2024

i am run the following on red hat Linux

In [12]: from keras.applications import VGG16                                   
In [13]: from keras import backend as K                                         
In [14]: model = VGG16(weights='imagenet', include_top=False)

and i found the following error

Downloading data from https://github.com/fchollet/deep-learning-models/releases/download/v0.1/vgg16_weights_tf_dim_ordering_tf_kernels_notop.h5
---------------------------------------------------------------------------
OSError                                   Traceback (most recent call last)
~/anaconda3/lib/python3.6/urllib/request.py in do_open(self, http_class, req, **http_conn_args)
   1317                 h.request(req.get_method(), req.selector, req.data, headers,
-> 1318                           encode_chunked=req.has_header('Transfer-encoding'))
   1319             except OSError as err: # timeout error

~/anaconda3/lib/python3.6/http/client.py in request(self, method, url, body, headers, encode_chunked)
   1253         """Send a complete request to the server."""
-> 1254         self._send_request(method, url, body, headers, encode_chunked)
   1255 

~/anaconda3/lib/python3.6/http/client.py in _send_request(self, method, url, body, headers, encode_chunked)
   1299             body = _encode(body, 'body')
-> 1300         self.endheaders(body, encode_chunked=encode_chunked)
   1301 

~/anaconda3/lib/python3.6/http/client.py in endheaders(self, message_body, encode_chunked)
   1248             raise CannotSendHeader()
-> 1249         self._send_output(message_body, encode_chunked=encode_chunked)
   1250 

~/anaconda3/lib/python3.6/http/client.py in _send_output(self, message_body, encode_chunked)
   1035         del self._buffer[:]
-> 1036         self.send(msg)
   1037 

~/anaconda3/lib/python3.6/http/client.py in send(self, data)
    973             if self.auto_open:
--> 974                 self.connect()
    975             else:

from handson-ml.

ageron avatar ageron commented on May 2, 2024

Hi @jemberie ,

This code does not look like it comes from the book or from this repository. It looks like you're getting a timeout while downloading VGG16. Check your internet connection? Try from another computer? If nothing works, please ask on StackOverflow instead.

from handson-ml.

alienintheheights avatar alienintheheights commented on May 2, 2024

This fixes it too -- added the ssl context workaround

import os
import tarfile
import urllib
import ssl

DOWNLOAD_ROOT = "https://raw.githubusercontent.com/ageron/handson-ml2/master/"
HOUSING_PATH = os.path.join("datasets", "housing")
HOUSING_URL = DOWNLOAD_ROOT + "datasets/housing/housing.tgz"

def fetch_housing_data(housing_url=HOUSING_URL, housing_path=HOUSING_PATH):
    os.makedirs(housing_path, exist_ok=True)
    tgz_path = os.path.join(housing_path, "housing.tgz")
    context = ssl._create_unverified_context()
    response = urllib.request.urlopen(housing_url, context=context)
    with open(tgz_path, 'wb') as f:
        f.write(response.read())
    housing_tgz = tarfile.open(tgz_path)
    housing_tgz.extractall(path=housing_path)
    housing_tgz.close()

from handson-ml.

adarshraghav avatar adarshraghav commented on May 2, 2024

--This answer is for MACOS--
Hi,
For python 3.9 and above, just go to Applications -> Python x.x -> there will be a .command file to install certificates, just click on that and you're done.

from handson-ml.

OpenWiseFound avatar OpenWiseFound commented on May 2, 2024

from handson-ml.

Mauricio9 avatar Mauricio9 commented on May 2, 2024

from handson-ml.

OpenWiseFound avatar OpenWiseFound commented on May 2, 2024

from handson-ml.

Mauricio9 avatar Mauricio9 commented on May 2, 2024

from handson-ml.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.