#Alternative Python Version bricks Desktop and Terminal access. How can I avoid this?

6 messages · Page 1 of 1 (latest)

tranquil pelican
#

I need a newer Version of Python to run PrivateGPT. I followed a tutorial and everything worked out ok, but Linux Mint itself doesn't work with the newer python version and runs into massive problems, like my desktop isn't shown anymore and I can't even launch the terminal anymore. That's why I had to set the standard python again as the default.

Is there a way to use a different version of python just for specific task instead of making it the default for the whole OS?


Steps to reproduce:

  1. Added new ppa to get current python version sudo add-apt-repository ppa:deadsnakes/ppa
  2. Installing Python 3.11 sudo apt install python3.11
  3. Installing Python 3.11 venv Virtual envoirnment sudo apt install python3.11-venv
  4. Setup Python3 in "update-alternatives"
    sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 110
    sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 100
  5. Changed the current default to 2 (screenshot below) sudo update-alternatives --config python3

And because it did mess everything up, I changed the default back to 0

bitter fractal
#

Have you tried the virtualenv module? It allows you to create a python virtual environment and specify the version of python you want.

tranquil pelican
bitter fractal
#

You can use pip inside the virtualenv and it'll install to the virtualenv

Real rough setup:

sudo apt install python3-virtualenv
cd $PROJECT_DIR
python3 -m virtualenv -p python3.12 venv #or what version you want and is installed
# creates venv as the virtual environment
. venv/bin/activate
pip install <modules you need>
deactivate #when done
tranquil pelican
#

Thanks a lot! @bitter fractal