X-Recipient: archive-cygwin@delorie.com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CF1C73858C54
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
	s=default; t=1699631051;
	bh=F746YmmL7HPLPKx1i4SOIKgUzyMOw0Aws36w+oqFQfA=;
	h=Date:To:Subject:References:In-Reply-To:List-Id:List-Unsubscribe:
	 List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:
	 From;
	b=kZKeWOqM8EIIRUL0HVXWwjMxv9ewkvrt8+Qsldv/1iSaYx1ix+L8TrBktVjyg5Nfh
	 Y4O0JCa17VTppyMaI9HmVQJZ+JX+Ccku5Lr15e4uWRoALLSPDwj3BqnuEklv5WKJcm
	 4PYswGZHNgWCIlorkj5m2zUPdk4HWAn+rtpVbO48=
X-Original-To: cygwin@cygwin.com
Delivered-To: cygwin@cygwin.com
DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 525673858D37
ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 525673858D37
ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699631037; cv=none;
 b=eZZhF7KSg1WgYv0NFQjDAL7fbDKs2eLsdVR79AzRf00sKR/8dqYR62Zao3eVUp+m4CK+CDYSpujKIcFVJHNdIvBIPY9q0qhXPlviRsbVh2wtdVUQ38vESAkvTpwqdxpDF/BalQ9lgGM7z1+l9MwY+Zoqs7PAgCXLdajWgiV3dns=
ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key;
 t=1699631037; c=relaxed/simple;
 bh=vF4HGUcjRChIkv6U0R5AIorSnrMohEwSNFOxiG9xvhs=;
 h=Date:From:To:Subject:Message-ID:MIME-Version;
 b=mEGYYRJKWp4viUrkP6bmToYbnManSHoP/rNb8/OAVNBzGzjjJiB1ai7Tfef1+3BdlIPN30o+G7HrraSs4I90IncK0o1VcwO0TLtZs3nDFeQ84ukGNoWlT99FZNCodMpJUNu5HFq+FItPYLY9J9UoaSaErfa/EdINKnQmgRx9Uqo=
ARC-Authentication-Results: i=1; server2.sourceware.org
Date: Fri, 10 Nov 2023 15:43:53 +0000
To: Jon Turney <jon.turney@dronecode.org.uk>,
        The Cygwin Mailing List <cygwin@cygwin.com>
Subject: Re: Missing Python dependencies for venv standard library module
Message-ID: <20231110154353.d2hqp6vxu7fokcrv@lucy.dinwoodie.org>
References: <20231108161743.fhr7sum3k445ag67@lucy.dinwoodie.org>
 <45e21c6e-98a4-443b-bfbd-d3475c3452c0@dronecode.org.uk>
MIME-Version: 1.0
Content-Disposition: inline
In-Reply-To: <45e21c6e-98a4-443b-bfbd-d3475c3452c0@dronecode.org.uk>
X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS,
 RDNS_DYNAMIC, SPF_HELO_PASS, SPF_PASS, TXREP,
 T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on
 server2.sourceware.org
X-BeenThere: cygwin@cygwin.com
X-Mailman-Version: 2.1.30
Precedence: list
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Unsubscribe: <https://cygwin.com/mailman/options/cygwin>,
 <mailto:cygwin-request@cygwin.com?subject=unsubscribe>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-request@cygwin.com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
 <mailto:cygwin-request@cygwin.com?subject=subscribe>
From: Adam Dinwoodie via Cygwin <cygwin@cygwin.com>
Reply-To: Adam Dinwoodie <adam@dinwoodie.org>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: cygwin-bounces+archive-cygwin=delorie.com@cygwin.com
Sender: "Cygwin" <cygwin-bounces+archive-cygwin=delorie.com@cygwin.com>

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.

-- 
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple
