Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

netCDF4 import not being found by Python

Tags:

python

netcdf4

I need to use the netCDF4 module in order to do some processing. I have followed the steps on this guide and also tried used anaconda2 as recomended on this post.

netCDF4 seems to be installed, as i can run nc-config --version and obtain:

netCDF 4.4.0-rc2

Although, when i try to import netCDF4 in python with:

from netCDF4 import Dataset

It Returns:

Traceback (most recent call last):
  File "test.py", line 2, in <module>
    from netCDF4 import Dataset
ImportError: No module named netCDF4

I have all dependencies installed. Cython, numpy and h5py.
It was working last night, before i turned off the PC. When i came back this morning, it just would not work. So if i have netCDF4 installed and can check it's version, how come python is not recognizing it as a module?

like image 399
Caio César Avatar asked Aug 12 '16 13:08

Caio César


2 Answers

Convert to project interpreter python 2.7 and then run installation command;

pip install netCDF4
like image 94
Yagmur SAHIN Avatar answered Sep 18 '22 22:09

Yagmur SAHIN


I used

conda install netcdf4

and it works for python 2.7.

like image 26
Chandler Avatar answered Sep 17 '22 22:09

Chandler