On Thu, 25 Mar 2021 20:01:12 +0000
"Thomas Kluyver" <tho...@kluyver.me.uk> wrote:

> On Thu, 25 Mar 2021, at 19:07, Julian Smith wrote:
> > I was a little surprised to find out that one can't use pip to create
> > an sdist, but i'm a bit late to this party and it looks like there's
> > been plenty of discussion about this in the past.  
> 
> There is now the (quite new) 'build' tool which can be used to make
> both sdists and wheels by working with a PEP 517 backend:
> https://pypi.org/project/build/

Thanks for this, i tried it - see below.

> 
> > I've come across a problem where an old pip-18.1 fails to install from
> > an sdist or wheel, with error:  
> 
> I'm surprised it fails on the wheels - how exactly are you using pip?

Ah, sorry, i was confused, installing from a wheel works. It's just
installing from a local or remote sdist that fails.

For example with pip-18.1:

    pip -vvv install -i https://test.pypi.org/simple optest

We get:

    Created temporary directory: /tmp/pip-ephem-wheel-cache-n_a2wzyf
    Created temporary directory: /tmp/pip-req-tracker-6oichqha
    Created requirements tracker '/tmp/pip-req-tracker-6oichqha'
    Created temporary directory: /tmp/pip-install-kep8x9wu
    Looking in indexes: https://test.pypi.org/simple
    Collecting optest
      1 location(s) to search for versions of optest:
      * https://test.pypi.org/simple/optest/
      Getting page https://test.pypi.org/simple/optest/
      Looking up "https://test.pypi.org/simple/optest/"; in the cache
      Current age based on date: 8
      Freshness lifetime from max-age: 600
      Freshness lifetime from request max-age: 0
      Starting new HTTPS connection (1): test.pypi.org:443
      https://test.pypi.org:443 "GET /simple/optest/ HTTP/1.1" 304 0
      Analyzing links from page https://test.pypi.org/simple/optest/
        Found link 
