nix-community / pypi2nix

Abandoned! Generate Nix expressions for Python packages
194 stars 47 forks source link

installing zipp fails with strange warning #415

Closed DavHau closed 4 years ago

DavHau commented 4 years ago

pypi2nix version: 2.0.3 Command: pypi2nix -e zipp==2.0.0

While downloading the requirements there is a strange warning: WARNING: Requested zipp==2.0.0 ... , but installing version 0.0.0 Afterwards it fails while trying to fetch metadata for zipp==0.0.0.

Full log:

$ pypi2nix -e zipp==2.0.0
INFO: pypi2nix v2.0.3 running ...
INFO: Downloading wheels and creating wheelhouse ...
INFO: Downloading runtime requirements
  WARNING: Requested zipp==2.0.0 from https://files.pythonhosted.org/packages/ee/f7/6c3ca4764a8025da9422825c2bc367fdc8dd115ebb52e4ef057f234938c4/zipp-2.0.0.tar.gz#sha256=7ae5ccaca427bafa9760ac3cd8f8c244bfc259794b5b6bb9db4dda2241575d09 (from -r /tmp/tmpbx971c3y/4fd943e4c1e39638b931af0acde8180c.txt (line 1)), but installing version 0.0.0
WARNING: You are using pip version 20.0.dev0; however, version 20.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
WARNING: You are using pip version 20.0.dev0; however, version 20.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
WARNING: You are using pip version 20.0.dev0; however, version 20.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
INFO: Build wheels of setup and runtime requirements
  WARNING: Requested zipp==2.0.0 from file:///tmp/tmpbx971c3y/download/zipp-2.0.0.tar.gz (from -r /tmp/tmpbx971c3y/9ede9a287e3cae59ad306623aa28fd86.txt (line 4)), but installing version 0.0.0
INFO: Extracting metadata from pypi.python.org ...
INFO: -- sources ---------------------------------------------------------------
INFO: --------------------------------------------------------------------------
ERROR: Failed to query pypi for release name=`zipp`, version=`0.0.0`
Traceback (most recent call last):
  File "/nix/store/31vfc4rky6dvrj3q27nmqjkxd6k931qx-python3.7-pypi2nix-dev/bin/.pypi2nix-wrapped", line 11, in <module>
    sys.exit(main())
  File "/nix/store/bbrjncksx1ik0q7r7x33q77wfnahnxxf-python3.7-click-7.0/lib/python3.7/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/nix/store/bbrjncksx1ik0q7r7x33q77wfnahnxxf-python3.7-click-7.0/lib/python3.7/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/nix/store/bbrjncksx1ik0q7r7x33q77wfnahnxxf-python3.7-click-7.0/lib/python3.7/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/nix/store/bbrjncksx1ik0q7r7x33q77wfnahnxxf-python3.7-click-7.0/lib/python3.7/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/nix/store/31vfc4rky6dvrj3q27nmqjkxd6k931qx-python3.7-pypi2nix-dev/lib/python3.7/site-packages/pypi2nix/cli.py", line 219, in main
    Pypi2nix(configuration).run()
  File "/nix/store/31vfc4rky6dvrj3q27nmqjkxd6k931qx-python3.7-pypi2nix-dev/lib/python3.7/site-packages/pypi2nix/main.py", line 82, in run
    source_distributions=source_distributions,
  File "/nix/store/31vfc4rky6dvrj3q27nmqjkxd6k931qx-python3.7-pypi2nix-dev/lib/python3.7/site-packages/pypi2nix/stage2.py", line 95, in main
    self.process_wheel(wheel_metadata)
  File "/nix/store/31vfc4rky6dvrj3q27nmqjkxd6k931qx-python3.7-pypi2nix-dev/lib/python3.7/site-packages/pypi2nix/stage2.py", line 112, in process_wheel
    raise MetadataFetchingFailed()
pypi2nix.stage2.MetadataFetchingFailed
seppeljordan commented 4 years ago
$ pip download --no-binary :all: zipp==2.0.0
Collecting zipp==2.0.0
  Downloading zipp-2.0.0.tar.gz (12 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
    Preparing wheel metadata ... done
  WARNING: Requested zipp==2.0.0 from https://files.pythonhosted.org/packages/ee/f7/6c3ca4764a8025da9422825c2bc367fdc8dd115ebb52e4ef057f234938c4/zipp-2.0.0.tar.gz#sha256=7ae5ccaca427bafa9760ac3cd8f8c244bfc259794b5b6bb9db4dda2241575d09, but installing version 0.0.0
  Saved ./zipp-2.0.0.tar.gz
Collecting more-itertools
  Downloading more-itertools-8.1.0.tar.gz (78 kB)
     |████████████████████████████████| 78 kB 1.3 MB/s 
  Saved ./more-itertools-8.1.0.tar.gz
Successfully downloaded zipp more-itertools

This is not a pypi2nix issue but an issue with zipp and/or pip, but most likely only zipp. It looks like they forgot to set the version option in their setup.cfg file.

seppeljordan commented 4 years ago

@DavHau I submitted a PR to zipp that should fix the issue with their next release.

See here: https://github.com/jaraco/zipp/pull/30

DavHau commented 4 years ago

Thank you very much for that! Very much appreciated!

But shouldn't we assume that this could be the case with many other libraries. And why does the installation work with pip but not with pypi2nix? Wouldn't it be best for pypi2nix to behave like pip as much as possible? Otherwise we will run again into this problem in the future. EDIT: I assume pypi2nix takes the version specified within the package to lookup it's metadata. Maybe this information should not be trusted and there is a better way? Maybe we just take the version number we were requesting in the first place?

seppeljordan commented 4 years ago

I'd argue that it is better that pypi2nix crashed since it let to a PR that fixed a bug in a widely used package.

I get it. Using unreliable software is frustrating and I see the point in your comment but unfortunately we have to detect the version of packages. Currently I would not know how to find out the version of a distribution other than querying its PKG-INFO. Of course there is one other version and that is to parse the stdout of pip but frankly I think that this would cause more instability since these kinds of things tend to change.

Also consider that you usually cannot tell which version number "we were requesting in the first place", since most people have requirements like these: zipp>=1.0 or zipp==2.0.*.