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
   ~  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
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
   ~  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!
   ~   ✔
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.
>>>
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
   ~  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.
>>>
   ~  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
   ~ 
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.
   ~  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.
>>>
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.
Pages: 1 2 3