Install AcademySoftwareFoundation/rez

Hi everyone

I am trying to install Rez as a derivation (I know, it’s not the latest, but I have this running on my previous system). On nix-shell (or on a normal Linux distro), the process is basically the following:

nix-shell -p python310
cd rez-2.112.0/
python3.10 ./install.py -v ~/REZ_TEST

And that produces a successful install:

installing rez to /home/michael/REZ_TEST...
  DEPRECATION: rez is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559

[notice] A new release of pip is available: 23.0.1 -> 23.3.2
[notice] To update, run: /home/michael/REZ_TEST/bin/python -m pip install --upgrade pip
01:35:30 INFO     changing mode of /home/michael/REZ_TEST/bin/rez/rez to 755
01:35:30 INFO     changing mode of /home/michael/REZ_TEST/bin/rez/rez-3.1 to 755
01:35:30 INFO     changing mode of /home/michael/REZ_TEST/bin/rez/rezolve to 755
01:35:30 INFO     changing mode of /home/michael/REZ_TEST/bin/rez/rezolve-3.1 to 755
01:35:30 INFO     changing mode of /home/michael/REZ_TEST/bin/rez/_rez-complete-3.1 to 755
01:35:30 INFO     changing mode of /home/michael/REZ_TEST/bin/rez/_rez-complete to 755
01:35:30 INFO     changing mode of /home/michael/REZ_TEST/bin/rez/_rez_fwd-3.1 to 755
01:35:30 INFO     changing mode of /home/michael/REZ_TEST/bin/rez/_rez_fwd to 755
01:35:30 INFO     changing mode of /home/michael/REZ_TEST/bin/rez/rez-bind-3.1 to 755
01:35:30 INFO     changing mode of /home/michael/REZ_TEST/bin/rez/rez-bind to 755
01:35:30 INFO     changing mode of /home/michael/REZ_TEST/bin/rez/rez-build-3.1 to 755
01:35:30 INFO     changing mode of /home/michael/REZ_TEST/bin/rez/rez-build to 755
01:35:30 INFO     changing mode of /home/michael/REZ_TEST/bin/rez/rez-config to 755
01:35:30 INFO     changing mode of /home/michael/REZ_TEST/bin/rez/rez-config-3.1 to 755
01:35:30 INFO     changing mode of /home/michael/REZ_TEST/bin/rez/rez-context to 755
01:35:30 INFO     changing mode of /home/michael/REZ_TEST/bin/rez/rez-context-3.1 to 755
01:35:30 INFO     changing mode of /home/michael/REZ_TEST/bin/rez/rez-cp to 755
01:35:30 INFO     changing mode of /home/michael/REZ_TEST/bin/rez/rez-cp-3.1 to 755
01:35:30 INFO     changing mode of /home/michael/REZ_TEST/bin/rez/rez-depends-3.1 to 755
01:35:30 INFO     changing mode of /home/michael/REZ_TEST/bin/rez/rez-depends to 755
01:35:30 INFO     changing mode of /home/michael/REZ_TEST/bin/rez/rez-diff to 755
01:35:30 INFO     changing mode of /home/michael/REZ_TEST/bin/rez/rez-diff-3.1 to 755
01:35:30 INFO     changing mode of /home/michael/REZ_TEST/bin/rez/rez-env to 755
01:35:30 INFO     changing mode of /home/michael/REZ_TEST/bin/rez/rez-env-3.1 to 755
01:35:30 INFO     changing mode of /home/michael/REZ_TEST/bin/rez/rez-gui to 755
01:35:30 INFO     changing mode of /home/michael/REZ_TEST/bin/rez/rez-gui-3.1 to 755
01:35:30 INFO     changing mode of /home/michael/REZ_TEST/bin/rez/rez-help-3.1 to 755
01:35:30 INFO     changing mode of /home/michael/REZ_TEST/bin/rez/rez-help to 755
01:35:30 INFO     changing mode of /home/michael/REZ_TEST/bin/rez/rez-interpret to 755
01:35:30 INFO     changing mode of /home/michael/REZ_TEST/bin/rez/rez-interpret-3.1 to 755
01:35:30 INFO     changing mode of /home/michael/REZ_TEST/bin/rez/rez-memcache to 755
01:35:30 INFO     changing mode of /home/michael/REZ_TEST/bin/rez/rez-memcache-3.1 to 755
01:35:30 INFO     changing mode of /home/michael/REZ_TEST/bin/rez/rez-pip to 755
01:35:30 INFO     changing mode of /home/michael/REZ_TEST/bin/rez/rez-pip-3.1 to 755
01:35:30 INFO     changing mode of /home/michael/REZ_TEST/bin/rez/rez-pkg-cache-3.1 to 755
01:35:30 INFO     changing mode of /home/michael/REZ_TEST/bin/rez/rez-pkg-cache to 755
01:35:30 INFO     changing mode of /home/michael/REZ_TEST/bin/rez/rez-plugins-3.1 to 755
01:35:30 INFO     changing mode of /home/michael/REZ_TEST/bin/rez/rez-plugins to 755
01:35:30 INFO     changing mode of /home/michael/REZ_TEST/bin/rez/rez-python to 755
01:35:30 INFO     changing mode of /home/michael/REZ_TEST/bin/rez/rez-python-3.1 to 755
01:35:30 INFO     changing mode of /home/michael/REZ_TEST/bin/rez/rez-release-3.1 to 755
01:35:30 INFO     changing mode of /home/michael/REZ_TEST/bin/rez/rez-release to 755
01:35:30 INFO     changing mode of /home/michael/REZ_TEST/bin/rez/rez-search to 755
01:35:30 INFO     changing mode of /home/michael/REZ_TEST/bin/rez/rez-search-3.1 to 755
01:35:30 INFO     changing mode of /home/michael/REZ_TEST/bin/rez/rez-selftest to 755
01:35:30 INFO     changing mode of /home/michael/REZ_TEST/bin/rez/rez-selftest-3.1 to 755
01:35:30 INFO     changing mode of /home/michael/REZ_TEST/bin/rez/rez-status-3.1 to 755
01:35:30 INFO     changing mode of /home/michael/REZ_TEST/bin/rez/rez-status to 755
01:35:30 INFO     changing mode of /home/michael/REZ_TEST/bin/rez/rez-suite to 755
01:35:30 INFO     changing mode of /home/michael/REZ_TEST/bin/rez/rez-suite-3.1 to 755
01:35:30 INFO     changing mode of /home/michael/REZ_TEST/bin/rez/rez-test to 755
01:35:30 INFO     changing mode of /home/michael/REZ_TEST/bin/rez/rez-test-3.1 to 755
01:35:30 INFO     changing mode of /home/michael/REZ_TEST/bin/rez/rez-view to 755
01:35:30 INFO     changing mode of /home/michael/REZ_TEST/bin/rez/rez-view-3.1 to 755
01:35:30 INFO     changing mode of /home/michael/REZ_TEST/bin/rez/rez-yaml2py to 755
01:35:30 INFO     changing mode of /home/michael/REZ_TEST/bin/rez/rez-yaml2py-3.1 to 755
01:35:30 INFO     changing mode of /home/michael/REZ_TEST/bin/rez/rez-bundle to 755
01:35:30 INFO     changing mode of /home/michael/REZ_TEST/bin/rez/rez-bundle-3.1 to 755
01:35:30 INFO     changing mode of /home/michael/REZ_TEST/bin/rez/rez-benchmark-3.1 to 755
01:35:30 INFO     changing mode of /home/michael/REZ_TEST/bin/rez/rez-benchmark to 755
01:35:30 INFO     changing mode of /home/michael/REZ_TEST/bin/rez/rez-pkg-ignore-3.1 to 755
01:35:30 INFO     changing mode of /home/michael/REZ_TEST/bin/rez/rez-pkg-ignore to 755
01:35:30 INFO     changing mode of /home/michael/REZ_TEST/bin/rez/rez-mv to 755
01:35:30 INFO     changing mode of /home/michael/REZ_TEST/bin/rez/rez-mv-3.1 to 755
01:35:30 INFO     changing mode of /home/michael/REZ_TEST/bin/rez/rez-rm-3.1 to 755
01:35:30 INFO     changing mode of /home/michael/REZ_TEST/bin/rez/rez-rm to 755

