Cant download files from within juypter notebook

Trying to load cifar10 dataset from keras library using juypter notebook, but i am getting below error

SSLError: [SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1051) During handling of the above exception, another exception occurred: Exception: URL fetch failure on https://www.cs.toronto.edu/~kriz/cifar-10-python.tar.gz: None – [SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1051)

So i tried to remove https in the source file cifar10.py, then i am getting forbidden Exception: URL fetch failure on http://www.cs.toronto.edu/~kriz/cifar-10-python.tar.gz: 403 – Forbidden

But if i use the same url from the browser i am able to download without any issues… can any one please help me out !!

Thanks in Advance.

There are a lot of environments in which you can run a notebook and several ways download things. It would be helpful for others trying to help you if you describe more how you are going about it.
For example I just launched a session from here and entered in a notebook cell the following:

!curl -OL https://www.cs.toronto.edu/~kriz/cifar-10-python.tar.gz

It downloaded fine. It actually worked with leaving out the -L flag and using !curl -O https://www.cs.toronto.edu/~kriz/cifar-10-python.tar.gz, too, but I tend to often include that optional flag because it sometimes makes things easier, see here.
If that fails, I’d suggest you share more on your environment.

1 Like

I launch Jupyter notebook directly from the windows machine where its installed, after launching background python.exe will be running and automatically browser will redirect to http://localhost:8888/tree

==log==
[I 11:36:26.234 NotebookApp] JupyterLab extension loaded from C:\asdf\AppData\Local\Continuum\anaconda3\lib\site-packages\jupyterlab
[I 11:36:26.238 NotebookApp] JupyterLab application directory is C:\asdf\AppData\Local\Continuum\anaconda3\share\jupyter\lab
[I 11:36:26.242 NotebookApp] Serving notebooks from local directory: C:\asdf
[I 11:36:26.242 NotebookApp] The Jupyter Notebook is running at:
[I 11:36:26.242 NotebookApp] http://localhost:8888/?token=xxxxxxxxxxxxxxxxxxxxxxxxxx
[I 11:36:26.243 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 11:36:27.633 NotebookApp]

To access the notebook, open this file in a browser:
    file:///C:/asdf/AppData/Roaming/jupyter/runtime/nbserver-9196-open.html
Or copy and paste one of these URLs:
    http://localhost:8888/?token=xxxxxxxxxxxxxxxxxxxxxxxxxxxx

=======

code:
from keras.datasets import cifar10

(x_train, y_train), (x_test, y_test) = cifar10.load_data()
print(x_train.shape)
print(y_train.shape)

=========
from the jupyter notebook when i click on Run, its throwing me the mentioned error, but able to download the file from the browser
Please let me know if any more info is needed to help out.

Looks like from discussion at https://github.com/keras-team/keras/issues/2519#issuecomment-307331762 the work around is to download it and place it in the right location so the load command uses it. Otherwise you need adjust the code or add certificates as detailed below:

Hi,

Downloaded data and placed in keras cifar datasets manually - didnt helped out
added required ca in pem format to $pythonpath/site-packages/certifi/cacert.pem - didnt worked out same error.

I’d suggest you post you issue at the Keira’s repo because it looks like the issue is with that package and not the jupyter ecosystem involved.

1 Like

I dont think its Keira’s repo issue as source repo is toronto university repo.
Anyway Thanks…