Re: How do you install a .whl file globally in debian without breaking? system packages?

Robert Heller <[email protected]> Fri, 10 Jul 2026 15:44:55 -0400 (EDT)
Newsgroups gmane.linux.debian.user
Organization Deepwoods Software
Message-ID <[email protected]>
Normally you can't do that.  If the python package does not have a 
corresponding .deb file in the Debian repository, you can only install things 
in a Python "virtual environment".

There is a "trick":

1) create a Python "virtual environment", say in /tmp or in your $HOME 

2) use pip in that virtual environment to install the packages there. 

3) create a python3.11 directory tree under /usr/local/lib (or /opt/lib if you
prefer):

marchhare% dir /usr/local/lib/python3.11/
dist-packages/ site-packages/ 

and copy the revevant files from the virtual environment's lib/python3.11/

4) in any Python code that needs to use these packages, add these lines:

import sys
sys.path.append("/usr/local/lib/python3.11/dist-packages/")

This "trick" is not documented anywhere and the Python community is going to 
bitch that this is bad idea or some such nonsense, but *I* don't care.  Use at 
your own risk.  All I can say is that it works for me and I don't see any real 
problem with this.  Python really should include some flavor of the above 
sys.path.append() call as part of the core Python startup code.  Almost all 
other languages do include some variant of it,  It is a long standing thing in 
the UNIX world to use /usr/local (or /opt) for locally (or non-system 
supported) installed packages.


At Fri, 10 Jul 2026 13:48:47 -0400 David Niklas <[email protected]> wrote:

> 
> Hello,
> I wanted to install a python pip wheel file globally without breaking my
> system packages. I tried searching online, but I cannot figure out how to
> do that.
> 
> How do you install a .whl file globally in debian without breaking system
> packages?
> 
> Thanks!
> 
>                                                                              
>