blurgyy / jaxngp

JAX implementation of instant-ngp (NeRF part)
Apache License 2.0
28 stars 3 forks source link

Patch flake.nix #4

Open chrisflesher opened 1 year ago

chrisflesher commented 1 year ago

Had to patch to flake.nix to install:

diff --git a/flake.nix b/flake.nix
index c95d511..283859c 100644
--- a/flake.nix
+++ b/flake.nix
@@ -132,11 +132,7 @@
           (!isWsl && nvidiaDriverVersionMajor <= 470)
           "--xla_gpu_force_compilation_parallelism=1";
         shellHook = ''
-          source <(sed -Ee '/\$@/d' ${lib.getExe cudaPkgs.nixgl.nixGLIntel})
-        '' + (if isWsl
-          then ''export LD_LIBRARY_PATH=/usr/lib/wsl/lib''${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}''
-          else ''source <(sed -Ee '/\$@/d' ${lib.getExe cudaPkgs.nixgl.auto.nixGLNvidia}*)''
-        ) + "\n" + commonShellHook;
+        '' + commonShellHook;
       };
blurgyy commented 1 year ago

Hi @chrisflesher,

Thank you for opening an issue!

The removed lines in your patch are there for compatibility with non-NixOS Linux distributions and WSL2 environments, normally they shouldn't cause any problem. May I know what problems are you facing with the original flake.nix? Pasting the error messages here and describing your development environment would help me understand what is going on, so that I can come up with a possibly better solution.

chrisflesher commented 1 year ago

Hi @blurgyy, this is running on a VM with Ubuntu 20.04. Here is the error message I was getting:

chris@flask /opt/jaxngp (main) $ nix develop --impure --show-trace
error:
       … while calling the 'derivationStrict' builtin

         at /builtin/derivation.nix:9:12: (source not available)

       … while evaluating derivation 'cuda'
         whose name attribute is located at /nix/store/nkhjmzkf9hky9h34yrfy0cgyd9pbh03v-source/pkgs/stdenv/generic/make-derivation.nix:270:7

       … while evaluating attribute 'shellHook' of derivation 'cuda'

         at /nix/store/nkhjmzkf9hky9h34yrfy0cgyd9pbh03v-source/pkgs/build-support/mkshell/default.nix:41:3:

           40|
           41|   shellHook = lib.concatStringsSep "\n" (lib.catAttrs "shellHook"
             |   ^
           42|     (lib.reverseList inputsFrom ++ [ attrs ]));

       … from call site

         at /nix/store/4i8nvv3yjqy8n0f7zvqzjxpakkfljc2q-source/flake.nix:138:46:

          137|           then ''export LD_LIBRARY_PATH=/usr/lib/wsl/lib''${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}''
          138|           else ''source <(sed -Ee '/\$@/d' ${lib.getExe cudaPkgs.nixgl.auto.nixGLNvidia}*)''
             |                                              ^
          139|         ) + "\n" + commonShellHook;

       … while calling 'getExe'

         at /nix/store/nkhjmzkf9hky9h34yrfy0cgyd9pbh03v-source/lib/meta.nix:141:12:

          140|   */
          141|   getExe = x:
             |            ^
          142|     "${lib.getBin x}/bin/${x.meta.mainProgram or (lib.getName x)}";

       … while evaluating derivation 'nixGLNvidia-535.86.10'
         whose name attribute is located at /nix/store/nkhjmzkf9hky9h34yrfy0cgyd9pbh03v-source/pkgs/stdenv/generic/make-derivation.nix:270:7

       … while evaluating attribute 'text' of derivation 'nixGLNvidia-535.86.10'

         at /nix/store/nkhjmzkf9hky9h34yrfy0cgyd9pbh03v-source/pkgs/build-support/trivial-builders.nix:124:16:

          123|     runCommand name
          124|       { inherit text executable checkPhase meta;
             |                ^
          125|         passAsFile = [ "text" ];

       … while evaluating derivation 'nvidia-x11-535.86.10-nixGL'
         whose name attribute is located at /nix/store/cvdzv2z3d2cp5cf7y7l8cq4n7lgnq6nb-source/pkgs/stdenv/generic/make-derivation.nix:302:7

       … while evaluating attribute 'src' of derivation 'nvidia-x11-535.86.10-nixGL'

         at /nix/store/gb1rfp8s0mhvjwhv33amfjd3cpzrigj0-source/nixGL.nix:76:11:

           75|           inherit version;
           76|           src = let
             |           ^
           77|             url =

       error: unable to download 'https://download.nvidia.com/XFree86/Linux-x86_64/535.86.10/NVIDIA-Linux-x86_64-535.86.10.run': HTTP error 404

       response body:

       <?xml version="1.0" encoding="iso-8859-1"?>
       <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
                "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
       <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
        <head>
            <title>404 - Not Found</title>
        </head>
        <body>
            <h1>404 - Not Found</h1>
            <script type="text/javascript" src="//obj.ac.bcon.ecdns.net/ec_tpm_bcon.js"></script>
        </body>
       </html>
blurgyy commented 1 year ago

Hi @chrisflesher,

Thank you for providing the information.

   error: unable to download 'https://download.nvidia.com/XFree86/Linux-x86_64/535.86.10/NVIDIA-Linux-x86_64-535.86.10.run': HTTP error 404

It seems your installed NVIDIA driver version is 535.86.10, but NVIDIA has removed it from their website (if it was ever there): https://download.nvidia.com/XFree86/Linux-x86_64/, the most similar version I can find on this site is 535.86.05, could you please try to uninstall your current driver and execute NVIDIA's official run file from their website?

And have you tried running the training process with actual data after applying this patch? If the system is any distribution other than NixOS (e.g. ubuntu VM in this case), I don't think the program would run in after deleting those lines.