I often need to set up quick virtual environments. Unfortunately, the standard approach to work with this in nix deals with the local nixpkgs mechanism for python dependencies:

1nix-shell -p "python38.withPackages(ps: [ ps.numpy ps.sh ])"

However there is a catch for packages which are not officially present upstream.

1# Fails!
2nix-shell -p "python38.withPackages(ps: [ ps.numpy ps.sh ps.lieer ])"

However, the mach-nix project can indeed be used to work around this, at the cost of a somewhat longer command.

1# Works
2nix-shell -p '(callPackage (fetchTarball https://github.com/DavHau/mach-nix/tarball/3.0.2) {python="python38";}).mkPython{requirements="numpy\n lieer\n ipython";}' --command ipython

mkPythonShell does not generate an environment which can be used here, since that is not a derivation which can be built. This is most useful in the context of systems which use asdf or other PATH shim approaches.