pip install --download throws error when used with setup.py file

Created on 8 Mar 2013  路  7Comments  路  Source: pypa/pip

So here's the case, If i do

pip install /path/to/mypackage

it works like expected extract proper requirements and install everything that is defined in mypackage setup.py file.

When i do

 mkdir /tmp/downloadcache
 pip install --download /tmp/downloadcache /path/to/mypackage

It throws an exception:

------------------------------------------------------------
/home/ubuntu/.virtualenvs/xxx/bin/pip run on Fri Mar  8 12:56:30 2013
Unpacking /appz/mypackage

  Running setup.py egg_info for package from file:///appz/mypackage

    Traceback (most recent call last):

      File "<string>", line 16, in <module>

    IOError: [Errno 2] No such file or directory: '/tmp/pip-AZvxJb-build/setup.py'

    Complete output from command python setup.py egg_info:

    Traceback (most recent call last):

  File "<string>", line 16, in <module>

IOError: [Errno 2] No such file or directory: '/tmp/pip-AZvxJb-build/setup.py'

----------------------------------------

Command python setup.py egg_info failed with error code 1 in /tmp/pip-AZvxJb-build

Exception information:
Traceback (most recent call last):
  File "/home/ubuntu/.virtualenvs/xxx/local/lib/python2.7/site-packages/pip/basecommand.py", line 139, in main
    status = self.run(options, args)
  File "/home/ubuntu/.virtualenvs/xxx/local/lib/python2.7/site-packages/pip/commands/install.py", line 266, in run
    requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
  File "/home/ubuntu/.virtualenvs/xxx/local/lib/python2.7/site-packages/pip/req.py", line 1052, in prepare_files
    req_to_install.run_egg_info()
  File "/home/ubuntu/.virtualenvs/xxx/local/lib/python2.7/site-packages/pip/req.py", line 236, in run_egg_info
    command_desc='python setup.py egg_info')
  File "/home/ubuntu/.virtualenvs/xxx/local/lib/python2.7/site-packages/pip/util.py", line 662, in call_subprocess
    % (command_desc, proc.returncode, cwd))
InstallationError: Command python setup.py egg_info failed with error code 1 in /tmp/pip-AZvxJb-build

download UX- error messages bug

All 7 comments

It seems, based on a comment in req.py that pip expects a download-only package on the local fs to be editable, and indeed this seems to work, at least somewhat:

$ ls /tmp/sdists
$ cat setup.py
from setuptools import setup

setup (name='testproj',
      install_requires='mock')
$ pip install --download /tmp/sdists -e .
Obtaining file:///tmp/testproj
  Running setup.py egg_info for package from file:///tmp/testproj

Saved /tmp/sdists/testproj-0.0.0.zip
Downloading/unpacking mock (from testproj==0.0.0)
Downloading mock-1.0.1.tar.gz (819kB): 819kB downloaded
Saved /tmp/sdists/mock-1.0.1.tar.gz
Running setup.py egg_info for package mock

warning: no files found matching '*.png' under directory 'docs'
warning: no files found matching '*.css' under directory 'docs'
warning: no files found matching '*.html' under directory 'docs'
warning: no files found matching '*.js' under directory 'docs'
Successfully downloaded testproj mock
Cleaning up...
$ ls ../sdists
mock-1.0.1.tar.gz  testproj-0.0.0.zip

I ran into this when trying to script automated virtualenv creation using the fast local installs recipe.

I'm not really sure what I'm going to do about it--I'd rather not have to guess pip arguments based on whether something looks like a path or a package.

-e works only on the first level. If I have a local package, that has another local package as dependency, I get the same error, just a little later in the process.

Just as a note, the issue here appears to be that while pip download path/to/project successfully downloads all of the dependencies and claims to have downloaded the top level project, it has not in fact done so.

I'm not entirely sure what behavior would be expected though, because there is no artifact to download from an unpacked directory. Possibly this should just be an error or a warning that it can't download a directory.

Hi @pradyunsg , @dstufft

Since pip install --download is now deprecated in favor of pip download, is this error still valid?

If yes, what would be the updated instructions to reproduce this and try to add the appropriate error/warning?

Pinging @pradyunsg and @dstufft for getting their thoughts on how to tackle this 馃槉

On a project with dependencies, try pip download path/to/project. This should fail. If it doesn't, we should deprecate whatever behavior is there currently, and start a deprecation cycle for removing it as per our regular deprecation process (2 release deprecation period).

On a project with dependencies, try pip download path/to/project. This should fail.

To that affect, I created a project with just a setup.py defined at https://github.com/pypa/pip/issues/831#issuecomment-15549967 and that ran pip download /path/to/project, and the command was successful, but it should have failed?

$ cat test/setup.py 
from setuptools import setup

setup (name='testproj',
      install_requires='mock')

$ ls download/

$ pip download test/ --no-cache-dir -d download/
Processing ./test
  Link is a directory, ignoring download_dir
Collecting mock
  Downloading mock-4.0.2-py3-none-any.whl (28 kB)
  Saved ./download/mock-4.0.2-py3-none-any.whl
Successfully downloaded testproj mock

$ ls download/
mock-4.0.2-py3-none-any.whl
Was this page helpful?
0 / 5 - 0 ratings