简体   繁体   中英

AttributeError: type object 'netCDF4._netCDF4._MemBuf' has no attribute '__reduce_cython__'

I am trying to work with the "oceansdb" package, and as a dependency it requires netCDF4. When I try to run anything related to oceansdb, I get an error:


  File "C:/Users/Documents/starter.py", line 12, in <module>
    import oceansdb

  File "C:\Users\Anaconda3-64bit\lib\site-packages\oceansdb\__init__.py", line 8, in <module>
    from oceansdb.woa import WOA

  File "C:\Users\Anaconda3-64bit\lib\site-packages\oceansdb\woa.py", line 12, in <module>
    import netCDF4

  File "C:\Users\Anaconda3-64bit\lib\site-packages\netCDF4\__init__.py", line 3, in <module>
    from ._netCDF4 import *

  File "include\membuf.pyx", line 16, in init netCDF4._netCDF4

AttributeError: type object 'netCDF4._netCDF4._MemBuf' has no attribute '__reduce_cython__'

I have tried uninstalling and reinstalling netCDF4, then upgrading my cython version and doing the same uninstall/reinstall, both to no avail. I also tried uninstalling and reinstalling oceansdb. Everything has yielded the same error and I can't seem to find anyone else with the same issue.

I was getting a similar error. I think the key is the versions of the packages you are using.

I was using:

  • cftime 1.1.2

    cython 0.28.5

    hdf5 1.10.2

    netcdf4 1.5.3

    numpy 1.15.1

    pandas 0.23.4

    setuptools 40.2.0

and I got the error above.

With the packages below, all works great:

cftime 1.0.3.4

cython 0.28.5

hdf5 1.10.2

netcdf4 1.5.2

numpy 1.15.1

pandas 0.23.4

setuptools 40.2.0

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM