0

I have installed the netcdf4 library through

conda install -c anaconda netcdf4

And it shows up fine on my conda environment:

Conda envs

However, when I try to import it in Spyder, I am getting an

"ModuleNotFoundError: No module named 'netcdf4'"

I have tried the solutions here. As you can see below, both the interpreters are the same (in tools/preferences it's set as python.exe, not pythonw.exe):

interpreters

Yet when I try to import the netcdf4 module, it says there is no module named this.

whyyy

Any ideas what the cause could be? It's been two days of trying to get Anaconda to work and it has not been a smooth experience at all, really close on giving up on Anaconda as a whole.

Added per request, a screenshot of my entire IDE. Notice in the console I ran pip install netcdf4, where it says I already installed it. Directly below is importing the module and the error:

IDE

And how the console looks on each startup:

console

B.Quaink
  • 456
  • 1
  • 4
  • 18
  • check in which environment is spyder running in. By default it works in the `base` environment, you have to change the environment to `visan` – some_programmer Jan 06 '21 at 10:24
  • How do you check this? I run spyder from the cmd in the same environment. Visan is also the active environment I run spyder from – B.Quaink Jan 06 '21 at 10:25
  • Check both are having same Virtual Environment. If same install netcdf4 using pip. pip install netCDF4 – Suganesh Kumar Jan 06 '21 at 10:26
  • In the bottom right corner, there will be `conda: base` mentioned – some_programmer Jan 06 '21 at 10:26
  • Does this answer your question? [How to run Spyder in virtual environment?](https://stackoverflow.com/questions/30170468/how-to-run-spyder-in-virtual-environment) – some_programmer Jan 06 '21 at 10:27
  • @SuganeshKumar I have tried to install via this method, but it says netcdf4 is already installed – B.Quaink Jan 06 '21 at 10:28
  • @Junkrat I do not see anything in the bottom right corner, and that is the exact same way I have installed my virtual environment – B.Quaink Jan 06 '21 at 10:28
  • Can you add a screenshot of your entire spyder ide? – some_programmer Jan 06 '21 at 10:29
  • @Junkrat I added an extra image with some additional info in the console. I added an extra image how it looks like when starting up spyder, because it seems compared to other screenshots I'm missing some info. – B.Quaink Jan 06 '21 at 10:34
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/226917/discussion-between-junkrat-and-b-quaink). – some_programmer Jan 06 '21 at 10:35

1 Answers1

0

The docs/tutorial used stated

import netcdf4

While now it is case sensitive

import netCDF4

Such a simple fix..

B.Quaink
  • 456
  • 1
  • 4
  • 18