Closed adfaure closed 3 years ago
The python-packages.nix
is correctly generated by the pip2nix build with #60, and I run into the same problem here.
And here is the shell.nix
I have tried.
Please help me to correctly use pip2nix in nix shell.
Thank you.
let pkgs = import <nixpkgs> { };
in
let
python-packages = import ./python-packages.nix {
pkgs = pkgs.python3.pkgs;
fetchurl = pkgs.fetchurl;
fetchgit = pkgs.fetchgit;
fetchhg = pkgs.fetchhg;
};
python-with-packages = python-packages pkgs.python3;
in
pkgs.mkShell {
nativeBuildInputs = [
python-with-packages
];
}
@yanganto I will try that out today and see what's missing.
@yanganto These worked for me:
$ pip2nix generate fastapi
let pkgs = import <nixpkgs> { };
in
let
packageOverrides = pkgs.callPackage ./python-packages.nix {};
python = pkgs.python3.override { inherit packageOverrides; };
pythonWithPackages = python.withPackages(ps: [ ps.fastapi ]);
in
pkgs.mkShell {
buildInputs = [
pythonWithPackages
];
}
Without custom packages
$ nix-shell -p "python3.withPackages(ps: [ ps.fastapi ])" --run "python -c 'import fastapi; print(fastapi.__version__)'"
0.55.1
With custom packages:
$ nix-shell --run "python -c 'import fastapi; print(fastapi.__version__)'"
0.63.0
@datakurre Thank you. May I add this into readme or make an example file in this project and close this issue? 😄
Please do 😍
Hello, following your README, I have been able to generate the python-packages.nix, however, it is not clear to me how I can use it.
Do you have an example somewhere?
My objective is to install the packaged application into a shell (for instance).
Thank you !