SUCCESS!
Rez executable installed to: /home/michael/REZ_TEST/bin/rez/rez
Rez python package installed to: /home/michael/REZ_TEST/lib/python3.10/site-packages/rez

To activate Rez, add the following path to $PATH:
/home/michael/REZ_TEST/bin/rez

You may also want to source the completion script (for bash):
source /home/michael/REZ_TEST/completion/complete.sh

However, I am unable to transfer this into a package that I can install system wide, via the following derivation:

{
  pkgs,
  lib,
  stdenv
}:

let
  _pname = "rez";
  _version = "2.112.0";

in

pkgs.stdenv.mkDerivation rec {
  pname = "${_pname}";
  version = "${_version}";
  name = "${pname}-${version}";
  
  meta = with lib; {
    description = "Rez is a cross-platform package manager";
    homepage = "https://github.com/AcademySoftwareFoundation/rez";
    platforms = platforms.linux;
  };

  src = fetchTarball {
    url = "https://github.com/AcademySoftwareFoundation/${pname}/archive/refs/tags/${version}.tar.gz";
    sha256 = "sha256:0h6xf35si8hqfh7mb1w9a4my518cyvazwxs2bk5s8bv70qmslr67";
  };

  buildInputs = with pkgs;
  [
    which
    tree
    bc
    python310
    python310Packages.pip
    python310Packages.setuptools
  ];

  dontBuild = true;
  dontConfigure = true;

  dontUnpack = false;
  dontInstall = false;
  dontFixup = false;

  installPhase = ''
    # runHook preInstall
    mkdir -p $out/share/rez/src/
    mkdir -p $out/share/rez/env/
    cp -r $src/* $out/share/rez/src/
    cd $out/share/rez/src/
    ${pkgs.python310}/bin/python3.10 ./install.py $out/share/rez/env/
    # runHook postInstall
  '';
}

Calling it gives me

building the system configuration...
error: builder for '/nix/store/l03z33c36s4b4zyfq5q2g2kf2xdkrxs0-rez-2.112.0.drv' failed with exit code 1;
       last 10 log lines:
       >     install_rez_from_source(dest_dir)
       >   File "/nix/store/7a53bdv5yqgp8jpklcanzr53ppyz0471-rez-2.112.0/share/rez/src/./install.py", line 223, in install_rez_from_source
       >     run_command([py_executable, "-m", "pip", "install", "."])
       >   File "/nix/store/7a53bdv5yqgp8jpklcanzr53ppyz0471-rez-2.112.0/share/rez/src/./install.py", line 78, in run_command
       >     return subprocess.check_output(args, cwd=source_path)
       >   File "/nix/store/50kabpj0s79040a42b7jj2dxn85wmbfd-python3-3.10.13/lib/python3.10/subprocess.py", line 421, in check_output
       >     return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
       >   File "/nix/store/50kabpj0s79040a42b7jj2dxn85wmbfd-python3-3.10.13/lib/python3.10/subprocess.py", line 526, in run
       >     raise CalledProcessError(retcode, process.args,
       > subprocess.CalledProcessError: Command '['/nix/store/7a53bdv5yqgp8jpklcanzr53ppyz0471-rez-2.112.0/share/rez/env/bin/python', '-m', 'pip', 'install', '.']' returned non-zero exit status 1.
       For full logs, run 'nix log /nix/store/l03z33c36s4b4zyfq5q2g2kf2xdkrxs0-rez-2.112.0.drv'.
error: 1 dependencies of derivation '/nix/store/4p98hmbnfh5xmzn9jc7hrcrlwyy54nd2-system-path.drv' failed to build
error: 1 dependencies of derivation '/nix/store/yp37izgs8bq96778cwkvnkl22ilca987-nixos-system-nixos-pocket3-23.11.20240110.3dc440f.drv' failed to build

nix log

@nix { "action": "setPhase", "phase": "unpackPhase" }
unpacking sources
unpacking source archive /nix/store/zhqwz32vh91abd5q717lkx82yjm0b0g4-source
source root is source
@nix { "action": "setPhase", "phase": "patchPhase" }
patching sources
@nix { "action": "setPhase", "phase": "updateAutotoolsGnuConfigScriptsPhase" }
updateAutotoolsGnuConfigScriptsPhase
@nix { "action": "setPhase", "phase": "installPhase" }
installing
installing rez to /nix/store/7a53bdv5yqgp8jpklcanzr53ppyz0471-rez-2.112.0/share/rez/env...
e[33mWARNING: The directory '/homeless-shelter/.cache/pip' or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check the permissions and owner of that directory. If executing pip with sudo, you should use sudo's -H flag.e[0me[33m
e[0m  e[1;31merrore[0m: e[1msubprocess-exited-with-errore[0m
  
  e[31m×e[0m e[32mpip subprocess to install build dependenciese[0m did not run successfully.
  e[31m│e[0m exit code: e[1;36m1e[0m
  e[31m╰─>e[0m e[31m[8 lines of output]e[0m
  e[31m   e[0m WARNING: The directory '/homeless-shelter/.cache/pip' or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check the permissions and owner of that directory. If executing pip with sudo, you should use sudo's -H flag.
  e[31m   e[0m WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7ffff57fb760>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/setuptools/
  e[31m   e[0m WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7ffff57fb250>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/setuptools/
  e[31m   e[0m WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7ffff5824340>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/setuptools/
  e[31m   e[0m WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7ffff58244f0>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/setuptools/
  e[31m   e[0m WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7ffff58246a0>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/setuptools/
  e[31m   e[0m ERROR: Could not find a version that satisfies the requirement setuptools>=40.8.0 (from versions: none)
  e[31m   e[0m ERROR: No matching distribution found for setuptools>=40.8.0
  e[31m   e[0m e[31m[end of output]e[0m
  
  e[1;35mnotee[0m: This error originates from a subprocess, and is likely not a problem with pip.
e[1;31merrore[0m: e[1msubprocess-exited-with-errore[0m

e[31m×e[0m e[32mpip subprocess to install build dependenciese[0m did not run successfully.
e[31m│e[0m exit code: e[1;36m1e[0m
e[31m╰─>e[0m See above for output.

e[1;35mnotee[0m: This error originates from a subprocess, and is likely not a problem with pip.
Traceback (most recent call last):
  File "/nix/store/7a53bdv5yqgp8jpklcanzr53ppyz0471-rez-2.112.0/share/rez/src/./install.py", line 311, in <module>
    install(dest_dir, print_welcome=True)
  File "/nix/store/7a53bdv5yqgp8jpklcanzr53ppyz0471-rez-2.112.0/share/rez/src/./install.py", line 156, in install
    install_rez_from_source(dest_dir)
  File "/nix/store/7a53bdv5yqgp8jpklcanzr53ppyz0471-rez-2.112.0/share/rez/src/./install.py", line 223, in install_rez_from_source
    run_command([py_executable, "-m", "pip", "install", "."])
  File "/nix/store/7a53bdv5yqgp8jpklcanzr53ppyz0471-rez-2.112.0/share/rez/src/./install.py", line 78, in run_command
    return subprocess.check_output(args, cwd=source_path)
  File "/nix/store/50kabpj0s79040a42b7jj2dxn85wmbfd-python3-3.10.13/lib/python3.10/subprocess.py", line 421, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "/nix/store/50kabpj0s79040a42b7jj2dxn85wmbfd-python3-3.10.13/lib/python3.10/subprocess.py", line 526, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['/nix/store/7a53bdv5yqgp8jpklcanzr53ppyz0471-rez-2.112.0/share/rez/env/bin/python', '-m', 'pip', 'install', '.']' returned non-zero exit status 1.

I tried various different thing that seemed like the first ones to address when looking at these logs. However, nothing was successful so far. Maybe someone has an idea or some guidance.

Thanks for having a look!

Cheers,
Michael

Hey, just came across this and did a bit of digging. Now I don’t know nix at all, but it looks like you’re having an issue with the /homeless-shelter directory. This comment on github may help

buildPhase = ‘’
# this line removes a bug where value of $HOME is set to a non-writable /homeless-shelter dir
export HOME=$(pwd)

Well, nice trick! Thanks Liametc!