-
Notifications
You must be signed in to change notification settings - Fork 20
Installing on debian Ubuntu
(You can skip directly to the following sections, if you are only interested in the "how" and not the "why".)
Debian-based systems fumble with the standard Python module search paths in a way, which leaves the standard way of installing Python modules broken - be it via autotools
or, as in the case of jack_mixer
, via meson
.
These mentioned installation methods rely on the get_paths
function from the sysconfig
module of the Python standard library to return the correct installation paths for third-party modules. Even though debian / Ubuntu changes the Python module search path, sysconfig.get_path()
returns the unchanged standard installation paths. A module, which is installed into one of these paths, will then not be importable (without manipulating sys.path
manually) on debian / Ubuntu.
The following Python interactive session on Ubuntu 20.04 demonstrates the discrepancy between sys.path
and sysconfig.get_paths()
(some line-breaks added for better readability):
$ python3
Python 3.8.5 (default, Jul 28 2020, 12:59:40)
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.path
['', '/usr/lib/python38.zip', '/usr/lib/python3.8', '/usr/lib/python3.8/lib-dynload',
'/usr/local/lib/python3.8/dist-packages', '/usr/lib/python3/dist-packages']
>>> import sysconfig
>>> sysconfig.get_paths(scheme='posix_prefix')
{'stdlib': '/usr/lib/python3.8', 'platstdlib': '/usr/lib/python3.8',
'purelib': '/usr/lib/python3.8/site-packages', 'platlib': '/usr/lib/python3.8/site-packages',
'include': '/usr/include/python3.8', 'platinclude': '/usr/include/python3.8',
'scripts': '/usr/bin', 'data': '/usr'}
Ubuntu packagers say they don't support running software not installed via their package management, so they are not going to fix this.
This means, when we want to install jack_mixer
ourselves manually from a source distribution or a Git repo checkout, we have to take some extra steps to adapt the jack_mixer
start script to take the peculiarities of the Python module search paths on debian / Ubuntu into account.
This is not supported out-of-box in the vanilla jack_mixer
sources, since we don't want to start catering to the vagaries of specific distributions. We'd rather have that meson
on debian/Ubuntu is fixed to install Python modules to the directories the debian Python policy prescribes.
Step 1: Install build and run-time requirements:
sudo apt-get install \
build-essential \
jackd2 \
libglib2.0-dev \
libjack-jackd2-dev \
meson \
pkgconf \
python3-gi \
python3-xdg
Step 2: Get the sources from the Git repo:
For this, we need some additional build dependencies:
sudo apt-get install cython3 git python3-docutils
Then clone the jack_mixer
Git repository:
git clone https://github.com/jack-mixer/jack_mixer
cd jack_mixer
Step 2 (alternative): Get and unpack the source distribution:
wget https://rdio.space/jackmixer/tarballs/jack_mixer-15.tar.xz{,.sha256sum}
sha256sum -c jack_mixer-15.tar.xz.sha256sum && \
tar -xJf jack_mixer-15.tar.xz
cd jack_mixer-15
Step 3: Edit the jack_mixer
start script to let it find the jack_mixer
module:
sed -i -e \
's|import sys$|import sys, sysconfig\nsys.path.insert(0, sysconfig.get_path("purelib"))|' \
jack_mixer/__main__.py
Step 4: Then build and install jack_mixer
:
meson setup builddir --prefix=/usr --buildtype=release
ninja -C builddir
sudo ninja -C builddir install
With meson versions >= 0.54.0 you can also use meson compile -C builddir
and sudo meson install -C builddir
instead, for the last two commands.
Step 1: Install build and run-time requirements:
sudo apt-get install \
build-essential \
jackd2 \
libglib2.0-dev \
libjack-jackd2-dev \
ninja-build \
pkgconf \
python-gi \
python-xdg
Step 1a: The version of meson packaged for Ubuntu 18.04 (0.45.x) is too old to build jack_mixer
, so we need to install meson >= 0.53.0 from PyPI under /usr/local
:
sudo apt-get install python3-pip
sudo python3 -m pip install -U meson
Then continue with steps 2, 3 and 4 as described above for Ubuntu 20.04.