error: failed to download sample dataset

  • MNE version: 1.1.1.0
  • operating system: / Windows 10 and Ubuntu 18.04

I just installed MNE-python on Windows 10 (and Linux) and wanted to go through the tutorial. But the downloading the sample dataset is failing with the following error message:

requests.exceptions.SSLError: HTTPSConnectionPool(host=‘osf.io’, port=443): Max retries exceeded with url: /86qa2/download?version=6 (Caused by SSLError(SSLCertVerificationError(1, ‘[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:997)’)))

I am wondering something to do with the firewall but not quite sure.

Thank you for your help in advance.

simply followed tutorial:
import numpy as np
import mne
sample_data_folder = mne.datasets.sample.data_path()

This is quite likely. Could you please share the output of

import mne
mne.sys_info()

Thanks,
Richard

import mne
mne.sys_info()
Platform: Windows-10-10.0.19042-SP0
Python: 3.10.6 | packaged by conda-forge | (main, Aug 22 2022, 20:30:19) [MSC v.1929 64 bit (AMD64)]
Executable: C:\Users\fuj7ek\AppData\Local\mne-python\1.1.1\python.exe
CPU: Intel64 Family 6 Model 85 Stepping 4, GenuineIntel: 8 cores
Memory: 31.7 GB

mne: 1.1.1
numpy: 1.21.6 {blas=NO_ATLAS_INFO, lapack=lapack}
scipy: 1.9.0
matplotlib: 3.5.3 {backend=QtAgg}

sklearn: 1.1.2
numba: 0.55.2
nibabel: 4.0.1
nilearn: 0.9.2
dipy: 1.5.0
cupy: Not found
pandas: 1.4.3
pyvista: 0.36.1 {OpenGL 4.5.0 NVIDIA 391.33 via Quadro P2000/PCIe/SSE2}
pyvistaqt: 0.9.0
ipyvtklink: 0.2.2
vtk: 9.1.0
qtpy: 2.2.0 {PyQt5=5.15.4}
ipympl: 0.9.2
pyqtgraph: 0.12.4
pooch: v1.6.0

mne_bids: 0.10
mne_nirs: 0.2.1
mne_features: 0.2
mne_qt_browser: 0.3.1
mne_connectivity: 0.3
mne_icalabel: Not found

Thank you! Could you briefly describe the type of environment (university, corporate, …) from which you are trying to download? I’m asking because I would like to assess if other users might have this issue, too.

Thank you!

Richard

a hospital/medical center

Thank you!

We can add a parameter to disable certificate validity checks in situations like these (even though it’s considered bad practice).

@larsoner @agramfort @drammock WDYT? Should be very easy to do. And the downloaded data would still be hash-checked via pooch, right?

seems like something that should happen upstream within pooch, and then we would expose the param.

Pooch allows to pass a “downloader” that accepts custom parameters. If none is specified, it picks one automatically based on the protocol:

The downloader classes accept keyword arguments, which will be passed to requests.get():

The parameter we need to pass to disable TLS certificate validation is check=False.

So this boils down to us having to invoke Pooch’s downloading from HTTPS URLs with:

# assumes we get progressbar and check from the calling function
downloader = HTTPDownloader(progressbar=progressbar, check=check)
pooch.retrieve(
    ...,
    downloader=downloader
)

Nothing that needs intervention upstream :slight_smile:

1 Like

nice detective work @richard :male_detective:

@hisacof some quick searching suggests that pip install --upgrade certifi might fix this. Can you try that first?

1 Like

I actually ran pip install --upgrade certifi yesterday to see if this helps because I came across this suggestion while just doing a random google search. This is what I get:

(mne-1.1.1_0) C:\Users\fuj7ek>pip install --upgrade certifi
Requirement already satisfied: certifi in c:\users\fuj7ek\appdata\local\mne-python\1.1.1\lib\site-packages (2022.6.15)

1 Like

thanks for checking. While you wait for the fix, it should (?) be possible to directly download the dataset from your browser and manually put it in the right place. From here: OSF click the “3 dots” menu and choose download; decompress using a utility (e.g., 7-zip or peazip) and put the resulting folder inside C:\Users\YOURUSERNAME\mne_data\ (I think this is right for Windows 10, unless your computer is centrally managed and they’ve done something non-standard with user directories).

1 Like

Related issue upstream:

Thank you @drammock! That worked. I have been going through the tutorials.