Missing Python dependencies for venv standard library module

Marco Atzeri marco.atzeri@gmail.com
Mon Nov 27 17:15:35 GMT 2023


On 10.11.2023 16:43, Adam Dinwoodie via Cygwin wrote:
> On Fri, Nov 10, 2023 at 02:35:16PM +0000, Jon Turney wrote:
>> On 08/11/2023 16:17, Adam Dinwoodie via Cygwin wrote:
>>> Hullo,
>>>
>>> It looks like the python39 package is missing dependencies on
>>> python-setuptools-wheel and python-pip-wheel.  I've not checked, but I
>>> suspect earlier Python versions are missing the same dependencies.
>>> Without these, the Python built-in venv module doesn't work:
>>>
>>>       $ python3 -m venv v
>>>       Error: Command '['/home/WDAGUtilityAccount/v/bin/python3', '-Im', 'ensurepip', '--upgrade', '--default-pip']' returned non-zero exit status 1.
>>>
>>> Compare when the both python-setuptools-wheel and python-pip-wheel are
>>> installed:
>>>
>>>       $ python3 -m venv v
>>>       $ . v/bin/activate
>>>       (v) $ python3 -c 'import sys; print(sys.path)'
>>>       ['', '/usr/lib/python39.zip', '/usr/lib/python3.9', '/usr/lib/python3.9/lib-dynload', '/home/WDAGUtilityAccount/v/lib/python3.9/site-packages']
>>>       (v) $ deactivate
>>>
>>> I've attached cygcheck files from sandbox VMs for both the broken and
>>> working cases.  I'm not sure what the correct fix is here -- possibly
>>> adding dependencies, possibly changing how things are packaged -- but
>>> I'd expect Python standard library modules to either work or to give an
>>> error message that makes it clearer what additional packages are
>>> required to make them work.
>>
>> Yeah. I have a vague recollection there was some other case recently where
>> one these being missing was causing some confusion.
>>
>> I think the easiest way to convince me that this is a historical oversight
>> would be to look how other distros do this: If they have python depend on
>> python-setuptools and python-wheel, then we probably should as well...
> 
> I only have Debian set up to check quickly, but just looking at that
> example:
> 
> - /usr/share/python-wheels/setuptools-66.1.1-py3-none-any.whl is
>    provided by the python3-setuptools-whl package.
> - python3-setuptools-whl is required by python3.11-venv
> - python3.11-venv is required by python3-venv
> - python3-venv is suggested (*not* required) by python3
> 
> Slighly confusingly, python3.11-venv looks to only provide the ensurepip
> module; the venv module is provided by libpython3.11-stdlib, which is a
> requirement for python3, so it's only an Apt "suggestion" that gets this
> working there.  However, Debian does provide a more useful error message
> when you don't have things installed usefully:
> 
>      $ python3 -m venv v
>      The virtual environment was not created successfully because ensurepip is not
>      available.  On Debian/Ubuntu systems, you need to install the python3-venv
>      package using the following command.
>      
>          apt install python3.11-venv
>      
>      You may need to use sudo with that command.  After installing the python3-venv
>      package, recreate your virtual environment.
>      
>      Failing command: /home/adam/v/bin/python3
> 
> So that's at least one other distro that is at least a bit more helpful.
> As I say, I don't have strong opinions on what the correct fix is here.
> Just adding the dependencies is an obvious option, and probably the
> easiest option from a maintainer perspective, but it's clearly not the
> only option.

Hi Adam,

I had the impression that setuptools was obsolete.
But I need to refresh my knowledge and the python packages in generale

Regards
Marco




More information about the Cygwin mailing list