3

Others have asked about this, but my situation seems slightly different, and none of the suggestions they received worked for me (e.g. here, here, here).

I'm using Anaconda Navigator on Windows, and trying to use the "nco" package. I installed it via the Anaconda Navigator, and when (in Spyder) I type conda list nco it gives me:

conda list nco
# packages in environment at C:\Users\{user}\Anaconda3:
#
# Name                    Version                   Build  Channel
font-ttf-inconsolata      2.001                hcb22688_0  
nco                       5.0.6                h5be7ecf_0    conda-forge
webencodings              0.5.1            py39haa95532_1  

However, when I type import nco I get

import nco
Traceback (most recent call last):

  File "C:\Users\{user}\AppData\Local\Temp/ipykernel_21968/3374827941.py", line 1, in <module>
    import nco

ModuleNotFoundError: No module named 'nco'

I notice that there is no "nco" folder in my C:\Users\{user}\Anaconda3\Lib\site-packages folder; the only "nco" files are in C:\Users\{user}\Anaconda3\pkgs, which contains nco-5.0.6-h5be7ecf_0. I'm not completely sure whether to expect an nco folder in site-packages, but thought I'd mention that there isn't one there there.

I also tried making a new environment, test (had just been in base before), and installing nco via the navigator, but conda list nco gives the same:

conda list nco
# packages in environment at C:\Users\{user}\Anaconda3:
#
# Name                    Version                   Build  Channel
font-ttf-inconsolata      2.001                hcb22688_0  
nco                       5.0.6                h5be7ecf_0    conda-forge
webencodings              0.5.1            py39haa95532_1  

and import nco still doesn't work.

I've also tried conda update --all, which ran quickly and updated nco among others, but doesn't change anything with my issue.

I also tried conda clean -p; it ran for 12 hours before I cancelled it just now; it didn't print any output, but I don't know if I'd expect it to.

Finally, I'm just using 1 version of python, and have only recently installed/started using Anaconda.

(base) C:\>which python
/cygdrive/c/Users/{user}/Anaconda3/python

(base) C:\>which conda
/cygdrive/c/Users/{user}/Anaconda3/Scripts/conda

Any suggestions really appreciated!

2 Answers2

4

The Conda package nco refers to the commandline tool. The Python bindings to nco are provided by the Conda package pynco. So, you want

conda install -c conda-forge pynco

This will also install the nco package.

merv
  • 67,214
  • 13
  • 180
  • 245
1

After installing pynco, you can import it like below.

from nco import Nco
nco = Nco()

Please refer https://github.com/nco/pynco

cuspymd
  • 1,048
  • 9
  • 13