https://test-files.pythonhosted.org/packages/20/53/b75897caba2b7249802439ab0fc22562ae63e75de095054400dda7a94dc8/optest-1.0.20210326.2051.tar.gz#sha256=f0a961404d6eba2f59cf75c9bc6e61064e5f191aac4c63f1a7780e77d2156b5d
 (from https://test.pypi.org/simple/optest/), version: 1.0.20210326.2051
      Using version 1.0.20210326.2051 (newest of versions: 1.0.20210326.2051)
      Created temporary directory: /tmp/pip-unpack-v76_dlvl
      Looking up 
"https://test-files.pythonhosted.org/packages/20/53/b75897caba2b7249802439ab0fc22562ae63e75de095054400dda7a94dc8/optest-1.0.20210326.2051.tar.gz";
 in the cache
      Current age based on date: 7
      Freshness lifetime from max-age: 0
      Starting new HTTPS connection (1): test-files.pythonhosted.org:443
      https://test-files.pythonhosted.org:443 "GET 
/packages/20/53/b75897caba2b7249802439ab0fc22562ae63e75de095054400dda7a94dc8/optest-1.0.20210326.2051.tar.gz
 HTTP/1.1" 200 6951
      Downloading 
https://test-files.pythonhosted.org/packages/20/53/b75897caba2b7249802439ab0fc22562ae63e75de095054400dda7a94dc8/optest-1.0.20210326.2051.tar.gz
      Downloading from URL 
https://test-files.pythonhosted.org/packages/20/53/b75897caba2b7249802439ab0fc22562ae63e75de095054400dda7a94dc8/optest-1.0.20210326.2051.tar.gz#sha256=f0a961404d6eba2f59cf75c9bc6e61064e5f191aac4c63f1a7780e77d2156b5d
 (from https://test.pypi.org/simple/optest/)
      Updating cache with response from 
"https://test-files.pythonhosted.org/packages/20/53/b75897caba2b7249802439ab0fc22562ae63e75de095054400dda7a94dc8/optest-1.0.20210326.2051.tar.gz";
      Caching due to etag
      Added optest from 
https://test-files.pythonhosted.org/packages/20/53/b75897caba2b7249802439ab0fc22562ae63e75de095054400dda7a94dc8/optest-1.0.20210326.2051.tar.gz#sha256=f0a961404d6eba2f59cf75c9bc6e61064e5f191aac4c63f1a7780e77d2156b5d
 to build tracker '/tmp/pip-req-tracker-6oichqha'
      Created temporary directory: /tmp/pip-build-env-yx5wdf16
      Installing build dependencies: started
      Running command /home/jules/pylocal/bin/python3 -m pip install 
--ignore-installed --no-user --prefix /tmp/pip-build-env-yx5wdf16 
--no-warn-script-location -v --no-binary :none: --only-binary :none: -i 
https://test.pypi.org/simple --
      Created temporary directory: /tmp/pip-ephem-wheel-cache-3hs3xx6m
      Re-using requirements tracker '/tmp/pip-req-tracker-6oichqha'
      Created temporary directory: /tmp/pip-install-xif4sjdq
      Cleaning up...
      Cleaned build tracker '/tmp/pip-req-tracker-6oichqha'
      ERROR: You must give at least one requirement to install (see "pip help 
install")
      Exception information:
      Traceback (most recent call last):
        File 
"/home/jules/pylocal/lib/python3.7/site-packages/pip/_internal/cli/base_command.py",
 line 143, in main
          status = self.run(options, args)
        File 
"/home/jules/pylocal/lib/python3.7/site-packages/pip/_internal/commands/install.py",
 line 313, in run
          self.name, wheel_cache
        File 
"/home/jules/pylocal/lib/python3.7/site-packages/pip/_internal/cli/base_command.py",
 line 252, in populate_requirement_set
          '(see "pip help %(name)s")' % opts)
      pip._internal.exceptions.CommandError: You must give at least one 
requirement to install (see "pip help install")
      Installing build dependencies: finished with status 'error'
    Cleaning up...
      Removing source in /tmp/pip-install-kep8x9wu/optest
    Removed optest from 
https://test-files.pythonhosted.org/packages/20/53/b75897caba2b7249802439ab0fc22562ae63e75de095054400dda7a94dc8/optest-1.0.20210326.2051.tar.gz#sha256=f0a961404d6eba2f59cf75c9bc6e61064e5f191aac4c63f1a7780e77d2156b5d
 from build tracker '/tmp/pip-req-tracker-6oichqha'
    Removed build tracker '/tmp/pip-req-tracker-6oichqha'
    Command "/home/jules/pylocal/bin/python3 -m pip install --ignore-installed 
--no-user --prefix /tmp/pip-build-env-yx5wdf16 --no-warn-script-location -v 
--no-binary :none: --only-binary :none: -i https://test.pypi.org/simple --" 
failed with error code 1 in None
    Exception information:
    Traceback (most recent call last):
      File 
"/home/jules/pylocal/lib/python3.7/site-packages/pip/_internal/cli/base_command.py",
 line 143, in main
        status = self.run(options, args)
      File 
"/home/jules/pylocal/lib/python3.7/site-packages/pip/_internal/commands/install.py",
 line 338, in run
        resolver.resolve(requirement_set)
      File 
"/home/jules/pylocal/lib/python3.7/site-packages/pip/_internal/resolve.py", 
line 102, in resolve
        self._resolve_one(requirement_set, req)
      File 
"/home/jules/pylocal/lib/python3.7/site-packages/pip/_internal/resolve.py", 
line 256, in _resolve_one
        abstract_dist = self._get_abstract_dist_for(req_to_install)
      File 
"/home/jules/pylocal/lib/python3.7/site-packages/pip/_internal/resolve.py", 
line 209, in _get_abstract_dist_for
        self.require_hashes
      File 
"/home/jules/pylocal/lib/python3.7/site-packages/pip/_internal/operations/prepare.py",
 line 298, in prepare_linked_requirement
        abstract_dist.prep_for_dist(finder, self.build_isolation)
      File 
"/home/jules/pylocal/lib/python3.7/site-packages/pip/_internal/operations/prepare.py",
 line 109, in prep_for_dist
        "Installing build dependencies"
      File 
"/home/jules/pylocal/lib/python3.7/site-packages/pip/_internal/build_env.py", 
line 122, in install_requirements
        call_subprocess(args, show_stdout=False, spinner=spinner)
      File 
"/home/jules/pylocal/lib/python3.7/site-packages/pip/_internal/utils/misc.py", 
line 723, in call_subprocess
        % (command_desc, proc.returncode, cwd))
    pip._internal.exceptions.InstallationError: Command 
"/home/jules/pylocal/bin/python3 -m pip install --ignore-installed --no-user 
--prefix /tmp/pip-build-env-yx5wdf16 --no-warn-script-location -v --no-binary 
:none: --only-binary :none: -i https://test.pypi.org/simple --" failed with 
error code 1 in None



After 'pip install --upgrade pip' upgrades to pip-21.0.1, it installs
fine:

    pip install -i https://test.pypi.org/simple optest

    Looking in indexes: https://test.pypi.org/simple
    Collecting optest
      Using cached optest-1.0.20210326.2051-py3-none-linux_x86_64.whl
    Installing collected packages: optest
    Successfully installed optest-1.0.20210326.2051


I can't tell from pip-18.1's diagnostics what exactly is going wrong.

Given that my setup.py implements the normal distutils-style argv
handling, i was expecting things to work, but pip-18.1 appears to fail
before it even tries to run setup.py, so the only thing i can think of
is that the PKG-INFO file could be causing a problem?


I've also tried building an sdist with the
https://pypi.org/project/build/ project's --sdist option; this sdist
fails to install with pip-18.1 in the same way.


Thanks,

- Julian

-- 
http://op59.net


--
Distutils-SIG mailing list -- distutils-sig@python.org
To unsubscribe send an email to distutils-sig-le...@python.org
https://mail.python.org/mailman3/lists/distutils-sig.python.org/
Message archived at 
https://mail.python.org/archives/list/distutils-sig@python.org/message/LAG3ZLVFSZVYS66MEITTGM5YKR5HTCZW/

Reply via email to