Python Forum
Installing Python packages as OS-level packages
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Installing Python packages as OS-level packages
#1
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
Reply
#2
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.
Reply
#3
(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.
Reply
#4
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.
Larz60+ likes this post
« We can solve any problem by introducing an extra level of indirection »
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  ERROR: THESE PACKAGES DO NOT MATCH THE HASHES FROM THE REQUIREMENTS FILE. subbanaidu 3 5,807 Mar-17-2025, 09:47 AM
Last Post: leafinstorm
  ~~PCEP™ – Certified Entry-Level Python Programmer exam kimtimdrte 0 830 Aug-27-2024, 05:28 AM
Last Post: kimtimdrte
  Python vs low level languages, (say C++) astral_travel 1 1,456 Apr-07-2024, 01:22 AM
Last Post: PyDan
  Malicious PyPI Packages Slip WhiteSnake InfoStealer Malware onto Windows Machines rob101 3 1,639 Jan-30-2024, 01:54 PM
Last Post: rob101
  to get a list of pip packages that were installed Skaperen 12 10,659 Jun-25-2022, 11:38 AM
Last Post: snippsat
  Looking for people for a Python/Data Science study group (beginner level) fredj32 3 3,243 Jul-02-2020, 02:37 AM
Last Post: Diogenes
  Determing packages needed by a script: Creating a Miniconda environment ashevade 1 2,581 Jan-27-2020, 09:25 AM
Last Post: buran
  High level Python program architectural design question - decoration for multiple ent yahbai 0 2,430 Jan-16-2020, 08:30 PM
Last Post: yahbai
  Python 3.8 - Some Packages No Longer Accepted ? adt 1 3,244 Oct-20-2019, 03:22 PM
Last Post: metulburr
  Unable to install packages vtechzbi 3 26,456 Jul-01-2019, 07:27 PM
Last Post: snippsat

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020