Python Forum
Install python 2.7 in jupyter lab
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Install python 2.7 in jupyter lab
#11
   ~  sudo systemctl start snapd  ✔
   ~  sudo systemctl status snapd  ✔
● snapd.service - Snap Daemon
Loaded: loaded (/usr/lib/systemd/system/snapd.service; disabled; preset: d>
Active: active (running) since Wed 2024-05-29 21:27:01 IST; 9s ago
TriggeredBy: ● snapd.socket
Main PID: 2261 (snapd)
Tasks: 10 (limit: 2145)
Memory: 49.3M ()
CPU: 664ms
CGroup: /system.slice/snapd.service
└─2261 /usr/lib/snapd/snapd

May 29 21:27:01 dell systemd[1]: snapd.service: Got notification message from P>
May 29 21:27:01 dell systemd[1]: snapd.service: Got notification message from P>
May 29 21:27:01 dell snapd[2261]: overlord.go:271: Acquiring state lock file
May 29 21:27:01 dell snapd[2261]: overlord.go:276: Acquired state lock file
May 29 21:27:01 dell snapd[2261]: daemon.go:247: started snapd/2.62 (series 16;>
May 29 21:27:01 dell snapd[2261]: daemon.go:340: adjusting startup timeout by 3>
May 29 21:27:01 dell snapd[2261]: backends.go:58: AppArmor status: apparmor not>
May 29 21:27:01 dell snapd[2261]: helpers.go:150: error trying to compare the s>
May 29 21:27:01 dell systemd[1]: snapd.service: Got notification message from P>
May 29 21:27:01 dell systemd[1]: Started Snap Daemo
Reply
#12
It looks like the snapd service is now running correctly.
Test that it work,this i stuff you could have done in post.
snap version

sudo snap install hello-world
# After the installation, you can run the installed snap to test it:
hello-world
Reply
#13
   ~  snap version  ✔
snap 2.62
snapd 2.62
series 16
manjaro -
kernel 5.15.158-1-MANJARO
   ~  sudo snap install hello-world  ✔
[sudo] password for raman:
2024-05-30T09:50:18+05:30 INFO Waiting for automatic snapd restart...
hello-world 6.4 from Canonical✓ installed
   ~  hello-world  ✔  3m 41s 
Hello World!
   ~   ✔
Reply
#14
How to add python 2.7.18?

   ~  sudo pyenv install 2.7.18  ✔
[sudo] password for raman:
pyenv: /root/.pyenv/versions/2.7.18 already exists
continue with installation? (y/N) n
   ~  pyenv global 2.7.18  1 ✘  12s 
   ~  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.
>>>
Reply
#15
You shall not use sudo with pyenv.
pyenv manages environments per user, not system-wide.
Do first.
sudo pyenv uninstall 2.7.18 
Here a example if i do it.
# Check version
tom@tom-VirtualBox:~$ pyenv --version
pyenv 2.4.1-6-g56956e9d

# Now Python version
tom@tom-VirtualBox:~$ python -V
Python 3.11.3

# Install 2.7.18
tom@tom-VirtualBox:~$ pyenv install 2.7.18
pyenv: /home/tom/.pyenv/versions/2.7.18 already exists
continue with installation? (y/N) y
Downloading Python-2.7.18.tar.xz...
.....
Installed Python-2.7.18 to /home/tom/.pyenv/versions/2.7.18

# Switch to 2.7.18
tom@tom-VirtualBox:~$ pyenv global 2.7.18

# Test that it work
tom@tom-VirtualBox:~$ python -V
Python 2.7.18
tom@tom-VirtualBox:~$ python
Python 2.7.18 (default, Mar 18 2022, 14:15:22) 
[GCC 7.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
Also make sure that shell configuration is ok.
Can look first eg nano ~/.bashrc or vi ~/.bashrc
# pyenv setup, can place last in file
export PATH="$HOME/.pyenv/bin:$PATH"
eval "$(pyenv init --path)"
eval "$(pyenv init -)"
If not ok code under will add lines needed or can manually edit in editor over.
For Bash (~/.bashrc):
echo -e '\n# pyenv setup\nexport PATH="$HOME/.pyenv/bin:$PATH"\neval "$(pyenv init --path)"\neval "$(pyenv init -)"' >> ~/.bashrc
source ~/.bashrc
For Zsh (~/.zshrc):
echo -e '\n# pyenv setup\nexport PATH="$HOME/.pyenv/bin:$PATH"\neval "$(pyenv init --path)"\neval "$(pyenv init -)"' >> ~/.zshrc
source ~/.zshrc
Reply
#16
   ~  sudo pyenv uninstall 2.7.18  ✔
[sudo] password for raman:
pyenv: remove /root/.pyenv/versions/2.7.18? [y|N] y
pyenv: 2.7.18 uninstalled
   ~  python -V  ✔  9s 
Python 3.12.3
   ~  pyenv install 2.7.18  ✔
pyenv: /home/raman/.pyenv/versions/2.7.18 already exists
continue with installation? (y/N) y
Downloading Python-2.7.18.tar.xz...
-> https://www.python.org/ftp/python/2.7.18....18.tar.xz
Installing Python-2.7.18...
patching file configure
patching file configure.ac
patching file setup.py
patching file Mac/Tools/pythonw.c
patching file setup.py
patching file Doc/library/ctypes.rst
patching file Lib/test/test_str.py
patching file Lib/test/test_unicode.py
patching file Modules/_ctypes/_ctypes.c
patching file Modules/_ctypes/callproc.c
patching file Modules/_ctypes/ctypes.h
patching file Modules/_ctypes/callproc.c
patching file setup.py
patching file Mac/Modules/qt/setup.py
patching file setup.py
Installed Python-2.7.18 to /home/raman/.pyenv/versions/2.7.18
   ~  pyenv global 2.7.18  ✔  4m 22s 
   ~  python -V  ✔
Python 3.12.3
   ~  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.
>>>
Reply
#17
   ~  pyenv install 2.7.18  ✔  39s 
pyenv: /home/raman/.pyenv/versions/2.7.18 already exists
continue with installation? (y/N) n
   ~  pyenv global 2.7.18  1 ✘
   ~  python -V  ✔
Python 3.12.3
   ~ 
Reply
#18
Try this the it should work.
pyenv local 2.7.18
Also reason why global switch don't work.
echo $PATH
If in output on command there is a file named home/.python-version delete this folder,then global switch should work again.
Reply
#19
   ~  pyenv local 2.7.18  ✔
   ~  echo $PATH  ✔
/home/raman/.juliaup/bin:/home/raman/.local/bin:/usr/local/bin:/usr/bin:/var/lib/snapd/snap/bin:/usr/local/sbin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl
   ~  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.
>>>
Reply
#20
If look at output of echo $PATH so have you not add pyenv to shell config file as posted before Undecided
So you most open the file vi ~/.bashrc or nano ~/.bashrc.
Then add these lines last in file and save.
# pyenv setup, can place last in file
export PATH="$HOME/.pyenv/bin:$PATH"
eval "$(pyenv init --path)"
eval "$(pyenv init -)"
Then restart shell try both.
pyenv local 2.7.18 
pyenv global 2.7.18 
Then 2.7.18 should be version used.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Troubleshooting Jupyter Notebook installation with Python using pip and a venv Drone4four 1 300 Jun-04-2024, 10:55 PM
Last Post: Drone4four
Thumbs Up Python 3 Jupyter notebook ternary plot data nicholas 0 1,096 Jan-21-2023, 05:01 PM
Last Post: nicholas
  Help Python vs Jupyter futureofAI 2 1,707 Oct-17-2021, 09:45 AM
Last Post: futureofAI
  It says there is no keras in jupyter notebook. it is wrong there is a keras install Led_Zeppelin 0 1,990 Apr-27-2021, 08:29 PM
Last Post: Led_Zeppelin
  install jupyter-nb within VSCode apollo 2 2,314 Feb-05-2021, 10:34 AM
Last Post: apollo
  how to install pyramid.arima in jupyter notebook bntayfur 1 4,367 Aug-06-2020, 04:37 AM
Last Post: ndc85430
  Error executing Jupyter command 'notebook': [Errno 'jupyter-notebook' not found] 2 Newtopython123 10 31,817 Apr-25-2019, 07:30 AM
Last Post: banu0395
  Jupyter and python terminal dervast 3 2,876 Mar-29-2019, 02:08 PM
Last Post: dervast
  Code runs as pure python but not jupyter notebook miner_tom 3 3,541 Aug-22-2018, 04:00 PM
Last Post: miner_tom
  1 What is Jupyter? and what's the difference between it and "pure python"? InigoSJ 2 3,074 Apr-05-2018, 07:24 PM
Last Post: InigoSJ

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020