Saturday, August 5, 2023

Remove python3 - Python 3.11 on Ubuntu

ls /usr/bin/python* // list all installed python versions

[Bug]: RuntimeError: Couldn't Install Torch

Stable Diffusion----------------------------------------------------------------------------
./webui.sh --xformers

################################################################
Install script for stable-diffusion + Web UI
Tested on Debian 11 (Bullseye)
################################################################

################################################################
Running on user user
################################################################

################################################################
Repo already cloned, using it as install directory
################################################################

################################################################
Create and activate python venv
################################################################

################################################################
Launching launch.py...
################################################################
Using TCMalloc: libtcmalloc_minimal.so.4
Python 3.11.4 (main, Jun  9 2023, 07:59:55) [GCC 12.3.0]
Version: v1.5.1
Commit hash: 68f336bd994bed5442ad95bad6b6ad5564a5409a
Installing torch and torchvision
/home/user/Downloads/stable-diffusion-webui/venv/bin/python3: No module named pip
Traceback (most recent call last):
  File "/home/user/Downloads/stable-diffusion-webui/launch.py", line 39, in <module>
    main()
  File "/home/user/Downloads/stable-diffusion-webui/launch.py", line 30, in main
    prepare_environment()
  File "/home/user/Downloads/stable-diffusion-webui/modules/launch_utils.py", line 311, in prepare_environment
    run(f'"{python}" -m {torch_command}', "Installing torch and torchvision", "Couldn't install torch", live=True)
  File "/home/user/Downloads/stable-diffusion-webui/modules/launch_utils.py", line 113, in run
    raise RuntimeError("\n".join(error_bits))
RuntimeError: Couldn't install torch.
Command: "/home/user/Downloads/stable-diffusion-webui/venv/bin/python3" -m pip install torch==2.0.1 torchvision==0.15.2 --extra-index-url https://download.pytorch.org/whl/cu118
Error code: 1
----------------------------------------------------------------------------Stable Diffusion

sudo rm /usr/bin/python3.11
sudo apt purge python3.11
usr/bin$ sudo apt remove python3.11-minimal

sudo find / -xdev -name python3.11*
sudo find / -xdev -name 'python3.11*' -exec rm -r {} \; // remove all found

sudo apt-get purge python3-uno
sudo apt-get install python3-uno

sudo apt-get purge python3.11-minimal python3.11 python3 python3-uno

sudo apt update -y && sudo apt upgrade -y
sudo apt --fix-broken install
sudo apt autoremove --purge *python* // remove all python packages

apt-cache policy python3

SOLUTION in my case:
sudo dpkg --force-depends --purge libpython3.11-stdlib
sudo dpkg --force-depends --purge libpython3.11
sudo dpkg --force-depends --purge libpython3.11-minimal
sudo apt --fix-broken install

AVOID creating conflicts by installing different kernel version updates!!!

sudo apt install -f --reinstall python3-minimal
sudo apt install -f --reinstall python3-pip
sudo apt install -f --reinstall python3
sudo apt update
sudo apt upgrade
sudo apt full-upgrade
sudo apt reinstall plasma-desktop
sudo apt reinstall kwin-x11

https://www.digitalocean.com/community/tutorials/how-to-install-python-3-and-set-up-a-programming-environment-on-ubuntu-22-04
https://askubuntu.com/questions/1402419/cant-remove-python-3-10-from-ubuntu-20-04lts
https://gist.github.com/zhensongren/811dcf2471f663ed3148a272f1faa957
https://computingforgeeks.com/how-to-install-python-on-ubuntu-linux-system/?expand_article=1
https://linuxhint.com/uninstall-python-ubuntu-22-04/
https://www.debugpoint.com/install-python-3-10-ubuntu/

No comments:

Post a Comment