[Python] Ensurepip module not existing, how to install manually?

Discussão em 'Python' iniciado por Stack, Fevereiro 25, 2025.

  1. Stack

    Stack Membro Participativo

    In the interest of not getting an XY problem: the goal is to create a virtual environment on synology dsm, so no apt-get, where pip is installed manually.

    I am trying to create a virtual environment, in above environment (synology dsm package python 3.8 with pip installed manually).

    However this gives the following error:

    $ python3 -m venv new_venv
    Error: Command '['/volume1/docker/builder/new_venv/bin/python3', '-Im', 'ensurepip', '--upgrade', '--default-pip']' returned non-zero exit status 1.


    In the chain of finding that error I discovered that venv is working "just fine":

    $ python3 -m venv --without-pip new_venv


    Works as expected. Also pip itself works as expected. However I had to install pip manually. This also has as consequence that the synology dsm version of python does not have the module ensurepip..

    # python3 -c "import ensurepip; print(ensurepip.__file__);"
    Traceback (most recent call last):
    File "<string>", line 1, in <module>
    ModuleNotFoundError: No module named 'ensurepip'


    This gives the problem: how does one manually install ensurepip, and/or make virtual env install pip without relying on ensurepip?

    Continue reading...

Compartilhe esta Página