Skip to content
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

pip cannot install tarballs with leading ./ in file paths #739

Closed
ejucovy opened this issue Dec 3, 2012 · 5 comments
Closed

pip cannot install tarballs with leading ./ in file paths #739

ejucovy opened this issue Dec 3, 2012 · 5 comments
Labels
auto-locked Outdated issues that have been locked by automation state: awaiting PR Feature discussed, PR is needed type: bug A confirmed bug or unintended behavior type: enhancement Improvements to functionality

Comments

@ejucovy
Copy link

ejucovy commented Dec 3, 2012

To reproduce:

$ virtualenv.py /tmp/ve && source /tmp/ve/bin/activate
$ mkdir -p /tmp/testpkg/testpkg
$ touch /tmp/testpkg/testpkg/__init__.py
$ echo "from distutils.core import setup

setup(name='testpkg',
      version='1.0',
      description='test package',
      author='tester',
      author_email='tester@example.com',
      url='',
      packages=['testpkg'],
     )" > /tmp/testpkg/setup.py

Generating and installing this tarball succeeds:

$ cd /tmp/
$ tar czf testpkg.tar.gz testpkg/
$ pip install testpkg.tar.gz
Unpacking ./testpkg.tar.gz
  Running setup.py egg_info for package from file:///private/tmp/testpkg.tar.gz

Cleaning up...

But this tarball fails with a mysterious error about being unable to find setup.py:

$ cd /tmp/
$ tar czf testpkg.tar.gz ./testpkg/
$ pip install testpkg.tar.gz
Unpacking ./testpkg.tar.gz
  Running setup.py egg_info for package from file:///private/tmp/testpkg.tar.gz
    Traceback (most recent call last):
      File "<string>", line 14, in <module>
    IOError: [Errno 2] No such file or directory: '/var/folders/c7/flx2tqd15vg6wy99xjz7cntr0000gn/T/pip-b4Hu_U-build/setup.py'
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):

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

IOError: [Errno 2] No such file or directory: '/var/folders/c7/flx2tqd15vg6wy99xjz7cntr0000gn/T/pip-b4Hu_U-build/setup.py'

----------------------------------------
Command python setup.py egg_info failed with error code 1 in /var/folders/c7/flx2tqd15vg6wy99xjz7cntr0000gn/T/pip-b4Hu_U-build
Storing complete log in /Users/ethanjucovy/.pip/pip.log

Note that easy_install has no difficulty with the same tarball:

$ tar czf testpkg.tar.gz ./testpkg/
$ easy_install testpkg.tar.gz 
Processing testpkg.tar.gz
Running testpkg/setup.py -q bdist_egg --dist-dir /var/folders/c7/flx2tqd15vg6wy99xjz7cntr0000gn/T/easy_install-symNgj/testpkg/egg-dist-tmp-5Kp0Jo
zip_safe flag not set; analyzing archive contents...
testpkg 1.0 is already the active version in easy-install.pth

Installed /private/tmp/foos/lib/python2.7/site-packages/testpkg-1.0-py2.7.egg
Processing dependencies for testpkg==1.0
Finished processing dependencies for testpkg==1.0

The only difference between the two tarballs is the ./ prefixes in the file paths:

$ tar czf testpkg.tar.gz testpkg/ && tar tvf testpkg.tar.gz
drwxr-xr-x  0 ethanjucovy wheel       0 Dec  2 19:04 testpkg/
-rw-r--r--  0 ethanjucovy wheel     225 Dec  2 18:57 testpkg/setup.py
drwxr-xr-x  0 ethanjucovy wheel       0 Dec  2 18:57 testpkg/testpkg/
-rw-r--r--  0 ethanjucovy wheel       0 Dec  2 18:57 testpkg/testpkg/__init__.py

$ tar czf testpkg.tar.gz ./testpkg/ && tar tvf testpkg.tar.gz
drwxr-xr-x  0 ethanjucovy wheel       0 Dec  2 19:04 ./testpkg/
-rw-r--r--  0 ethanjucovy wheel     225 Dec  2 18:57 ./testpkg/setup.py
drwxr-xr-x  0 ethanjucovy wheel       0 Dec  2 18:57 ./testpkg/testpkg/
-rw-r--r--  0 ethanjucovy wheel       0 Dec  2 18:57 ./testpkg/testpkg/__init__.py
@pradyunsg pradyunsg added the type: enhancement Improvements to functionality label Jul 7, 2017
@pradyunsg
Copy link
Member

@pfmoore @dstufft

Do either of you think this is something that should be fixed before PEP 517? I mean, it's no blocker for that but this should just work as well; backends might expect it...

Even in the (current) world without PEP-517, this is still not good behaviour; right?

@pradyunsg pradyunsg added the type: bug A confirmed bug or unintended behavior label Jul 7, 2017
@cjerdonek
Copy link
Member

@waveform80 Since you had an interest in tar archives and zip files, do you have any interest in taking a look at this issue? It might be fun.

@chrahunt chrahunt added the state: awaiting PR Feature discussed, PR is needed label Jul 22, 2019
@sourabhdeshmukh
Copy link

sourabhdeshmukh commented Oct 15, 2019

@ejucovy @pradyunsg
I tried reproducing this issue with following steps on fedora 30.

$ virtualenv /home/user/ve
$ source /home/user/ve/bin/activate
$ mkdir -p /home/user/testpkg/testpkg
$ touch /home/user/testpkg/testpkg/__init__.py
$ echo "from distutils.core import setup

setup(name='testpkg',
      version='1.0',
      description='test package',
      author='tester',
      author_email='tester@example.com',
      url='',
      packages=['testpkg'],
     )" > /home/user/testpkg/setup.py
$ tar czf testpkg.tar.gz testpkg/
$ pip install testpkg.tar.gz

After executing last command I got result as

Successfully built testpkg
Installing collected packages: testpkg
Successfully installed testpkg-1.0

This issue is working fine for me. This issue can be closed.

@pradyunsg
Copy link
Member

Thanks a lot for taking a look @sourabhdeshmukh! :)

@sourabhdeshmukh
Copy link

@pradyunsg Welcome :)

@lock lock bot added the auto-locked Outdated issues that have been locked by automation label Mar 27, 2020
@lock lock bot locked as resolved and limited conversation to collaborators Mar 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
auto-locked Outdated issues that have been locked by automation state: awaiting PR Feature discussed, PR is needed type: bug A confirmed bug or unintended behavior type: enhancement Improvements to functionality
Projects
None yet
Development

No branches or pull requests

5 participants