PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Friday, November 25, 2022

[FIXED] How to install NetCDF4 module in Spyder?

 November 25, 2022     module, netcdf4, python, spyder     No comments   

Issue

I don't know why this is causing me so much headache.

I know how to use pip, and have the latest version, but still when running a script in Spyder that requires netCDF4 (import netCDF4) Spyder always returns:

import netCDF4
ModuleNotFoundError: No module named 'netCDF4'"
  1. I opened cmd, pip install netCDF4, confirmed it installed OK. Shouldn't this be enough?
  2. I manually copied a downloaded version of netCDF4, moved it to my Python site packages, and then in Spyder manually went into PYTHONPath Manager -> Add Path --> Added the folder location 'netCDF4-1.6.0'. I thought this would definitely be enough?
  3. Then INSIDE Spyder's python console, bot-right of screen, I tried 'pip install netCDF4' and it returns:
Note: you may need to restart the kernel to use updated packages.
C:\...\Spyder\Python\python.exe: No module named pip

So is my issue #3? Spyder's version of Python doesn't have pip and doesn't link to the netCDF4 module? I thought my step #2 would resolve this?

Any help on how to install modules in Spyder would be appreciated, thank you!


Solution

Download Miniconda and install all the packages you want in a new environment. For example,

conda create -n myenv -c conda-forge python=3.9 netcdf4 [others ...]

Then follow the Spyder documentation for adding a conda environment.

Credit to Michael Delgado (above)



Answered By - tgbnez
Answer Checked By - Dawn Plyler (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing