MNIST data download from sklearn datasets gives Timeout error

Swaraj Shekhar picture Swaraj Shekhar · Nov 1, 2018 · Viewed 7.8k times · Source

I am new to ML and trying to download MNIST data. The code I am using is:

from sklearn.datasets import fetch_mldata
mnist = fetch_mldata('MNIST original')

But, it gives an error saying:

TimeoutError: [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond

Can anyone please help me what needs to be done to rectify this issue?

Answer

leo picture leo · Nov 1, 2018

here is the issue and some workaround good people suggested :

https://github.com/scikit-learn/scikit-learn/issues/8588

easiest one was to download .mat file of MNIST with this download link:

download MNIST.mat

after download put the file inside ~/scikit_learn_data/mldata folder, if this folder doesn't exist create it and put the Mnist.mat inside it. when you have them locally scikit learn won't download it and uses that file.