Successful install on Debian 12 (Bookworm) i.e. how to work with/around PEP-668. #4542
Replies: 5 comments
-
Excellent write up, thanks! |
Beta Was this translation helpful? Give feedback.
-
Someone had problem with Pyenv? |
Beta Was this translation helpful? Give feedback.
-
I have never tried/studied Are you suggesting |
Beta Was this translation helpful? Give feedback.
-
I tried to install and something didn't work well. The |
Beta Was this translation helpful? Give feedback.
-
Thank you! made my life easier. Would like to complement with a little tip. Qtile was complaining because dbus-next wasn't installed, I used |
Beta Was this translation helpful? Give feedback.
-
Hi all. Complete qtile newbie here.
After several late evenings and much gnashing of teeth, I have finally succeeded in installing qtile (0.23.0) on debian 12 (bookworm). I am documenting what I've learnt because I wish that someone else had already documented this for me to read before I started trying to get this to work.
Background (no more
pip install ...
)Despite a brief near-miss and a semi-current "Intent to package", qtile has never been included in the official Debian distribution so debian's usual package installation method (
sudo apt install qtile
) will not work. Instead, qtile's recommended installation method has, up until now, beenpip install ...
.However, Debian, Ubuntu and Fedora have all recently made stable releases which incorporate PEP-668 - this is a change to the python ecosystem designed to avoid system environment breakage caused by using potentially-conflicting package managers (for example
sudo apt install
vs.pip install
). One consequence of this change is that we can no longer usepip install ...
to install system packages as we did previously.Method 1:
break-system-packages
(no thanks!)PEP-668 is basically a safety mechanism that stops pip from installing into your python "system environment". There are several different ways to override (i.e. ignore) this safety mechanism:
pip
with the--break-system-packages option
, orpip
with the environment variablePIP_BREAK_SYSTEM_PACKAGES
set to1
, orbreak-system-packages = true
to your pip config (~/.config/pip/pip.conf
or/etc/pip.conf
), or/usr/lib/python3.*/EXTERNALLY-MANAGED
.While this approach is chosen by many123, I want to avoid it if possible. I personally think that PEP-668 is a move in the right direction, and that letting
pip
modify your system environment is a retrograde step (When your system breaks, you will get to keep both pieces).Method 2:
venv
virtual environment pluspip
(this failed)(Important: this section is only here to document what did not work. If you want a working solution, see "Method 3" below.)
My first attempt used a
venv
virtual environment pluspip
. After a minimal4 installation of debian, I installed qtile:Then I installed the required xorg packages...
... and created
.xinitrc
:When I ran
startx
, I got the default qtile desktop, but there was a problem:which python3
(run from inside a terminal emulator) returned the virtual environment's python interpreter:Hmmm. Could I
deactivate
this partially-inherited virtual environment? No:Not good. It appears that terminal emulators (spawned by qtile) inherit parts of qtile's underlying virtual environment (such as the interpreter path), but they do not inherit enough of that environment to be able to
deactivate
it.5 I decided to try a different approach...Method 3:
pipx
(this succeeded!)Next, I tried Debian 12's release notes' suggestion: using
pipx
.After a minimal4 installation of debian, install qtile:
(If the
pipx install qtile
line produces an error message saying that a necessary directoryis not on your PATH environment variable
then simply log-out and log back in again - debian 12 already includes the required code in.profile
.)Then install the required xorg packages...
... and create the "pipx version" of
.xinitrc
:Now, when I run
startx
, I get the default qtile desktop, andwhich python3
(run from inside a terminal emulator) returns the "correct" python interpreter:HTH, jaimet
Footnotes
JustAGuy Linux's Speed Challenge includes qtile - his installation script does a
sudo rm /usr/lib/python3.11/EXTERNALLY-MANAGED
. ↩JerrySM64's qtile installation script also does a
sudo rm /usr/lib/python3.11/EXTERNALLY-MANAGED
. ↩https://www.reddit.com/r/debian/comments/14g9np9 ↩
At the "Software selection" (tasksel) screen, I select only "SSH server" and "standard system utilities". ↩ ↩2
I don't think that this is a problem with
qtile
in isolation, as thepipx
approach succeeds. It may be a "qtile
in avenv
" architecture problem, but more research is needed. ↩Beta Was this translation helpful? Give feedback.
All reactions