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

NotADirectoryError when running --generate-hashes #512

Closed
DeastinY opened this issue May 23, 2017 · 3 comments
Closed

NotADirectoryError when running --generate-hashes #512

DeastinY opened this issue May 23, 2017 · 3 comments

Comments

@DeastinY
Copy link

Running pip-compile works flawless, but pip-compile --generate-hashes produces the following error:

Traceback (most recent call last):
File "/home/ric/.local/bin/pip-compile", line 11, in
sys.exit(cli())
File "/home/ric/.local/lib/python3.5/site-packages/click/core.py", line 722, in call
return self.main(*args, **kwargs)
File "/home/ric/.local/lib/python3.5/site-packages/click/core.py", line 697, in main
rv = self.invoke(ctx)
File "/home/ric/.local/lib/python3.5/site-packages/click/core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/home/ric/.local/lib/python3.5/site-packages/click/core.py", line 535, in invoke
return callback(*args, **kwargs)
File "/home/ric/.local/lib/python3.5/site-packages/piptools/scripts/compile.py", line 186, in cli
hashes = resolver.resolve_hashes(results)
File "/home/ric/.local/lib/python3.5/site-packages/piptools/resolver.py", line 77, in resolve_hashes
return {ireq: self.repository.get_hashes(ireq) for ireq in ireqs}
File "/home/ric/.local/lib/python3.5/site-packages/piptools/resolver.py", line 77, in
return {ireq: self.repository.get_hashes(ireq) for ireq in ireqs}
File "/home/ric/.local/lib/python3.5/site-packages/piptools/repositories/pypi.py", line 169, in get_hashes
for candidate in matching_candidates
File "/home/ric/.local/lib/python3.5/site-packages/piptools/repositories/pypi.py", line 169, in
for candidate in matching_candidates
File "/home/ric/.local/lib/python3.5/site-packages/piptools/repositories/pypi.py", line 176, in _get_file_hash
download_dir=tmpdir, only_download=True, session=self.session
File "/usr/lib/python3/dist-packages/pip/download.py", line 821, in unpack_url
hashes=hashes
File "/usr/lib/python3/dist-packages/pip/download.py", line 663, in unpack_http_url
unpack_file(from_path, location, content_type, link)
File "/usr/lib/python3/dist-packages/pip/utils/init.py", line 623, in unpack_file
untar_file(filename, location)
File "/usr/lib/python3/dist-packages/pip/utils/init.py", line 595, in untar_file
with open(path, 'wb') as destfp:
NotADirectoryError: [Errno 20] Not a directory: '/tmp/tmprk7taktxbuild/LICENSE/LICENSE_STIX'

Environment Versions
  1. Ubuntu 16.04
  2. Python 3.5.3
  3. pip 9.0.1
  4. pip-compile 1.9.0

This is my requirements.in file:

seaborn==0.7.1
pandas==0.20.1
numpy==1.12.1
scipy==0.19.0
tqdm==4.11.2
matplotlib==2.0.2

@proinsias
Copy link

I encountered the same error – I believe it's matplotlib – see https://github.com/jheinen/matplotlib/blob/master/LICENSE/LICENSE_STIX .

@di
Copy link
Contributor

di commented Aug 30, 2017

Seems to be a duplicate of #438.

suutari added a commit to suutari/prequ that referenced this issue Sep 2, 2017
The PyPIRepository._get_file_hash used to call unpack_url, when
generating the hash.  It only needed the side effect of the downloaded
package being left in the download directory and the unpacking part was
actually unnecessary.  Change it to just open the (local or remote)
package as a file object and hash the contents without unpacking.

This makes it faster and lighter, since unpacking consumes CPU cycles
and disk space, and more importantly, avoids problems which happen when
some distribution has a file with the same name as a directory in
another.  Unpacking both to packages to the same directory will then
fail.  E.g. matplotlib-2.0.2.tar.gz has a directory named LICENSE, but
many other packages have a file named LICENSE.

Fixes jazzband#512, jazzband#544
vphilippon added a commit that referenced this issue Sep 27, 2017
Hash packages without unpacking (Fixes #512 and #544)
@cooperlees
Copy link

I hit this error too. I thank @DeastinY to having the exception in the issue to make this much more Google-a-ble ... Save me manual debugging of the code :) <3

Can confirm 1.11.0 fixed my problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants