Pypi2nix installed but won't run

I’ve installed nix on Mac OS Catalina after encountering several problems. I was not able to find the installation
nix --version gave me
nix: command not found'
until I read a suggestion to run
. /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh
now i have
nix (Nix) 2.6.0

I attempted to install pypi2nix
nix-env -iA nixpkgs.pypi2nix but got the error
Package ‘pypi2nix-2.0.4’ in /nix/store/0p5yvrdi3ss7s6p0ndgwi7dy8bjg4d3f-nixpkgs/nixpkgs/pkgs/development/tools/pypi2nix/default.nix:7 is marked as broken

So I temporarily allowed broken packages
export NIXPKGS_ALLOW_BROKEN=1
The installation of pipi2nix appeared to complete but, if I try run run pypi2nix I get

ImportError: cannot import name 'nix_prefetch_github' from 'nix_prefetch_github' (/nix/store/7f4r80iciwfs2z5dwiwrhmgn4cw1n24p-python3.9-nix-prefetch-github-5.0.1/lib/python3.9/site-packages/nix_prefetch_github/__init__.py)

All I need to do is run pypi2nix on an updated requirements.txt and generate an updated dependencies.nix

Any suggestions would be appreciated

When it’s marked as broken that generally means what it says, the package is broken. You can see it marked broken here and also there’s a link to why. The repo also notes that pypi2nix is abandoned. If you’re able to use Poetry for your Python project there’s poetry2nix. There are a variety of ways to use Python in the manual as well.

That said if you desperately need pypi2nix you can try installing an old version maybe.

OK. Thanks for clearing that up. And thanks for the suggestions.

Also see the nixos wiki page for python describing several ways of managing python environments, one of which is mach-nix (maintained by myself) which is targeted towards requirements.txt based environments and should be suitable as a pypi2nix replacement.

Hi
Thanks for your help. I will surely look in to that.

mach-nix is dead, long live dream2nix