You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm having issues connecting to a dataset which, in the past, has worked fine. I recently reinstalled
netCDF4 via a virtual environment and I'm getting low level CURL SSL errors.
Here's some example code:
import netCDF4 as nc
remote_file = 'https://podaac-opendap.jpl.nasa.gov/opendap/allData/modis/L3/aqua/11um/v2014.0/4km/daily/2017/365/A2017365.L3m_DAY_NSST_sst_4km.nc'
try:
subset = nc.Dataset(remote_file)
except Exception as e:
print(e)
It's worth noting that if I use a different mirror for that same file (ex. http://34.192.248.166/opendap/gateway/687474703A2F2F746872656464732E756361722E6564752F2F746872656464732F66696C655365727665722F63617365737475646965732F707974686F6E2D67616C6C6572792F4746535F32303130313032365F313230302E6E63) it works without any problems, making it quite likely that it's in fact an SSL related issue.
I tried installing netCDF4 from source and recompiling the extension and this error was resolved, yet now I get:
NetCDF: file not found
which seems to be similar to what is reported here: #755.
Similarly to above the non-SSL URL works without any issues, though it is odd that it results in a different error message.
What I am likely going to end up doing is just writing my own logic for downloading the cdf files using the python stdlib.
Perhaps it would be a good idea to replace the netCDF4 logic used to fetch URLs to use the python libraries instead of CURL?
Would such a patch be accepted? Any pointers as to where I can look to implement it?
@hellais I'm having the same issue and I'm not connecting to a SSL url.
[kserradell@MacNeu ~ ]$ python3
Python 3.7.5 (default, Nov 1 2019, 02:16:23)
[Clang 11.0.0 (clang-1100.0.33.8)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import netCDF4
>>> url="http://www.esrl.noaa.gov/psd/thredds/dodsC/Datasets/noaa.ersst/sst.mnmean.v4.nc"
>>> netCDF4.Dataset(url)
curl error details:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "netCDF4/_netCDF4.pyx", line 2321, in netCDF4._netCDF4.Dataset.__init__
File "netCDF4/_netCDF4.pyx", line 1885, in netCDF4._netCDF4._ensure_nc_success
OSError: [Errno -68] NetCDF: I/O failure: b'http://www.esrl.noaa.gov/psd/thredds/dodsC/Datasets/noaa.ersst/sst.mnmean.v4.nc'
@kserradell What versions of netcdf4-python and netcdf-c do you have installed? How did you install them? The code you posted works fine for me on my mac on Python 3.7.3.
Ok, so it turns out that the PyPI wheels include their own copy of libnetcdf embedded, so you don't actually need to install netcdf from homebrew. It also looks like those wheels are built with netcdf 4.4.1.1:
@jswhit@matthew-brett How can we update to a more recent version of netCDF? I'm pretty sure that's what's causing the problems here. Everything is working for these URLs fine if I'm using netCDF 4.6.3 from Homebrew.
Ah - sorry - all that's all in the wheel building machinery. @jswhit - are you mainly in charge of that? I did a PR here, in the hope that using 4.6.3 is a good idea in general:
I have the same problem on my CentOS machine using miniconda. Both with xarray or ncdump, then trying accessing any THREDDS I get a [Errno -68] NetCDF: I/O failure.
I am getting this same OSError: [Errno -68] NetCDF: I/O failure trying to open a NetCDF file via OPENDAP service on a THREDDS server. I tried py3.7, 3.8, 3.9. The only successful solution I came across was using conda (which provides a more recent version of pydap via conda-forge), and then:
import xarray as xr
from pydap.client import open_url
data_store = xr.backends.PydapDataStore(open_url(url, user_charset='utf-8')) # needs PyDAP >= v3.3.0
data = xr.open_dataset(data_store)
Activity
mgoldsborough commentedon Jun 26, 2018
Seems to be an issue with the latest release, v1.4.0.
There are no issues when I revert to v1.3.1.
With v1.3.1 this prints
OK!dopplershift commentedon Jun 27, 2018
No problem here with netCDF4 (python) 1.4.0 and libnetcdf (C) 4.6.1 from conda-forge.
jswhit commentedon Jul 13, 2018
Perhaps the libs you linked when you built 1.4.0 were different.
mgoldsborough commentedon Aug 25, 2018
Seems to be a python issue. I installed pyenv and rolled back to python 3.6.4 and it seemed to have fixed the problem.
hellais commentedon Nov 17, 2019
I am running into the same issue with python 3.7.3, while doing the python-gallery tutorial: https://unidata.github.io/python-gallery/examples/700hPa_RELH_Winds.html#sphx-glr-examples-700hpa-relh-winds-py.
The error I am seeing is:
It's worth noting that if I use a different mirror for that same file (ex.
http://34.192.248.166/opendap/gateway/687474703A2F2F746872656464732E756361722E6564752F2F746872656464732F66696C655365727665722F63617365737475646965732F707974686F6E2D67616C6C6572792F4746535F32303130313032365F313230302E6E63) it works without any problems, making it quite likely that it's in fact an SSL related issue.I tried installing netCDF4 from source and recompiling the extension and this error was resolved, yet now I get:
which seems to be similar to what is reported here: #755.
Similarly to above the non-SSL URL works without any issues, though it is odd that it results in a different error message.
What I am likely going to end up doing is just writing my own logic for downloading the cdf files using the python stdlib.
Perhaps it would be a good idea to replace the netCDF4 logic used to fetch URLs to use the python libraries instead of CURL?
Would such a patch be accepted? Any pointers as to where I can look to implement it?
hellais commentedon Nov 17, 2019
This issue also may be related to CURL linking problems too: #942
kserradell commentedon Dec 3, 2019
@hellais I'm having the same issue and I'm not connecting to a SSL url.
dopplershift commentedon Dec 3, 2019
@kserradell What versions of netcdf4-python and netcdf-c do you have installed? How did you install them? The code you posted works fine for me on my mac on Python 3.7.3.
kserradell commentedon Dec 11, 2019
Sorry for my late reply, @dopplershift.
Installed using brew.
IsaacBreen commentedon Dec 14, 2019
I'm having a similar issue. Running
throws the error
My system information is
dopplershift commentedon Dec 23, 2019
Ok, so it turns out that the PyPI wheels include their own copy of libnetcdf embedded, so you don't actually need to install netcdf from homebrew. It also looks like those wheels are built with netcdf 4.4.1.1:
https://github.com/matthew-brett/multibuild/blob/f55556c46be580a6e65b1e95cbb3ec38e8913ab9/library_builders.sh#L34
@jswhit @matthew-brett How can we update to a more recent version of netCDF? I'm pretty sure that's what's causing the problems here. Everything is working for these URLs fine if I'm using netCDF 4.6.3 from Homebrew.
matthew-brett commentedon Dec 23, 2019
Did you already try setting
NETCDF_VERSION? https://github.com/matthew-brett/multibuild/blob/devel/library_builders.sh#L34. That would go in yourenv_vars.shscript.dopplershift commentedon Dec 23, 2019
@matthew-brett I'm more concerned about for the wheels uploaded to PyPI.
And just figuring out that the wheels uploaded to PyPI are linked to netCDF 4.4.1.1 took the effort I can burn here, so I think I'm tapping out.
Update netcdf version
matthew-brett commentedon Dec 23, 2019
Ah - sorry - all that's all in the wheel building machinery. @jswhit - are you mainly in charge of that? I did a PR here, in the hope that using 4.6.3 is a good idea in general:
MacPython/netcdf4-python-wheels#7
matteodefelice commentedon Jan 6, 2021
I have the same problem on my CentOS machine using miniconda. Both with xarray or ncdump, then trying accessing any THREDDS I get a
[Errno -68] NetCDF: I/O failure.OpenSSL 1.1.1i 8 Dec 2020
curl 7.71.1 (x86_64-conda-linux-gnu) libcurl/7.71.1 OpenSSL/1.1.1i zlib/1.2.11 libssh2/1.9.0 nghttp2/1.41.0
Release-Date: 2020-07-01
Protocols: dict file ftp ftps gopher http https imap imaps pop3 pop3s rtsp scp sftp smb smbs smtp smtps telnet tftp
Features: AsynchDNS GSS-API HTTP2 HTTPS-proxy IPv6 Kerberos Largefile libz NTLM NTLM_WB SPNEGO SSL TLS-SRP UnixSockets
nasahegde commentedon Nov 30, 2021
I am using netCDF4 v1.5.8 installed using pip on Mac. I am getting the same error. Here are the error details:
curl error details: Traceback (most recent call last): File "/*****/*****/tmp.py", line 10, in <module> cld_dataset = nc4.Dataset(cloud_url, "r") File "src/netCDF4/_netCDF4.pyx", line 2307, in netCDF4._netCDF4.Dataset.__init__ File "src/netCDF4/_netCDF4.pyx", line 1925, in netCDF4._netCDF4._ensure_nc_success OSError: [Errno -68] NetCDF: I/O failure:How do I address it? Thanks.
patrickjwright commentedon Mar 10, 2023
I am getting this same
OSError: [Errno -68] NetCDF: I/O failuretrying to open a NetCDF file via OPENDAP service on a THREDDS server. I tried py3.7, 3.8, 3.9. The only successful solution I came across was usingconda(which provides a more recent version ofpydapvia conda-forge), and then:From: https://help.marine.copernicus.eu/en/articles/5182598-how-to-consume-the-opendap-api-and-cas-sso-using-python#h_33df7ebcce