# Wrong version python in kernel

**URL:** <https://discourse.jupyter.org/t/wrong-version-python-in-kernel/23186>\
**Category:** JupyterLab\
**Tags:** jupyterlab, help-wanted\
**Created:** [January 2, 2024, 1:20pm UTC](https://discourse.jupyter.org/t/wrong-version-python-in-kernel/23186 "2024-01-02T13:20:14Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yuri](https://avatars.discourse-cdn.com/v4/letter/y/71c47a/32.png) [@Yuri](https://discourse.jupyter.org/u/Yuri)\
**Post date:** [January 2, 2024, 1:20pm UTC](https://discourse.jupyter.org/t/wrong-version-python-in-kernel/23186/1 "2024-01-02T13:20:14Z")

</div>

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?**

---

<div class="post-metadata">

**Author:** ![Yuri](https://avatars.discourse-cdn.com/v4/letter/y/71c47a/32.png) [@Yuri](https://discourse.jupyter.org/u/Yuri)\
**Post date:** [January 3, 2024, 7:50am UTC](https://discourse.jupyter.org/t/wrong-version-python-in-kernel/23186/2 "2024-01-03T07:50:47Z")

</div>

![Screenshot_1](https://canada1.discourse-cdn.com/flex031/uploads/jupyter/original/2X/6/66483155962038be6997c620c3ac01ad869547b0.png)  
why command `!python -V` shows python 3.10?  
I think what i install kernel wrong, but in kernel json all good  
 ![Screenshot_2](https://canada1.discourse-cdn.com/flex031/uploads/jupyter/original/2X/f/f739f7b9199a1cce497dcaa5c231933bb6ab87c9.png)

what need do whent kernels work as need?

---

<div class="post-metadata">

**Author:** ![Yuri](https://avatars.discourse-cdn.com/v4/letter/y/71c47a/32.png) [@Yuri](https://discourse.jupyter.org/u/Yuri)\
**Post date:** [January 4, 2024, 7:06am UTC](https://discourse.jupyter.org/t/wrong-version-python-in-kernel/23186/3 "2024-01-04T07:06:40Z")

</div>

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

 ![image](https://canada1.discourse-cdn.com/flex031/uploads/jupyter/original/2X/d/d181f6a4a7735e82bf5ff4d16c32f7c8f8f2a3cc.png)  
 ![image](https://canada1.discourse-cdn.com/flex031/uploads/jupyter/original/2X/5/5850ad19dce8132e43402df195cef50369dba441.png)

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