Python Forum

Full Version: Installing Python packages as OS-level packages
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi. I am maintaining several Python packages and for that purpose I live in a world of Python virtual environments with "pip" as an installer.

However, system admins out there live in a world of OS-level packages and their package managers, including for Python packages (aka "distributions").

Every open source Python project I know of specifies dependencies to other Python packages in terms of requirements.txt files, i.e. for the world where "pip" is the installer. That makes it hard for system admins to figure out the corresponding OS-level packages.

Has anyone come across a tool that identifies and installs the corresponding OS-level Python packages for those Python packages specified in a requirements.txt file, depending on the OS platform and OS package manager? (e.g. brew for macOS, chocolatey for Windows, yum/dnf/apt/yast/etc. for Linux).

I know bindep, but (1) it only checks and does not install and (2) it has its own dependency format which is not as capable as the requirements.txt format.

Andy
You can use pyenv which will allow you to install whatever version of python you need for a given project. You can have any number of co-resident versions of python. Once you have defined the version needed for a virtual environment, when activated, the venv will know the proper version of python to use.
(Jul-01-2024, 07:34 PM)Larz60+ Wrote: [ -> ]You can use pyenv

Sure. But that is again a virtual env. I am looking for something that uses OS-level packages for updating the system Python. For example, on Ubuntu, the Python package "setuptools" is in the OS-level package "python-setuptools".

Update: I have to stand corrected. I thought that pyenv only manages virtual python environments, but it also supports switching global Python versions. I have not found functionality in pyenv to install dependent Python packages, though.
Here you have a tutorial by a guy who builds a Python package for Ubuntu that depends on the requests module. It could be a starting point.