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'"
- I opened cmd, pip install netCDF4, confirmed it installed OK. Shouldn't this be enough?
- 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?
- 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)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.