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

fetchPypi can result in 404 CURL errors #43721

Closed
CMCDragonkai opened this issue Jul 18, 2018 · 7 comments
Closed

fetchPypi can result in 404 CURL errors #43721

CMCDragonkai opened this issue Jul 18, 2018 · 7 comments
Labels
2.status: wontfix We cannot or will not fix this issue 6.topic: python

Comments

@CMCDragonkai
Copy link
Member

CMCDragonkai commented Jul 18, 2018

Issue description

Attempting to use fetchPypi on image-match https://pypi.org/project/image-match/ results in:

trying https://pypi.io/packages/source/i/image-match/image-match-1.1.2.tar.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   122  100   122    0     0   1876      0 --:--:-- --:--:-- --:--:--  1876
100   282  100   282    0     0    744      0 --:--:-- --:--:-- --:--:--   744
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
curl: (22) The requested URL returned error: 404

Example expression:

{
  pkgs ? import ./pkgs.nix
}:
  with pkgs;
  let
    python = python36;
  in
    python.pkgs.buildPythonPackage rec {
      pname = "image-match";
      version = "1.1.2";

      src = python.pkgs.fetchPypi {
        inherit pname version;
        sha256 = "0dxbbb63bkqp1jhwxpsw9398n5h213rh00q622bippvrzynm3i9n";
      };

      propagatedBuildInputs = (with python.pkgs; [
        scikitimage
        six
      ]);

      doCheck = false;
    }

I don't think the upstream files.pythonhosted.org is reliable.

Steps to reproduce

nix-build

Technical details

Please run nix-shell -p nix-info --run "nix-info -m" and paste the
results.

 - system: `"x86_64-linux"`
 - host os: `Linux 4.17.6, Form Bay ML, noversion`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.0.4`
 - nixpkgs: `/nix/nixpkgs`
@FRidh
Copy link
Member

FRidh commented Jul 18, 2018

PyPI does not enforce normalized names for the download files so there is not anything we can do here aside from using the filename as pname.
pypi/conveyor#12

@FRidh FRidh closed this as completed Jul 18, 2018
@FRidh FRidh added 2.status: wontfix We cannot or will not fix this issue 6.topic: python labels Jul 18, 2018
@CMCDragonkai
Copy link
Member Author

Is the solution to just use fetchFromGitHub then?

@FRidh
Copy link
Member

FRidh commented Jul 18, 2018

If you want to fetch from PyPI then that is clear no solution. If you're fine with using GitHub, then you can use that indeed. Like I said, if you want to use fetchPypi you have to explicitly pass a different pname.

@CMCDragonkai
Copy link
Member Author

CMCDragonkai commented Jul 19, 2018

I see. Btw, what is the difference between using pname and name for the derivation? It appears to do the same thing for buildPythonApplication at least. I've begun to rely on the existence of a derivation's name when overriding them for other things.

@FRidh
Copy link
Member

FRidh commented Jul 19, 2018

name is deprecated. One should pass pname and version separately.

@CMCDragonkai
Copy link
Member Author

I meant for the drv itself. Did you mean fetchPypi or the entire drv? Or did you mean all drvs should be using pname now? Or only for buildPythonApplication and buildPythonPackage?

@FRidh
Copy link
Member

FRidh commented Jul 19, 2018

buildPython* should use pname and version, not name.

For fetchPypi you can pass different pname if needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.status: wontfix We cannot or will not fix this issue 6.topic: python
Projects
None yet
Development

No branches or pull requests

2 participants