nix-community / pip2nix

Freeze pip-installable packages into Nix expressions [maintainer=@datakurre]
171 stars 26 forks source link

No such file or directory: 'nix-prefetch-git' #67

Closed nyarly closed 3 years ago

nyarly commented 3 years ago

Running a nix-shell from a clone of the repo, generate failed with:

ERROR: Exception:
Traceback (most recent call last):
  File "/nix/store/y3hkqsfvf4kidvvqabr1vsl59r747hmb-python3.9-pip-20.1.1/lib/python3.9/site-packages/pip/_internal/cli/
base_command.py", line 188, in _main
    status = self.run(options, args)
  File "/home/judson/dev/pip2nix/pip2nix/generate.py", line 344, in run
    return requirement_set
  File "/nix/store/q3d21ys27dn3byyb9vsb55bcx5s68l8w-python3.9-contexter-0.1.4/lib/python3.9/site-packages/contexter.py"
, line 96, in __exit__
    reraise(exc)
  File "/nix/store/q3d21ys27dn3byyb9vsb55bcx5s68l8w-python3.9-contexter-0.1.4/lib/python3.9/site-packages/contexter.py"
, line 26, in reraise
    raise exc[1].with_traceback(exc[2])
  File "/home/judson/dev/pip2nix/pip2nix/generate.py", line 343, in run
    requirement_set = self.super_run(options, args)
  File "/home/judson/dev/pip2nix/pip2nix/generate.py", line 322, in super_run
    self.process_requirements(
  File "/home/judson/dev/pip2nix/pip2nix/generate.py", line 166, in process_requirements
    f.write('  ' + indent(2, '\n'.join(
  File "/home/judson/dev/pip2nix/pip2nix/generate.py", line 168, in <genexpr>
    pkg.to_nix(include_lic=include_lic,
  File "/home/judson/dev/pip2nix/pip2nix/models/package.py", line 195, in to_nix
    src=link_to_nix(self.source, cache=cache),
  File "/home/judson/dev/pip2nix/pip2nix/models/package.py", line 364, in link_to_nix
    hash, revision = prefetch_git(url, branch)
  File "/home/judson/dev/pip2nix/pip2nix/models/package.py", line 408, in prefetch_git
    out = check_output(['nix-prefetch-git'] + rev_args + [url])
  File "/nix/store/h4hixxmfbsccyvwnnlgjc2sfcns0hfms-python3-3.9.0/lib/python3.9/subprocess.py", line 420, in check_outp
ut
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "/nix/store/h4hixxmfbsccyvwnnlgjc2sfcns0hfms-python3-3.9.0/lib/python3.9/subprocess.py", line 501, in run
    with Popen(*popenargs, **kwargs) as process:
  File "/nix/store/h4hixxmfbsccyvwnnlgjc2sfcns0hfms-python3-3.9.0/lib/python3.9/subprocess.py", line 947, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/nix/store/h4hixxmfbsccyvwnnlgjc2sfcns0hfms-python3-3.9.0/lib/python3.9/subprocess.py", line 1819, in _execute_
child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'nix-prefetch-git'
datakurre commented 3 years ago

I guess, nix-prefetch-git and nix-prefetch-hg have always been "optional" dependencies. But I can add a shell.nix that add those into nix-shell-environment.

It seems that the code expects branch name in git requirements in format similar to

git+https://github.com/tiangolo/fastapi.git@master