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
Hi, i want to use python 2.7 but i don't know how to add it in jupyterlab. https://forum.manjaro.org/t/add-python2-...b/162569/1

Can i use python 2.7 in google colab? How?
No,i do not think you can run Python 2.7 in Colab(default version now on Colab Python 3.10.12)
Why do want to run Python 2.7? end of life💀 was over 4-years ago

If really need to run Python 2.7 can do it in different ways local or eg Docker.
Also can not install stuff from PyPi to Python 2.7.
Have to find older wheels or use setup.py,as most 3-party libraries has removed install option for 2.7 a long time ago.
I want to run older code that is compatible to python 2.7 . Can you tell me commands that i need to fire in terminal?
What OS are you using?
Eg i have a Python 2.7 version on Windows and can eg run it like this.
G:\div_code
λ python -V
Python 3.12.2

# Using <py> comes with all Python 3 version
G:\div_code
λ py -2.7 -V
Python 2.7.9
# Run a code with 2.7
λ py -2.7 hello.py
C:\Python27\python.exe
hello world
On linux can eg use pyenv Simple Python Version Management
Or build from source,it all depends how comfortable you are with this stuff.

There also still some online interpreter that has Python 2.7 eg jdoodle , worktech.
I am using Manjaro Linux.

# System Details Report
---

## Report details
- **Date generated:** 2024-05-28 21:21:49

## Hardware Information:
- **Hardware Model:** Dell Inc. Inspiron 3542
- **Memory:** 2.0 GiB
- **Processor:** Intel® Core™ i3-4005U × 4
- **Graphics:** Intel® HD Graphics 4400 (HSW GT2)
- **Disk Capacity:** 628.1 GB

## Software Information:
- **Firmware Version:** A14
- **OS Name:** Manjaro Linux
- **OS Build:** rolling
- **OS Type:** 64-bit
- **GNOME Version:** 46
- **Windowing System:** X11
- **Kernel Version:** Linux 5.15.158-1-MANJARO
Install pyenv on Manjaro Linux
pyenv on Arch.org
Same just that you do:
First pyenv install --list and see if 2.7.18 is there if not just use lesser version.
pyenv install 2.7.18
pyenv global 2.7.18

How to set up Docker in Manjaro (Arch Linux)
Eg a image python:2.7.17-alpine
   ~  sudo pacman -S snapd  ✔
[sudo] password for raman:
warning: snapd-2.62-2 is up to date -- reinstalling
resolving dependencies...
looking for conflicting packages...

Packages (1) snapd-2.62-2

Total Installed Size: 63.80 MiB
Net Upgrade Size: 0.00 MiB

:: Proceed with installation? [Y/n] y
(1/1) checking keys in keyring [######################] 100%
(1/1) checking package integrity [######################] 100%
(1/1) loading package files [######################] 100%
(1/1) checking for file conflicts [######################] 100%
(1/1) checking available disk space [######################] 100%
:: Processing package changes...
(1/1) reinstalling snapd [######################] 100%
:: Running post-transaction hooks...
(1/6) Reloading system manager configuration...
(2/6) Reloading user manager configuration...
(3/6) Creating temporary files...
(4/6) Arming ConditionNeedsUpdate...
(5/6) Reloading system bus configuration...
(6/6) Updating the desktop file MIME type cache...
   ~  sudo systemctl enable --now snapd.socket  ✔  15s 
   ~  sudo ln -s /var/lib/snapd/snap /snap  ✔
ln: failed to create symbolic link '/snap/snap': File exists
   ~ 
Look like snapd was installed,jsut check that it work.
Service and version:
sudo systemctl status snapd  
snap version
If it work just install pyenv.
   ~  sudo systemctl status snapd  ✔
[sudo] password for raman:
× snapd.service - Snap Daemon
Loaded: loaded (/usr/lib/systemd/system/snapd.service; disabled; preset: d>
Active: failed (Result: exit-code) since Wed 2024-05-29 07:30:30 IST; 9min>
TriggeredBy: × snapd.socket
Process: 2522 ExecStart=/usr/lib/snapd/snapd (code=exited, status=1/FAILURE)
Main PID: 2522 (code=exited, status=1/FAILURE)
CPU: 98ms

May 29 07:30:30 dell systemd[1]: snapd.service: Scheduled restart job, restart >
May 29 07:30:30 dell systemd[1]: snapd.service: Start request repeated too quic>
May 29 07:30:30 dell systemd[1]: snapd.service: Failed with result 'exit-code'.
May 29 07:30:30 dell systemd[1]: Failed to start Snap Daemon.
May 29 07:30:30 dell systemd[1]: snapd.service: Triggering OnFailure= dependenc>
lines 1-13/13 (END)
You most search for error you get.
Look at Installing snap on Manjaro Linux

Addition tips.
Ensure that snapd is correctly installed and there are no corrupted files:
sudo pacman -Qk snapd
Sometimes, simply reinstalling snapd can resolve the issue:
sudo pacman -R snapd
sudo pacman -S snapd
Ensure all dependencies for snapd are met. You can do this by updating your system and reinstalling snapd:
sudo pacman -Syu
sudo pacman -S --needed snapd
After reinstalling, try enabling and starting the service again:
sudo systemctl enable --now snapd.socket
sudo systemctl start snapd
Check status:
sudo systemctl status snapd
Pages: 1 2 3