Wrong version python in kernel

Hello, i use tljh jupyter hub, and i try add more in jupyter lab python kernels whith conda.
Whithot envs in bash:

  1. python --version > Python 3.10.10
  2. conda --version > conda 23.1.0
  3. conda list or pip list - show many installed packages, i think its packages in base conda env
  4. conda info --envs > base /opt/tljh/user
    then create anover conda envirement conda create --name myenv python=3.11 ipykernel and install ipykernel,
    then conda info --envs shows two evirents:
    myenv /home/jupyter-adminuser/.conda/envs/myenv
    base /opt/tljh/user

next activate env conda activate myenv
check version python and conda steps 1-3 and wi see:

  1. python --version > Python 3.11.7
  2. conda --version > conda 23.1.0
  3. conda list or pip list show count packages small then it was first time,
  4. install the JupyterLab Kernel with command python -m ipykernel install --user --name myenv --display-name "Python (myenv)"

we see message Installed kernelspec myenv in /home/jupyter-adminuser/.local/share/jupyter/kernels/myenv
deactivate our conda env with command conda deactivate, restart server, and go to jupyter netebook, and select Kernel Python (myenv)
in code cell write and run !python --version output: Python 3.10.10 why? its should be Python 3.11.7 not 3.10!
ok, lets check our packages !pip list and !conda list and i see in conda list # packages in environment at /opt/tljh/user: why?
when i open ipython console i see
Python 3.11.7 | packaged by conda-forge | (main, Dec 23 2023, 14:43:09) [GCC 12.3.0] Type 'copyright', 'credits' or 'license' for more information IPython 8.19.0 -- An enhanced Interactive Python. Type '?' for help.
but when i enter !python --version, i see output Python 3.10.10
can you please describe and help resolve this problem? how i can create many different kernels? why he create kernel like base conda env?


why command !python -V shows python 3.10?
I think what i install kernel wrong, but in kernel json all good

what need do whent kernels work as need?

problem solved.
for conda envs need install package nb_conda_kernels and ipykernel in new env, reload jupyter server and all should works.
creatink work kernel should see like conda creane --name new_env python=3.11 nb_conda_kernels ipykernel when shutdow and up jupyter server


python -m ipykernel install --user --name myenv --display-name "Python (myenv)" needs when we use not conda env like venv, when it should work

1 Like