0
votes

I have downloaded NETCDF4 module from https://pypi.python.org/pypi/netCDF4 e.g. netCDF4-1.3.1-cp34-cp34m-win_amd64.whl

I have installed it using pip install netCDF4-1.3.1-cp34-cp34m-win_amd64.whl

through command prompt in spyder. It has successfully installed. But when I am trying to import, it is giving an error:

import netCDF4 as nc4 Traceback (most recent call last):

File "", line 1, in import netCDF4 as nc4

File "C:\python3\WinPython-64bit-3.4.4.5Qt5\python-3.4.4.amd64\lib\site-packages\netCDF4__init__.py", line 3, in from ._netCDF4 import *

File "netCDF4_netCDF4.pyx", line 2988, in init netCDF4._netCDF4

AttributeError: type object 'netCDF4._netCDF4.Dimension' has no attribute 'reduce_cython'

How can I fix it? Suggestions would be appreciated.

2

2 Answers

0
votes

I have solved the problem. However, it's better to avoid problems, use python 3.6. It has no errors with netCDF4 and it comes with netCDF4.

0
votes

I had the same issue. I am using python 3.7.8 with Anaconda to manage my packages and the primary channel is conda-forge.

I ha to update the cython package:

The following packages will be downloaded:

package                    |            build
---------------------------|-----------------
cython-0.29.21             |   py37h8e8dfb5_1         1.9 MB  conda-forge
------------------------------------------------------------
                                       Total:         1.9 MB    

The following packages will be UPDATED:

cython 0.29.21-py37h1834ac0_0 --> 0.29.21-py37h8e8dfb5_1

This update fixed my issue.

Regards