0

The Python 3.5+ documentation describes ensurepip as a part of the standard library, and multiple resources (e.g., this page) are written as if ensurepip is assumed to be available with recent Python 3 installations. However, as other postings in Stack Overflow have noted, this does not appear to be the case, at least with Ubuntu and Debian. Now I am confused about how I should instruct my users to install Python-based software. I have been telling people to use python3 -m ensurepip followed by python3 -m pip install ... (as in this example) but a colleague recently found that, sure enough, ensurepip does not exist after installing Python on an Ubuntu system. Now I don't know whether I need to write about exceptions to the general instructions. Worse, I don't know how to find out which systems do or don't have ensurepip.

Is ensurepip supposed to be available as a standard library with every Python 3.5+ installation? If not, how do I find out which installations include it, and which don't?

mhucka
  • 2,143
  • 26
  • 41

1 Answers1

0

Indeed ensurepip should always be available since it's part of Python's standard library but, from what I understood, some operating systems (such as Debian and Ubuntu) distribute versions of Python that are split over multiple items instead of just one. So that, depending on the installation options, some parts of the standard library such as ensurepip are often missing.

To be on the safe side you could instruct your users to install Python directly from python.org (as you would do for Windows for example). Or you would have to look at each operating system (Linux distribution) individually and figure out what the right items to install are, which could be tedious.

From my personal point of view, I would say that how the users of your Python application or library install Python, shouldn't be any of your concern. Each user might have their own needs and it's impossible to cover all use cases. On the other hand if you want total control, there are ways to distribute applications in a format containing all dependencies, including the Python interpreter, you could look into that.

sinoroc
  • 18,409
  • 2
  • 39
  • 70