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

Python2 not found while building native package #315

Open
maca opened this issue May 31, 2023 · 0 comments
Open

Python2 not found while building native package #315

maca opened this issue May 31, 2023 · 0 comments

Comments

@maca
Copy link

maca commented May 31, 2023

Hi!

I am trying to set a dev environment for a legacy project (rails which in turn uses yarn).

I have this nix files:

# shell.nix
with (import <nixpkgs> { });
let
  gems = bundlerEnv {
    name = "BeMate";
    inherit ruby;
    gemdir = ./.;
  };

  nodeDeps = (pkgs.callPackage ./default.nix { }).nodeDependencies;
in
stdenv.mkDerivation {
  name = "bemate";
  buildInputs = [ gems ruby zsh nodejs python2 ];
  buildPhase = ''
    ln -s ${nodeDeps}/lib/node_modules ./node_modules
    export PATH="${nodeDeps}/bin:$PATH"
  '';
}

# default.nix
# This file has been generated by node2nix 1.11.1. Do not edit!

{ pkgs ? import <nixpkgs> {
    inherit system;
  }
, system ? builtins.currentSystem
, nodejs ? pkgs."nodejs_14"
}:

let
  nodeEnv = import ./node-env.nix {
    inherit (pkgs) stdenv lib python2 runCommand writeTextFile writeShellScript;
    inherit pkgs nodejs;
    libtool = if pkgs.stdenv.isDarwin then pkgs.darwin.cctools else null;
  };
in
import ./node-packages.nix {
  inherit (pkgs) fetchurl nix-gitignore stdenv lib fetchgit;
  inherit nodeEnv;
}

when I do nix-shell to jump into my dev environment I get this build error.

