anaconda / nb_conda_kernels

Package for managing conda environment-based kernels inside of Jupyter
BSD 3-Clause "New" or "Revised" License
601 stars 70 forks source link

[nb_conda_kernels] couldn't call conda #191

Closed iremnasir closed 8 months ago

iremnasir commented 4 years ago

Hello, I used conda env kernels reliably until today, where I could see all my environments when I opened a Jupyter lab interface. Out of nowhere today I get the following error and all my kernels seem to be gone:

 [nb_conda_kernels] couldn't call conda:
    Command '['/Users/iremnasir/anaconda3/bin/conda', 'info', '--json']' returned non-zero exit status 1

My conda list nb_conda_kernels has following output :

# packages in environment at /Users/iremnasir/anaconda3:
#
# Name                    Version                   Build  Channel
nb_conda_kernels          2.3.0            py38h32f6830_1    conda-forge

My conda info has the following output:

     active environment : base
    active env location : /Users/iremnasir/anaconda3
            shell level : 1
       user config file : /Users/iremnasir/.condarc
 populated config files : 
          conda version : 4.8.5
    conda-build version : 3.18.11
         python version : 3.8.3.final.0
       virtual packages : __osx=10.15.6
       base environment : /Users/iremnasir/anaconda3  (writable)
           channel URLs : https://repo.anaconda.com/pkgs/main/osx-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/r/osx-64
                          https://repo.anaconda.com/pkgs/r/noarch
          package cache : /Users/iremnasir/anaconda3/pkgs
                          /Users/iremnasir/.conda/pkgs
       envs directories : /Users/iremnasir/anaconda3/envs
                          /Users/iremnasir/.conda/envs
               platform : osx-64
             user-agent : conda/4.8.5 requests/2.24.0 CPython/3.8.3 Darwin/19.6.0 OSX/10.15.6
                UID:GID : 501:20
             netrc file : None
           offline mode : False
fcollonval commented 4 years ago

Do you recall an update of conda or nb_conda_kernels before seeing the error?

s-pike commented 3 years ago

I get this exact error, though I'm on windows. I only get it when launching jupyter notebook/lab from a windows shortcut though - it works fine if I launch from the console.

The error is preceded by: 'conda' is not recognized as an internal or external command, operable program or batch file. This is the first line printed out in the console when launching jupyter from the shortcut.

The target for the shortcut (my jupyter lab is installed in a conda environment named 'jplab') is:

%USERPROFILE%\Miniconda3\python.exe %USERPROFILE%\Miniconda3\cwp.py %USERPROFILE%\Miniconda3\envs\jplab %USERPROFILE%\Miniconda3\envs\jplab\python.exe %USERPROFILE%\Miniconda3\envs\jplab\Scripts\jupyter-lab-script.py "%USERPROFILE%/"

My work around is to change the target to effectively launch jupyter lab from the console:

%WINDIR%\System32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy ByPass -NoExit -Command "& ‘%USERPROFILE%\Miniconda3\shell\condabin\conda-hook.ps1' ; 
conda activate '%USERPROFILE%\Miniconda3' "; 
cd ~; 
conda activate jplab; 
jupyter lab; 
exit;
fcollonval commented 3 years ago

@s-pike On Windows this is though to resolve the fullpath for conda. The shortcut is probably not initializing the environment the same way you are doing it in the script - aka activating the base environment (in which conda is defined) and then activating the JupyterLab environment.

mcg1969 commented 8 months ago

closing as stale. But if we need to address this, please re-open with an attempt to reproduce with a more up to date versions of conda and nb_conda_kernels...