Closed stoiver closed 9 years ago
Apparently, it's not using the correct path to netcdf.h - which should be provided by nc-config. Can you post the full build output?
On a fairly clean version of ubuntu14.04 I installed the following packages
sudo apt-get install -q -y git gfortran python-dev python-numpy \ python-scipy \ python-matplotlib netcdf-bin \ libnetcdf-dev libhdf5-serial-dev \ python-gdal python-pip
And then
sudo pip install netCDF4
The output from this:
Downloading/unpacking netCDF4 Running setup.py (path:/tmp/pip_build_root/netCDF4/setup.py) egg_info for package netCDF4 using nc-config ... using netcdf library version 4.1.3
Requirement already satisfied (use --upgrade to upgrade): numpy>=1.3 in /usr/lib/python2.7/dist-packages (from netCDF4) Installing collected packages: netCDF4 Running setup.py install for netCDF4 using nc-config ... using netcdf library version 4.1.3 building 'netCDF4' extension x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include -I/usr/lib/python2.7/dist-packages/numpy/core/include -I/usr/include/python2.7 -c netCDF4.c -o build/temp.linux-x86_64-2.7/netCDF4.o In file included from /usr/lib/python2.7/dist-packages/numpy/core/include/numpy/ndarraytypes.h:1761:0, from /usr/lib/python2.7/dist-packages/numpy/core/include/numpy/ndarrayobject.h:17, from /usr/lib/python2.7/dist-packages/numpy/core/include/numpy/arrayobject.h:4, from netCDF4.c:239: /usr/lib/python2.7/dist-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:15:2: warning: #warning "Using deprecated NumPy API, disable it by " "#defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
^
netCDF4.c: In function ‘**pyx_f_7netCDF4__get_full_format’:
netCDF4.c:18003:9: warning: implicit declaration of function ‘nc_inq_format_extended’ [-Wimplicit-function-declaration]
__pyx_v_ierr = nc_inq_format_extended(__pyx_v_grpid, (&__pyx_v_formatp), (&__pyx_v_modep));
^
netCDF4.c:18074:10: error: ‘NC_FORMAT_NC3’ undeclared (first use in this function)
case NC_FORMAT_NC3:
^
netCDF4.c:18074:10: note: each undeclared identifier is reported only once for each function it appears in
netCDF4.c:18096:10: error: ‘NC_FORMAT_NC_HDF5’ undeclared (first use in this function)
case NC_FORMAT_NC_HDF5:
^
netCDF4.c:18118:10: error: ‘NC_FORMAT_NC_HDF4’ undeclared (first use in this function)
case NC_FORMAT_NC_HDF4:
^
netCDF4.c:18140:10: error: ‘NC_FORMAT_PNETCDF’ undeclared (first use in this function)
case NC_FORMAT_PNETCDF:
^
netCDF4.c:18162:10: error: ‘NC_FORMAT_DAP2’ undeclared (first use in this function)
case NC_FORMAT_DAP2:
^
netCDF4.c:18184:10: error: ‘NC_FORMAT_DAP4’ undeclared (first use in this function)
case NC_FORMAT_DAP4:
^
netCDF4.c:18206:10: error: ‘NC_FORMAT_UNDEFINED’ undeclared (first use in this function)
case NC_FORMAT_UNDEFINED:
^
netCDF4.c: In function ‘__pyx_pf_7netCDF4_7Dataset_58renameGroup’:
netCDF4.c:28783:3: warning: implicit declaration of function ‘nc_rename_grp’ [-Wimplicit-function-declaration]
__pyx_v_ierr = nc_rename_grp(__pyx_t_6, __pyx_v_newnamec);
^
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
Complete output from command /usr/bin/python -c "import setuptools, tokenize;__file**='/tmp/pip_build_root/netCDF4/setup.py';exec(compile(getattr(tokenize, 'open', open)(**file**).read().replace('\r\n', '\n'), **file**, 'exec'))" install --record /tmp/pip-H7egR_-record/install-record.txt --single-version-externally-managed --compile:
reading from setup.cfg...
using nc-config ...
using netcdf library version 4.1.3
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.7
copying netCDF4_utils.py -> build/lib.linux-x86_64-2.7
creating build/lib.linux-x86_64-2.7/netcdftime
copying netcdftime/netcdftime.py -> build/lib.linux-x86_64-2.7/netcdftime
copying netcdftime/init.py -> build/lib.linux-x86_64-2.7/netcdftime
running build_ext
building 'netCDF4' extension
creating build/temp.linux-x86_64-2.7
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include -I/usr/lib/python2.7/dist-packages/numpy/core/include -I/usr/include/python2.7 -c netCDF4.c -o build/temp.linux-x86_64-2.7/netCDF4.o
In file included from /usr/lib/python2.7/dist-packages/numpy/core/include/numpy/ndarraytypes.h:1761:0,
from /usr/lib/python2.7/dist-packages/numpy/core/include/numpy/ndarrayobject.h:17,
from /usr/lib/python2.7/dist-packages/numpy/core/include/numpy/arrayobject.h:4,
from netCDF4.c:239:
/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:15:2: warning: #warning "Using deprecated NumPy API, disable it by " "#defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
^
netCDF4.c: In function ‘pyx_f_7netCDF4get_full_format’:
netCDF4.c:18003:9: warning: implicit declaration of function ‘nc_inq_format_extended’ [-Wimplicit-function-declaration]
__pyx_v_ierr = nc_inq_format_extended(__pyx_v_grpid, (&__pyx_v_formatp), (&__pyx_v_modep));
^
netCDF4.c:18074:10: error: ‘NC_FORMAT_NC3’ undeclared (first use in this function)
case NC_FORMAT_NC3:
^
netCDF4.c:18074:10: note: each undeclared identifier is reported only once for each function it appears in
netCDF4.c:18096:10: error: ‘NC_FORMAT_NC_HDF5’ undeclared (first use in this function)
case NC_FORMAT_NC_HDF5:
^
netCDF4.c:18118:10: error: ‘NC_FORMAT_NC_HDF4’ undeclared (first use in this function)
case NC_FORMAT_NC_HDF4:
^
netCDF4.c:18140:10: error: ‘NC_FORMAT_PNETCDF’ undeclared (first use in this function)
case NC_FORMAT_PNETCDF:
^
netCDF4.c:18162:10: error: ‘NC_FORMAT_DAP2’ undeclared (first use in this function)
case NC_FORMAT_DAP2:
^
netCDF4.c:18184:10: error: ‘NC_FORMAT_DAP4’ undeclared (first use in this function)
case NC_FORMAT_DAP4:
^
netCDF4.c:18206:10: error: ‘NC_FORMAT_UNDEFINED’ undeclared (first use in this function)
case NC_FORMAT_UNDEFINED:
^
netCDF4.c: In function ‘__pyx_pf_7netCDF4_7Dataset_58renameGroup’:
netCDF4.c:28783:3: warning: implicit declaration of function ‘nc_rename_grp’ [-Wimplicit-function-declaration]
pyx_v_ierr = nc_rename_grp(pyx_t_6, __pyx_v_newnamec);
^
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
Cleaning up... Command /usr/bin/python -c "import setuptools, tokenize;file='/tmp/pip_buildroot/netCDF4/setup.py';exec(compile(getattr(tokenize, 'open', open)(file).read().replace('\r\n', '\n'), file, 'exec'))" install --record /tmp/pip-H7egR-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip_build_root/netCDF4
Traceback (most recent call last):
File "/usr/bin/pip", line 9, in
I inadvertently uploaded netCDF-1.1.7 with support for new API features not found in version 4.1.3 of the library. I've fixed this now by uploading a new tarball.
Note - if you also had cython installed, your build would have worked since it would have auto-detected those library features and regenerated netCDF4.c from netCDF4.pyx.
Version 1.1.7.1 works for me.
Hi Jeff, yes the new version 1.1.7.1 is now working for me. Thanks
Just tried to install using pip and obtained the following errors
netCDF4.c:18206:10: error: ‘NC_FORMAT_UNDEFINED’ undeclared (first use in this function) case NC_FORMAT_UNDEFINED:
Was working fine with version 1.1.6