-
-
Notifications
You must be signed in to change notification settings - Fork 14.3k
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
Julia Pkgs in NixOS #20649
Comments
/cc maintainer @7c6f434c. |
Is Julia package manager behaviour more stable than the language features now? I mean, |
As soon as they document their environment variables I'm up for having a further look at this. |
I'd like an interface to the native package manager as well. @FRidh: cf. pull request JuliaLang/julia#20162 |
The Julia package manager is due for a rewrite, any integration you do with it now would have to be redone. |
Yesterday I had a short look at it. Implemented thus far is
To do:
What's most important I think though is to decide on how we expect it to work with impure paths. Do we want to be able to also install packages using Pkg.add() or not? And if so, where should it put it? Note the code is quite a mess at this point, and I just dumped everything in one commit. I won't have time to look at this for at least another week, and I might not even continue since I don't use Julia myself. |
Hi, how is it going? Anybody has hints? |
I know it may be a wrong place to ask, but for this day, is there a way to at least install Julia packages (IJulia.jl, Plots.jl, PyPlot.jl, DifferentialEquations.jl, Sundials.jl and so on)? It is the only thing which keeps me from trying NixOs one more time (last time all was good except I could not make Julia with packages work, it was a year ago) maybe you can comment here Sorry for the wrong place again, but I cannot find people who would share their experience with Julia under NixOs |
@AlexanderKoshkarov no, there is no "finished" implementation yet for installing Julia packages with Nix. The closest there is right now is, as far as I know, the branch I mentioned in #20649 (comment). |
I'm using it, you just need to figure out the dependency of a package. I create a nix-shell env with Julia and the dependency the package needs, and set the Julia pkg dir to a subfolder of the project directory. I can upload an example tomorrow, not at my desk right now
Il 15 giugno 2017 18:19:26 CEST, AlexanderKoshkarov <notifications@github.com> ha scritto:
…I know it may be a wrong place to ask, but for this day, is there a way
to at least install Julia packages (IJulia.jl, Plots.jl, PyPlot.jl,
DifferentialEquations.jl, Sundials.jl and so on)? It is the only thing
which keeps me from trying NixOs one more time (last time all was good
except I could not make Julia with packages work, it was a year ago)
maybe you can comment here
[https://www.reddit.com/r/NixOS/comments/6btseq/nixos_and_julia/](url)
Sorry for the wrong place again, but I cannot find people who would
share their experience with Julia under NixOs
--
You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub:
#20649 (comment)
--
Inviato dal mio dispositivo Android con K-9 Mail. Perdonate la brevità.
|
@nico202, Thanks for the assurance that such people exist and it is possible! Yes, the example would be awesome, I already forgot a lot about nix, so it would be very helpful. |
@AlexanderKoshkarov like @FRidh said, my solution is not that nix-y; nonetheless, if you are on NixOS and you want to use julia, this is the only way I found to install packages. Here's a gist with an example |
How does current Julia-NixOS-users deal with hard-coded references to Greping for |
@lesscodeless see my gist in the previous comment. Just add to ld library path ${R}/lib/ |
Many Julia packages use BinDeps.jl in their |
BinDeps calls the package manager only if it's not able to find a suitable dependecy already installed. So we don't need to manage it |
It may be good to "disable" it anyway for non-sandboxed builds. |
I see. How does BinDeps identify whether a library is available or not? |
In my case on Darwin, I had to delete all dependency to Homebrew.jl to install a package using BinDeps. Here is an example: https://gist.github.com/mnacamura/ce3b8e6640d54158df1863cb54e94ff8 |
Setting LD_LIBRARY_PATH works |
Thanks for the answer. Even if I set LD_LIBRARY_PATH and delete a line |
Oh I misunderstood. |
Based on @FRidh's work (#20649 (comment), thanks @FRidh), I implemented this more: https://github.com/mnacamura/nixpkgs/tree/julia-modules. I'm still puzzled how to treat Homebrew on Darwin (mnacamura@e78f629). |
@mnacamura Wow, thanks! Some question:
However on my config i'm using the following packages, with corresponding ld library path # IJulia.jl
ijulialdpath = "${pkgs.mbedtls}/lib:${pkgs.zeromq3}/lib";
# ImageMagick.jl
imagemagickldpath = "${pkgs.imagemagickBig}/lib";
# HDF5.jl
hdf5ldpath = "${pkgs.hdf5}/lib";
# Cairo.jl
cairojlldpath = "${pkgs.cairo}/lib:${pkgs.gettext}/lib:${pkgs.pango.out}/lib:${pkgs.glib.out}/lib";
# Gtk.jl
gtkjlldpath = "${pkgs.gtk3}/lib:${pkgs.gdk_pixbuf}/lib";
# GZip.jl # Required by DataFrames.jl
gzipldpath = "${pkgs.gzip}/lib:${pkgs.zlib}/lib";
# GR.jl # Runs even without Xrender and Xext, but cannot save files, so those are required
grldpath = "${pkgs.xorg.libXt}/lib:${pkgs.xorg.libX11}/lib:${pkgs.xorg.libXrender}/lib:${pkgs.xorg.libXext}/lib";
glfwldpath = "${pkgs.glfw}/lib";
freetypeldpath = "${pkgs.freetype}/lib";
glvisualizeldpath = "${glfwldpath}:${freetypeldpath}"; If you are adding the dependencies manually, this might help edit: added GZip.jl |
Hmm... I've never seen that segfault.
Thank you, it is helpful. Currently ~120 packages seem to use BinDeps. Adding their native dependencies manually is tedious. I wish Pkg3 could provide information of native dependencies in a proper format... So, what's the difference of Pkg3 from the current Pkg (Pkg2?)? |
could you try?
edit: notes: I'm not involved in the dev of Pkg3, I just saw a youtube video weeks ago, so if anybody knows better if it will help the integration with nixpgks it would be useful to know :D |
I use Julia 0.6.2 on x86_64-darwin. Many important changes... I'm looking forward to seeing its release, and going to wait and see. |
Yep, it is, but it is manageable, at least as long as we have say one version per package.
That's interesting. So, that means we can translate every package and every version to a Nix expression of which the key is the
Nix uses a hash for the outputs. Pkg3 uses them for the inputs, for which Nix uses variables. |
Sorry I can't follow you here. (The youtube video I was referring to is this, this is a slide with the feature highlight )
They say this at 7:15. I think they say this just because once a package is installed is never touched again, not sure if there's anything more than this. edit: maybe we can get in touch with @KristofferC |
@danieldk needed to add appropriate paths to LD_LIBRARY_PATH (per @nico202 https://gist.github.com/nico202/9377b3b378eab950dc05566e733ea320). I revised the comment above and now works with Cario |
@tbenst No dice. self: super: {
julia-fhs =
let
ldconfigWrapper = with super; stdenv.mkDerivation {
name = "ldconfig-env";
nativeBuildInputs = [ makeWrapper ];
phases = [ "installPhase" "fixupPhase" ];
installPhase = ''
makeWrapper ${glibc.bin}/bin/ldconfig $out/sbin/ldconfig \
--add-flags "-C /usr/ld.so.cache"
'';
};
in
super.buildFHSUserEnv {
name = "julia-fhs";
targetPkgs = pkgs: with pkgs; [
ldconfigWrapper
julia_11
autoconf
binutils
coreutils
gnumake
m4
pkgconfig
stdenv.cc
utillinux
curl
git
cairo
fontconfig
freetype
gettext
glib
libintl
libpng
libffi
librsvg
pango
pixman
zlib
];
extraBuildCommands = with super; ''
# Cannot write to /etc?
echo "$out/lib" > $out/usr/ld.so.conf
ldconfig -f $out/usr/ld.so.conf -C $out/usr/ld.so.cache
'';
runScript = "julia";
};
} |
@danieldk yes that comes from https://github.com/JuliaPackaging/BinDeps.jl/blob/382082a30de7186d6e27880807f6be353fcbd593/src/dependencies.jl#L398 which if I recall correctly only gets called if a .so is not found. I could reproduce your error before adding the LD_LIBARARY_PATH line, and verified that it could build afterwards. I’m also on unstable so would be surprised indeed if the code in #20649 (comment) doesn’t work for building Cairo. In an case great to have your solution for |
@danieldk, I was trying to understand your nice piece of code but I am just a nix/nixos beginner, so I don't know how to manage overlays in a step by step guide (I am yet learning derivations...). Could you kindly indicate where I could find examples to implement your overlay at /etc/nixos/configuration.nix level? Thanks in advance!! |
@RCHG For adding the overlay you need to add function from snippet to nixpkgs.overlays (https://nixos.org/nixpkgs/manual/#chap-overlays). Example content of the configuration.nix: { config, pkgs, lib, ... }:
let
juliaOverlay = self: super: {
julia-fhs = ...
};
in {
...
nixpkgs.overlays = [
juliaOverlay
];
...
} |
For what it is worth |
what is the current status of packaging Julia with Nix? |
@schlichtanders I'm not aware of any efforts. Seems like this is possible today however, using the approach in #20649 (comment). I don't think the lack of determinism in precompilation is a deal-breaker. From a practical standpoint, nix hashes the inputs not the outputs, so the ecosystem already works with non-deterministic builds: https://r13y.com/. When upstream fixes reproducibility, great, we'll reap the benefits, but I don't think that should stop us from having a workable solution for now. I think we just need someone to spearhead the effort. I'd certainly be happy to help with specific packages I care about (e.g. Flux.jl). |
This issue has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/system-with-nixos-how-to-add-another-extra-distribution/5767/11 |
With overlay by @danieldk and expression by @tbenst tried and got |
Hi all, I've been working on a tool for creating Julia environments in Nix now that the new and improved |
FWIW, guix has recently been adding support for several julia packages (example). Can their approach be emulated? |
@nbren12 that's the simple build system I wrote, which is enough to get packages working. jll packages have their .so file path fixed like this |
Cool @nico202! Would it be worth porting to nix? |
The build system is working ok, with a few problems
(1. can probably be fixed, I just to have to find some time to look at it. I also made some progress on 3 here but I'm stuck and nobody gave me support 😞 ) However, if anybody is willed to have give a try, I guess it's worth it (packages are working and it should also be pretty straightforward to write an importer for them). (but I switched to guix so I'm sorry I won't be able to add the build system myself) |
I marked this as stale due to inactivity. → More info |
I am investigating how guix community accomplishes Julia packaging now + julia2nix |
Hi @samrose, did you make any progress on this? |
I've created PR #208379 that addresses this. Please help to review and check it. |
Hi all, I've just pushed a new attempt at this: #225513. I think this version is exciting because it lets you build arbitrary and up-to-date package sets in a nice way, without adding a ton of stuff to the Nixpkgs repo. There is some IFD though; see the PR for more discussion. Please feel free to comment or review! |
@thomasjm I was trying out |
Good point @sbh69840 , I just added deduplication for |
@sbh69840 fixed! Now we have Python provided to Julia earlier in the process, and also a mapping to provide extra Python packages for Julia packages which need them. There's some related discussion in the PR thread. Please keep the feedback coming :) |
Closing this now since |
Issue description
It would be nice to have julia pkgs easily installable the way we can install them in python on other languages
The packages resides in a git project (https://github.com/JuliaLang/METADATA.jl), every package has it's (git) url, every version hashes and dependencies
The variable JULIA_PKGDIR defines a folder in which packages get installed, I think we can symlink from the store to this folder (not sure if it needs to be ro/rw)
The text was updated successfully, but these errors were encountered: