Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
marcinkuzminski opened this issue Mar 8, 2013 · 7 comments
Open
Labels
C: download About fetching data from PyPI and other sources C: error messages Improving error messages type: bug A confirmed bug or unintended behavior

Comments

@marcinkuzminski
Copy link

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

@quodlibetor
Copy link

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.

@sblask
Copy link

sblask commented Jun 7, 2013

-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.

@dstufft
Copy link
Member

dstufft commented Mar 22, 2017

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.

@pradyunsg pradyunsg added this to the Print Better Error Messages milestone Feb 22, 2019
@deveshks
Copy link
Contributor

deveshks commented Apr 4, 2020

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?

@deveshks
Copy link
Contributor

deveshks commented Apr 9, 2020

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

@pradyunsg
Copy link
Member

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).

@deveshks
Copy link
Contributor

deveshks commented May 26, 2020

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 #831 (comment) 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

@nlhkabu nlhkabu added the C: error messages Improving error messages label Jul 28, 2020
@nlhkabu nlhkabu removed this from the Print Better Error Messages milestone Jul 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: download About fetching data from PyPI and other sources C: error messages Improving error messages type: bug A confirmed bug or unintended behavior
Projects
None yet
Development

No branches or pull requests

7 participants