Not able to import netCDF4 to Spyder (Anaconda, OSX10.10)

2.6k views Asked by At

I'm trying to learn to use Python for scientific analyses (in particular of large NETCDF files), and have installed Anaconda on my MacBookPro OSX10.10. I'm trying to use the Spyder IDE interface, but am stalled by errors with getting the netCDF4 package to work properly.

I need to use the netCDF4 package which I installed using:

conda install netcdf4

First I couldn't get any of the Anaconda packages to import in either Spyder or Python run directly in the terminal, but tried running:

export PATH=~/anaconda/bin:$PATH 

Now I get all Anaconda pre-installed packages to work in Spyder (no error when I try the import command), EXCEPT for netCDF 4 which still comes up with the following error:

import netCDF4
Traceback (most recent call last):

  File "<ipython-input-7-f731da2de255>", line 1, in <module>
    import netCDF4

  File "/Users/eriko/anaconda/lib/python2.7/site-packages/netCDF4/__init__.py", line 6, in <module>
    from ._netCDF4 import (__version__, __netcdf4libversion__, __hdf5libversion__,

ImportError: cannot import name __netcdf4libversion__

However, netCDF4 imports without any error in the terminal version of Python?

The 'Code Analysis' in Spyder flags the following error in scripts where I added the import netCDF4 command:

'netCDF4' imported but unused
E402 module level import not at top of the file
W292 no newline at the end of file

I've spent too many hour Googling without finding a solution to this, so I hope the Stackoverflow community can help.

0

There are 0 answers