Python Forum

Full Version: Install python 2.7 in jupyter lab
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
I have already saved in .bashrc file:

# pyenv setup, can place last in file
export PATH="$HOME/.pyenv/bin:$PATH"
eval "$(pyenv init --path)"
eval "$(pyenv init -)"
but i am still unable to use python2.7 ? Huh
    ~  pyenv local 2.7.18                                               ✔ 
    ~  python                                                           ✔ 
Python 3.12.3 (main, Apr 23 2024, 09:16:07) [GCC 13.2.1 20240417] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 
KeyboardInterrupt
>>> 
    ~  pyenv global 2.7.18                                       ✔  6s  
    ~  python                                                           ✔ 
Python 3.12.3 (main, Apr 23 2024, 09:16:07) [GCC 13.2.1 20240417] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 
I have already saved in .bashrc file:

# pyenv setup, can place last in file
export PATH="$HOME/.pyenv/bin:$PATH"
eval "$(pyenv init --path)"
eval "$(pyenv init -)"
I am still unable to use python2.7 Huh
    ~  pyenv local 2.7.18                                               ✔ 
    ~  python                                                           ✔ 
Python 3.12.3 (main, Apr 23 2024, 09:16:07) [GCC 13.2.1 20240417] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 
KeyboardInterrupt
>>> 
    ~  pyenv global 2.7.18                                       ✔  6s  
    ~  python                                                           ✔ 
Python 3.12.3 (main, Apr 23 2024, 09:16:07) [GCC 13.2.1 20240417] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 
Hmm ok,look lilke Manjaro(i dont't use it) use zsh as default shell.
Quote:Manjaro seems to install both bash (login shell) and zsh (user preferred shell, e.g. when opening a console).
Then you need to add lines to zsh shell.
So vi ~/.zshrc or nano ~/.zshrc and add same line to this file and save.
# pyenv setup, can place last in file
export PATH="$HOME/.pyenv/bin:$PATH"
eval "$(pyenv init --path)"
eval "$(pyenv init -)"
Restart shell and try again.
    ~  echo "$SHELL"                                                    ✔ 
/bin/zsh
    ~         
    ~  pyenv local 2.7.18                                               ✔ 
    ~  python                                                           ✔ 
Python 2.7.18 (default, May 30 2024, 21:44:42) 
[GCC 13.2.1 20240417] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> 
Good Dance
Can now i use python2.7.18 in Jupyter notebook?

Thank You for helping me. so main mistake was the shell used by Manjaro Linux.
Good pyenv finally works 👍
Can now eg install a Anaconda that use Python 2,this comes with Jupyter Notebook pre-installed.
Example look at pyenv install --list.
tom@tom-VirtualBox:~$ pyenv install anaconda2-2019.10
Downloading Anaconda2-2019.10-Linux-x86_64.sh...
-> https://repo.anaconda.com/archive/Anaconda2-2019.10-Linux-x86_64.sh
Installing Anaconda2-2019.10-Linux-x86_64...
Installed Anaconda2-2019.10-Linux-x86_64 to /home/tom/.pyenv/versions/anaconda2-2019.10

# Switch to this version global or local
tom@tom-VirtualBox:~$ pyenv global anaconda2-2019.10

# Test
tom@tom-VirtualBox:~$ python -V
Python 2.7.16 :: Anaconda, Inc.

# Start jupyter notebook will now use Python 2
tom@tom-VirtualBox:~$ jupyter notebook
I have Jupyter notebook already installed. My laptop has 2 GB RAM. Can i use python2.7 in Jupyter notebook without installing Anaconda?
(Jun-01-2024, 12:25 PM)raman Wrote: [ -> ]I have Jupyter notebook already installed. My laptop has 2 GB RAM. Can i use python2.7 in Jupyter notebook without installing Anaconda?
No that will not work,need a new Jupyter kernel that use Python 2.
The Anaconda version you install is stand alone,and will not affect other stuff that installed.
Can just remove when don't need it anymore.
pyenv uninstall anaconda2-2019.10
Pages: 1 2 3