npm ERR! gyp verb clean removing "build" directory
npm ERR! gyp verb command configure []
npm ERR! gyp verb check python checking for Python executable "python2" in the PATH
npm ERR! gyp verb `which` failed Error: not found: python2
npm ERR! gyp verb `which` failed     at getNotFoundError (/nix/store/kd72xr0pvi7wfssb38134my3knzzwvy1-node-dependencies-bemates-0.1.0/bemates/node_modules/which/which.js:13:12)
npm ERR! gyp verb `which` failed     at F (/nix/store/kd72xr0pvi7wfssb38134my3knzzwvy1-node-dependencies-bemates-0.1.0/bemates/node_modules/which/which.js:68:19)
npm ERR! gyp verb `which` failed     at E (/nix/store/kd72xr0pvi7wfssb38134my3knzzwvy1-node-dependencies-bemates-0.1.0/bemates/node_modules/which/which.js:80:29)
npm ERR! gyp verb `which` failed     at /nix/store/kd72xr0pvi7wfssb38134my3knzzwvy1-node-dependencies-bemates-0.1.0/bemates/node_modules/which/which.js:89:16
npm ERR! gyp verb `which` failed     at /nix/store/kd72xr0pvi7wfssb38134my3knzzwvy1-node-dependencies-bemates-0.1.0/bemates/node_modules/isexe/index.js:42:5
npm ERR! gyp verb `which` failed     at /nix/store/kd72xr0pvi7wfssb38134my3knzzwvy1-node-dependencies-bemates-0.1.0/bemates/node_modules/isexe/mode.js:8:5
npm ERR! gyp verb `which` failed     at FSReqCallback.oncomplete (node:fs:207:21)
npm ERR! gyp verb `which` failed  python2 Error: not found: python2
npm ERR! gyp verb `which` failed     at getNotFoundError (/nix/store/kd72xr0pvi7wfssb38134my3knzzwvy1-node-dependencies-bemates-0.1.0/bemates/node_modules/which/which.js:13:12)
npm ERR! gyp verb `which` failed     at F (/nix/store/kd72xr0pvi7wfssb38134my3knzzwvy1-node-dependencies-bemates-0.1.0/bemates/node_modules/which/which.js:68:19)
npm ERR! gyp verb `which` failed     at E (/nix/store/kd72xr0pvi7wfssb38134my3knzzwvy1-node-dependencies-bemates-0.1.0/bemates/node_modules/which/which.js:80:29)
npm ERR! gyp verb `which` failed     at /nix/store/kd72xr0pvi7wfssb38134my3knzzwvy1-node-dependencies-bemates-0.1.0/bemates/node_modules/which/which.js:89:16
npm ERR! gyp verb `which` failed     at /nix/store/kd72xr0pvi7wfssb38134my3knzzwvy1-node-dependencies-bemates-0.1.0/bemates/node_modules/isexe/index.js:42:5
npm ERR! gyp verb `which` failed     at /nix/store/kd72xr0pvi7wfssb38134my3knzzwvy1-node-dependencies-bemates-0.1.0/bemates/node_modules/isexe/mode.js:8:5
npm ERR! gyp verb `which` failed     at FSReqCallback.oncomplete (node:fs:207:21) {
npm ERR! gyp verb `which` failed   code: 'ENOENT'
npm ERR! gyp verb `which` failed }
npm ERR! gyp verb check python checking for Python executable "python" in the PATH
npm ERR! gyp verb `which` failed Error: not found: python
npm ERR! gyp verb `which` failed     at getNotFoundError (/nix/store/kd72xr0pvi7wfssb38134my3knzzwvy1-node-dependencies-bemates-0.1.0/bemates/node_modules/which/which.js:13:12)
npm ERR! gyp verb `which` failed     at F (/nix/store/kd72xr0pvi7wfssb38134my3knzzwvy1-node-dependencies-bemates-0.1.0/bemates/node_modules/which/which.js:68:19)
npm ERR! gyp verb `which` failed     at E (/nix/store/kd72xr0pvi7wfssb38134my3knzzwvy1-node-dependencies-bemates-0.1.0/bemates/node_modules/which/which.js:80:29)
npm ERR! gyp verb `which` failed     at /nix/store/kd72xr0pvi7wfssb38134my3knzzwvy1-node-dependencies-bemates-0.1.0/bemates/node_modules/which/which.js:89:16
npm ERR! gyp verb `which` failed     at /nix/store/kd72xr0pvi7wfssb38134my3knzzwvy1-node-dependencies-bemates-0.1.0/bemates/node_modules/isexe/index.js:42:5
npm ERR! gyp verb `which` failed     at /nix/store/kd72xr0pvi7wfssb38134my3knzzwvy1-node-dependencies-bemates-0.1.0/bemates/node_modules/isexe/mode.js:8:5
npm ERR! gyp verb `which` failed     at FSReqCallback.oncomplete (node:fs:207:21)
npm ERR! gyp verb `which` failed  python Error: not found: python
npm ERR! gyp verb `which` failed     at getNotFoundError (/nix/store/kd72xr0pvi7wfssb38134my3knzzwvy1-node-dependencies-bemates-0.1.0/bemates/node_modules/which/which.js:13:12)
npm ERR! gyp verb `which` failed     at F (/nix/store/kd72xr0pvi7wfssb38134my3knzzwvy1-node-dependencies-bemates-0.1.0/bemates/node_modules/which/which.js:68:19)
npm ERR! gyp verb `which` failed     at E (/nix/store/kd72xr0pvi7wfssb38134my3knzzwvy1-node-dependencies-bemates-0.1.0/bemates/node_modules/which/which.js:80:29)
npm ERR! gyp verb `which` failed     at /nix/store/kd72xr0pvi7wfssb38134my3knzzwvy1-node-dependencies-bemates-0.1.0/bemates/node_modules/which/which.js:89:16
npm ERR! gyp verb `which` failed     at /nix/store/kd72xr0pvi7wfssb38134my3knzzwvy1-node-dependencies-bemates-0.1.0/bemates/node_modules/isexe/index.js:42:5
npm ERR! gyp verb `which` failed     at /nix/store/kd72xr0pvi7wfssb38134my3knzzwvy1-node-dependencies-bemates-0.1.0/bemates/node_modules/isexe/mode.js:8:5
npm ERR! gyp verb `which` failed     at FSReqCallback.oncomplete (node:fs:207:21) {
npm ERR! gyp verb `which` failed   code: 'ENOENT'
npm ERR! gyp verb `which` failed }
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.

Somehow I had python3 in my nix store but I manually removed it, before removing the error was a syntax error and not a command not found meaning gyp was attempting to use python3.
This is confusing to me, first because I don't know how python3 ended in my store, and secondly because it means the build is not pure.
I am on a m1 Darwin machine.

excuse if I use the wrong terminology, I haven't used nix for long. I am not sure how to perform the build without running nix-shell.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant