b-rodrigues / rix

Reproducible development environments for R with Nix
https://b-rodrigues.github.io/rix/
GNU General Public License v3.0
113 stars 12 forks source link

`rix` accepts the same package in multiple locations #264

Open eliocamp opened 1 month ago

eliocamp commented 1 month ago

This rix command uses the metR package both as in git_pkgs and r_pkgs and runs fine.

library(rix)

metR <- list(package_name = "metR", 
             repo_url = "https://github.com/eliocamp/metR", 
             commit = "1dd5d391d5da6a80fde03301671aea5582643914")

rix(r_ver = "4.3.2",
    r_pkgs = "metR",
    git_pkgs = metR,
    ide = "rstudio",
    project_path = ".",
    overwrite = TRUE,
    print = TRUE)

It seems to me that a contradictory environment description (use the nix version of metR but also this particular git version); shouldn't this throw an error? Also relevant to local_r_pkgs, probably.

b-rodrigues commented 1 month ago

I think in this case the same as in a "regular" r session happens, essentially the most recent version stays

philipp-baumann commented 1 month ago

@b-rodrigues @eliocamp when nix-build or rix::nix_build() the above generated default.nix, I get

Unable to checkout 1dd5d391d5da6a80fde03301671aea5582643914 from https://github.com/eliocamp/metR.
error: builder for '/nix/store/wp02mgjjcyvi73kkv8flsf3i0npbg9xw-metR-1dd5d39.drv' failed with exit code 1;
       last 19 log lines:
       > exporting https://github.com/eliocamp/metR (rev 1dd5d391d5da6a80fde03301671aea5582643914) into /nix/store/5q4724c4jy7pfgdl2cqbl82dfxw05q82-metR-1dd5d39
       > Initialized empty Git repository in /nix/store/5q4724c4jy7pfgdl2cqbl82dfxw05q82-metR-1dd5d39/.git/
       > remote: Enumerating objects: 308, done.
       > remote: Counting objects: 100% (308/308), done.
       > remote: Compressing objects: 100% (255/255), done.
       > error: RPC failed; curl 18 Transferred a partial fileiB/s
       > error: 3338 bytes of body are still expected
       > fetch-pack: unexpected disconnect while reading sideband packet
       > fatal: early EOF
       > fatal: fetch-pack: invalid index-pack output
       > remote: Enumerating objects: 13745, done.
       > remote: Counting objects: 100% (3592/3592), done.
       > remote: Compressing objects: 100% (1613/1613), done.
       > error: RPC failed; curl 92 HTTP/2 stream 5 was not closed cleanly: CANCEL (err 8)
       > error: 7502 bytes of body are still expected
       > fetch-pack: unexpected disconnect while reading sideband packet
       > fatal: early EOF
       > fatal: fetch-pack: invalid index-pack output
       > Unable to checkout 1dd5d391d5da6a80fde03301671aea5582643914 from https://github.com/eliocamp/metR.
       For full logs, run 'nix log /nix/store/wp02mgjjcyvi73kkv8flsf3i0npbg9xw-metR-1dd5d39.drv'.
error: 1 dependencies of derivation '/nix/store/kkdyb5g529dac6ysng7mfn9q4jbndidy-r-metR.drv' failed to build

error: 1 dependencies of derivation '/nix/store/gygd0vpxbprsl52mi3m73085915dyyqg-nix-shell.drv' failed to build
> 
> 

> sessionInfo()
R version 4.3.3 (2024-02-29)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 22.04.3 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.10.0 
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.10.0

locale:
 [1] LC_CTYPE=C.UTF-8       LC_NUMERIC=C           LC_TIME=C.UTF-8       
 [4] LC_COLLATE=C.UTF-8     LC_MONETARY=C.UTF-8    LC_MESSAGES=C.UTF-8   
 [7] LC_PAPER=C.UTF-8       LC_NAME=C              LC_ADDRESS=C          
[10] LC_TELEPHONE=C         LC_MEASUREMENT=C.UTF-8 LC_IDENTIFICATION=C   

time zone: Europe/Zurich
tzcode source: system (glibc)

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
[1] compiler_4.3.3   tools_4.3.3      curl_5.2.1       rix_0.8.0       
[5] codetools_0.2-18 jsonlite_1.8.8   sys_3.4.2 

right now in WSL Ubuntu. Can you reproduce this?

eliocamp commented 1 month ago

No. I get a long series of compilation steps and then a compilation error right at the end

[100%] Built target python_binding
make: *** [Makefile:146: all] Error 2
error: builder for '/nix/store/vss6vy5px8fw1wh8rq5zrbpj9xx563vk-gdal-3.8.4.drv' failed with exit code 2;
       last 25 log lines:
       >
       > compile:
       >     [mkdir] Created dir: /build/source/build/swig/java/build/classes
       >     [javac] Compiling 88 source files to /build/source/build/swig/java/build/classes
       >     [javac] warning: [options] bootstrap class path not set in conjunction with -source 7
       >     [javac] error: Source option 7 is no longer supported. Use 8 or later.
       >     [javac] error: Target option 7 is no longer supported. Use 8 or later.
       >
       > BUILD FAILED
       > /build/source/swig/java/build.xml:25: Compile failed; see the compiler error output for details.
       >
       > Total time: 0 seconds
       > make[2]: *** [swig/java/CMakeFiles/java_binding.dir/build.make:107: swig/java/gdal.jar] Error 1
       > make[1]: *** [CMakeFiles/Makefile2:10036: swig/java/CMakeFiles/java_binding.dir/all] Error 2
       > make[1]: *** Waiting for unfinished jobs....
       > g++ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -I/nix/store/iygsjhqpc4s47y0xar4pi5pi6pmfigad-libxcrypt-4.4.36/include -shared build/temp.linux-x86_64-cpython-311/extensions/ogr_wrap.o -L/build/source/build -L/nix/store/3v2ch16fkl50i85n05h5ckss8pxx6836-python3-3.11.8/lib -lgdal -o build/lib.linux-x86_64-cpython-311/osgeo/_ogr.cpython-311-x86_64-linux-gnu.so
       > g++ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -I/nix/store/iygsjhqpc4s47y0xar4pi5pi6pmfigad-libxcrypt-4.4.36/include -shared build/temp.linux-x86_64-cpython-311/extensions/gdal_wrap.o -L/build/source/build -L/nix/store/3v2ch16fkl50i85n05h5ckss8pxx6836-python3-3.11.8/lib -lgdal -o build/lib.linux-x86_64-cpython-311/osgeo/_gdal.cpython-311-x86_64-linux-gnu.so
       > copying build/lib.linux-x86_64-cpython-311/osgeo/_gdal.cpython-311-x86_64-linux-gnu.so -> osgeo
       > copying build/lib.linux-x86_64-cpython-311/osgeo/_gdalconst.cpython-311-x86_64-linux-gnu.so -> osgeo
       > copying build/lib.linux-x86_64-cpython-311/osgeo/_osr.cpython-311-x86_64-linux-gnu.so -> osgeo
       > copying build/lib.linux-x86_64-cpython-311/osgeo/_ogr.cpython-311-x86_64-linux-gnu.so -> osgeo
       > copying build/lib.linux-x86_64-cpython-311/osgeo/_gnm.cpython-311-x86_64-linux-gnu.so -> osgeo
       > copying build/lib.linux-x86_64-cpython-311/osgeo/_gdal_array.cpython-311-x86_64-linux-gnu.so -> osgeo
       > [100%] Built target python_binding
       > make: *** [Makefile:146: all] Error 2
       For full logs, run 'nix log /nix/store/vss6vy5px8fw1wh8rq5zrbpj9xx563vk-gdal-3.8.4.drv'.
error: 1 dependencies of derivation '/nix/store/2rdsad5bw8sx94h5g0cz2wvpa1c8m9yz-r-sf-1.0-15.drv' failed to build
error: 1 dependencies of derivation '/nix/store/bahk5q5w2vxrcw2s5s87zkncx301q722-r-metR-0.14.1.drv' failed to build
error: 1 dependencies of derivation '/nix/store/gygd0vpxbprsl52mi3m73085915dyyqg-nix-shell.drv' failed to build
philipp-baumann commented 1 month ago

No. I get a long series of compilation steps and then a compilation error right at the end

[100%] Built target python_binding
make: *** [Makefile:146: all] Error 2
error: builder for '/nix/store/vss6vy5px8fw1wh8rq5zrbpj9xx563vk-gdal-3.8.4.drv' failed with exit code 2;
       last 25 log lines:
       >
       > compile:
       >     [mkdir] Created dir: /build/source/build/swig/java/build/classes
       >     [javac] Compiling 88 source files to /build/source/build/swig/java/build/classes
       >     [javac] warning: [options] bootstrap class path not set in conjunction with -source 7
       >     [javac] error: Source option 7 is no longer supported. Use 8 or later.
       >     [javac] error: Target option 7 is no longer supported. Use 8 or later.
       >
       > BUILD FAILED
       > /build/source/swig/java/build.xml:25: Compile failed; see the compiler error output for details.
       >
       > Total time: 0 seconds
       > make[2]: *** [swig/java/CMakeFiles/java_binding.dir/build.make:107: swig/java/gdal.jar] Error 1
       > make[1]: *** [CMakeFiles/Makefile2:10036: swig/java/CMakeFiles/java_binding.dir/all] Error 2
       > make[1]: *** Waiting for unfinished jobs....
       > g++ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -I/nix/store/iygsjhqpc4s47y0xar4pi5pi6pmfigad-libxcrypt-4.4.36/include -shared build/temp.linux-x86_64-cpython-311/extensions/ogr_wrap.o -L/build/source/build -L/nix/store/3v2ch16fkl50i85n05h5ckss8pxx6836-python3-3.11.8/lib -lgdal -o build/lib.linux-x86_64-cpython-311/osgeo/_ogr.cpython-311-x86_64-linux-gnu.so
       > g++ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -I/nix/store/iygsjhqpc4s47y0xar4pi5pi6pmfigad-libxcrypt-4.4.36/include -shared build/temp.linux-x86_64-cpython-311/extensions/gdal_wrap.o -L/build/source/build -L/nix/store/3v2ch16fkl50i85n05h5ckss8pxx6836-python3-3.11.8/lib -lgdal -o build/lib.linux-x86_64-cpython-311/osgeo/_gdal.cpython-311-x86_64-linux-gnu.so
       > copying build/lib.linux-x86_64-cpython-311/osgeo/_gdal.cpython-311-x86_64-linux-gnu.so -> osgeo
       > copying build/lib.linux-x86_64-cpython-311/osgeo/_gdalconst.cpython-311-x86_64-linux-gnu.so -> osgeo
       > copying build/lib.linux-x86_64-cpython-311/osgeo/_osr.cpython-311-x86_64-linux-gnu.so -> osgeo
       > copying build/lib.linux-x86_64-cpython-311/osgeo/_ogr.cpython-311-x86_64-linux-gnu.so -> osgeo
       > copying build/lib.linux-x86_64-cpython-311/osgeo/_gnm.cpython-311-x86_64-linux-gnu.so -> osgeo
       > copying build/lib.linux-x86_64-cpython-311/osgeo/_gdal_array.cpython-311-x86_64-linux-gnu.so -> osgeo
       > [100%] Built target python_binding
       > make: *** [Makefile:146: all] Error 2
       For full logs, run 'nix log /nix/store/vss6vy5px8fw1wh8rq5zrbpj9xx563vk-gdal-3.8.4.drv'.
error: 1 dependencies of derivation '/nix/store/2rdsad5bw8sx94h5g0cz2wvpa1c8m9yz-r-sf-1.0-15.drv' failed to build
error: 1 dependencies of derivation '/nix/store/bahk5q5w2vxrcw2s5s87zkncx301q722-r-metR-0.14.1.drv' failed to build
error: 1 dependencies of derivation '/nix/store/gygd0vpxbprsl52mi3m73085915dyyqg-nix-shell.drv' failed to build

Hmm, interesting case. Elio are we using the same expression?

eliocamp commented 1 month ago

Yes, the same code on my original comment.

philipp-baumann commented 1 month ago

Yes, the same code on my original comment.

yeah.

Buildfile: /build/source/swig/java/build.xml

init:
     [echo] version = 3.8.4

compile:
    [mkdir] Created dir: /build/source/build/swig/java/build/classes
    [javac] Compiling 88 source files to /build/source/build/swig/java/build/classes
    [javac] warning: [options] bootstrap class path not set in conjunction with -source 7
    [javac] error: Source option 7 is no longer supported. Use 8 or later.
    [javac] error: Target option 7 is no longer supported. Use 8 or later.

BUILD FAILED
/build/source/swig/java/build.xml:25: Compile failed; see the compiler error output for details.

Total time: 0 seconds
make[2]: *** [swig/java/CMakeFiles/java_binding.dir/build.make:107: swig/java/gdal.jar] Error 1
make[1]: *** [CMakeFiles/Makefile2:10036: swig/java/CMakeFiles/java_binding.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[100%] Linking CXX executable gdal_unit_test
[100%] Built target gdal_unit_test
g++ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -I/nix/store/iygsjhqpc4s47y0xar4pi5pi6pmfigad-libxcrypt-4.4.36/include -shared build/temp.linux-x86_64-cpython-311/extensions/gdal_wrap.o -L/build/source/build -L/nix/store/3v2ch16fkl50i85n05h5ckss8pxx6836-python3-3.11.8/lib -lgdal -o build/lib.linux-x86_64-cpython-311/osgeo/_gdal.cpython-311-x86_64-linux-gnu.so
copying build/lib.linux-x86_64-cpython-311/osgeo/_gdal.cpython-311-x86_64-linux-gnu.so -> osgeo
copying build/lib.linux-x86_64-cpython-311/osgeo/_gdalconst.cpython-311-x86_64-linux-gnu.so -> osgeo
copying build/lib.linux-x86_64-cpython-311/osgeo/_osr.cpython-311-x86_64-linux-gnu.so -> osgeo
copying build/lib.linux-x86_64-cpython-311/osgeo/_ogr.cpython-311-x86_64-linux-gnu.so -> osgeo
copying build/lib.linux-x86_64-cpython-311/osgeo/_gnm.cpython-311-x86_64-linux-gnu.so -> osgeo
copying build/lib.linux-x86_64-cpython-311/osgeo/_gdal_array.cpython-311-x86_64-linux-gnu.so -> osgeo
[100%] Built target python_binding
make: *** [Makefile:146: all] Error 2
error: builder for '/nix/store/vss6vy5px8fw1wh8rq5zrbpj9xx563vk-gdal-3.8.4.drv' failed with exit code 2
error: 1 dependencies of derivation '/nix/store/2rdsad5bw8sx94h5g0cz2wvpa1c8m9yz-r-sf-1.0-15.drv' failed to build
error: 1 dependencies of derivation '/nix/store/bahk5q5w2vxrcw2s5s87zkncx301q722-r-metR-0.14.1.drv' failed to build
error: 1 dependencies of derivation '/nix/store/kkdyb5g529dac6ysng7mfn9q4jbndidy-r-metR.drv' failed to build
error: 1 dependencies of derivation '/nix/store/gygd0vpxbprsl52mi3m73085915dyyqg-nix-shell.drv' failed to build
philipp-baumann commented 3 weeks ago

@eliocamp could you briefly post your .libPaths() output in the Nix-RStudio session in the integrated terminal? I'm afraid your custom .Rprofile that removes system's native user library is not being propagated by Nix-RStudio startup. I am in a WSL2 session for a project with rstudioWrapper and some project-specific packages, and the first position is the user library which should not happen.

 .libPaths()
  [1] "/home/philipp/R/x86_64-pc-linux-gnu-library/4.4"                          
  [2] "/nix/store/qh0diphsk40cpmfgmpnanwgbk79v26zd-r-rix/library"                
  [3] "/nix/store/73xzygmdns8nz8zyqkf6hmzwrgxgxjk2-r-codetools-0.2-20/library"   
  [4] "/nix/store/iagh7mv84ymk7gpkd561h94rq427rdmm-r-curl-5.2.1/library"         
  [5] "/nix/store/4r42c4smdjzw7qfd5pf323p4xl9702hh-r-jsonlite-1.8.8/library"     
  [6] "/nix/store/wvh4h0hdm5xrka9rd01l6dsg4hlqi0d6-r-sys-3.4.2/library"          
  [7] "/nix/store/spkqylmqxn0671sq3iv0kls5xx70j8k2-r-fnmate/library" 
# ... 
philipp-baumann commented 3 weeks ago

Respectively, does your expression build after source(".Rprofile")