Managing `julia` versions using `pixi`

A https://prefix.dev core developer (github.com/wolfv) added a julia-forge channel on julia-forge - prefix.dev | prefix.dev.

This should make it easier to manage per project Julia versions without juliaup. Here’s a screenshot showing no global julia installation but a per folder julia install when activating the pixi shell:

Here’s the commit where I added julia to a pixi environment: feat: Add Julia · kdheepak/pixi-test@4d8cc82 · GitHub

For a new project, it’s as simple as the following after installing pixi:

pixi init
pixi project channel add https://repo.prefix.dev/julia-forge
pixi add julia

pixi already supports conda and pip dependencies, and this will (in my opinion) make it easier to introduce julia into python projects that use pixi for package management.

Currently there’s just one version of Julia on the julia-forge channel but it should be straight-forward to add more versions. See here for the julia-forge source: GitHub - wolfv/julia-forge: Recipes for julia (the language) and more

Thanks to wolfv (Wolf Vollprecht) · GitHub for making this happen!

4 Likes

Interesting. I’ll have to ping him.

I just tried to install my package KiteModels using julia that I installed with pixi. I get a lot of these warnings:

┌ LinearSolve → LinearSolveRecursiveArrayToolsExt
│  ┌ Warning: CHOLMOD version incompatibility
│  │ 
│  │ Julia was compiled with CHOLMOD version 4.0.4. It is
│  │ currently linked with version 5.2.1.
│  │ This might cause Julia to terminate when working with
│  │ sparse matrix factorizations, e.g. solving systems of
│  │ equations with \.
│  │ 
│  │ It is recommended that you use Julia with the same major
│  │ version of CHOLMOD as the one used during the build, or
│  │ download the generic binaries from www.julialang.org,
│  │ which ship with the correct versions of all dependencies.
│  └ @ SparseArrays.CHOLMOD ~/repos/pykitesim/.pixi/envs/default/share/julia/stdlib/v1.10/SparseArrays/src/solvers/cholmod.jl:206

Any idea?

UPDATE:
For now I conclude that installing Julia using pixi is a bad idea because it installs incompatible libraries.

I will continue to use pixi to install Python and the Python libraries and juliaup to install Julia.

1 Like

Can you share your pixi.toml and pixi.lock file?

@ufechner7 thanks for trying! I would also be interested in which julia you installed (the one linked above, e.g. repackaged, or the one built on conda-forge)?

Indeed, the main challenge is different dynamic libraries (which is something that conda-forge tries to solve globally).

1 Like

Reproducable test case:

pixi init jtest
cd jtest
pixi project channel add https://repo.prefix.dev/julia-forge
pixi add julia
pixi shell

(jtest) ufechner@framework:~/repos/jtest$ which julia
/home/ufechner/repos/jtest/.pixi/envs/default/bin/julia

julia --project="."
using Pkg
Pkg.add("KiteModels")

Output (well, these massages repeat again and again):

┌ StaticArrayInterface → StaticArrayInterfaceStaticArraysExt
│  ┌ Warning: CHOLMOD version incompatibility
│  │ 
│  │ Julia was compiled with CHOLMOD version 4.0.4. It is
│  │ currently linked with version 5.2.1.
│  │ This might cause Julia to terminate when working with
│  │ sparse matrix factorizations, e.g. solving systems of
│  │ equations with \.
│  │ 
│  │ It is recommended that you use Julia with the same major
│  │ version of CHOLMOD as the one used during the build, or
│  │ download the generic binaries from www.julialang.org,
│  │ which ship with the correct versions of all dependencies.
│  └ @ SparseArrays.CHOLMOD ~/repos/jtest/.pixi/envs/default/share/julia/stdlib/v1.10/SparseArrays/src/solvers/cholmod.jl:206
└  
┌ Distances → DistancesChainRulesCoreExt
│  ┌ Warning: CHOLMOD version incompatibility
│  │ 
│  │ Julia was compiled with CHOLMOD version 4.0.4. It is
│  │ currently linked with version 5.2.1.
│  │ This might cause Julia to terminate when working with
│  │ sparse matrix factorizations, e.g. solving systems of
│  │ equations with \.
│  │ 
│  │ It is recommended that you use Julia with the same major
│  │ version of CHOLMOD as the one used during the build, or
│  │ download the generic binaries from www.julialang.org,
│  │ which ship with the correct versions of all dependencies.
│  └ @ SparseArrays.CHOLMOD ~/repos/jtest/.pixi/envs/default/share/julia/stdlib/v1.10/SparseArrays/src/solvers/cholmod.jl:206
└  

pixi.toml:

(jtest) ufechner@framework:~/repos/jtest$ cat pixi.toml 
[project]
name = "jtest"
version = "0.1.0"
description = "Add a short description here"
authors = ["Uwe Fechner <u.fechner-1@tudelft.nl>"]
channels = ["conda-forge", "https://repo.prefix.dev/julia-forge/"]
platforms = ["linux-64"]

[tasks]

[dependencies]
julia = ">=1.10.4,<1.11

pixi.lock file is attached. I added the ending .jl to become able to attach it.
pixi.lock.jl (30.3 KB)

Hi @ufechner7 - I think you are getting the build of julia from conda-forge. If you change the order of channels you should get the one from julia-forge.

You can validate that by checking the pixi.lock file (I checked the one you attached and it’s indeed the case).

I changed the order of the channels, but I a get a new error:

(jtest) pkg> add KiteModels
┌ Warning: could not download https://pkg.julialang.org/registries
│   exception = RequestError: Error reading ca cert file /home/ufechner/repos/jtest/.pixi/envs/default/ssl/cacert.pem - mbedTLS: (-0x3E00) PK - Read/write of file failed while requesting https://pkg.julialang.org/registries
└ @ Pkg.Registry ~/repos/jtest/.pixi/envs/default/share/julia/stdlib/v1.10/Pkg/src/Registry/Registry.jl:69

With juliaup, add LinearSolve and precompile doesn’t give any errors:

But with pixi, precompile segfaults:

I don’t quite understand why that makes any difference?

The pixi version of julia gets the julia binary from here and juliaup gets it from here, which appear to be the same locations (juliaup downloads from julialang-s3.julialang.org as well).

It seems like julia doesn’t like being in the same folder as other content from pixi.

If I use curl to download the same file as pixi does, I don’t get any issues:

But using the julia binary in the .pixi environment causes issues:

I tried with a fresh environment with just julia and I still get the same error precompiling LinearSolve:

$ cat pixi.toml
───────┬────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
       │ File: pixi.toml
───────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
   1   │ [project]
   2   │ name = "pixi-test"
   3   │ version = "0.1.0"
   4   │ description = "Add a short description here"
   5   │ authors = ["..."]
   6   │ channels = ["conda-forge", "https://repo.prefix.dev/julia-forge/"]
   7   │ platforms = ["osx-arm64"]
   8   │
   9   │ [tasks]
  10   │
  11   │ [dependencies]
  12   │ julia = ">=1.10.4,<1.11"
───────┴────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
1 Like

Does pixi put the content of different packages within the same prefix?

1 Like

It seems like it puts everything into ./.pixi/envs/default/.

$ ls -al .pixi/envs/default
Permissions Size Date Modified Git Name
drwxr-xr-x     - 26 Jun 20:30   -I ./
drwxr-xr-x     - 26 Jun 20:30   -I ../
drwxr-xr-x     - 26 Jun 20:30   -I bin/
drwxr-xr-x     - 26 Jun 20:30   -I conda-meta/
drwxr-xr-x     - 26 Jun 20:30   -I etc/
drwxr-xr-x     - 26 Jun 20:30   -I include/
drwxr-xr-x     - 26 Jun 20:30   -I lib/
drwxr-xr-x     - 26 Jun 20:30   -I libexec/
drwxr-xr-x     - 26 Jun 20:30   -I share/
.rw-r--r--  4.0k 26 Jun 20:30   -I build_env.sh
.rw-r--r--   302 24 Jun 03:23   -I conda_build.sh

╭─ ~/g/pixi-test 
╰ ls -al .pixi/envs/default/bin
Permissions Size Date Modified Git Name
drwxr-xr-x     - 26 Jun 20:30   -I ./
drwxr-xr-x     - 26 Jun 20:30   -I ../
.rwxr-xr-x   70k 24 Jun 03:23   -I julia*

╭─ ~/g/pixi-test 
╰ ls -al .pixi/envs/default/lib
Permissions Size Date Modified Git Name
drwxr-xr-x     - 26 Jun 20:30   -I ./
drwxr-xr-x     - 26 Jun 20:30   -I ../
drwxr-xr-x     - 26 Jun 20:30   -I julia/
drwxr-xr-x     - 26 Jun 20:30   -I libjulia.1.10.4.dylib.dSYM/
.rwxr-xr-x  235k 24 Jun 03:23   -I libjulia.1.10.4.dylib*
.rwxr-xr-x  235k 24 Jun 03:23   -I libjulia.1.10.dylib*
.rwxr-xr-x  235k 24 Jun 03:23   -I libjulia.dylib*

Here’s the full contents of the .pixi folder with just one dependency julia: julia-pixi.md · GitHub

I’m surprised that this works:

curl -L https://julialang-s3.julialang.org/bin/mac/aarch64/1.10/julia-1.10.4-macaarch64.tar.gz -o julia.tar.gz && \
tar -xzf julia.tar.gz && \
./julia-1.10.4/bin/julia --project -e "using Pkg; Pkg.precompile()" && \
echo "success"

But this doesn’t:

pixi init && \
pixi project channel add https://repo.prefix.dev/julia-forge && \
pixi add julia && \
./.pixi/envs/default/bin/julia --project -e "using Pkg; Pkg.precompile()"

Here’s what I get as the diff between these two folders

╭─ ~/g/pixi-test
╰ diff -qr .pixi/envs/default julia-1.10.4

Only in julia-1.10.4: LICENSE.md
Only in .pixi/envs/default: build_env.sh
Only in .pixi/envs/default: conda-meta
Only in .pixi/envs/default: conda_build.sh
Only in julia-1.10.4/share/julia/base: .gitignore
Only in julia-1.10.4/share/julia/base/JuliaSyntax: .github
Only in julia-1.10.4/share/julia/base/JuliaSyntax: .gitignore
Only in julia-1.10.4/share/julia/base/JuliaSyntax/sysimage: .gitignore
Only in julia-1.10.4/share/julia/stdlib/v1.10/ArgTools: .github
Only in julia-1.10.4/share/julia/stdlib/v1.10/ArgTools: .gitignore
Only in julia-1.10.4/share/julia/stdlib/v1.10/DelimitedFiles: .github
Only in julia-1.10.4/share/julia/stdlib/v1.10/Downloads: .github
Only in julia-1.10.4/share/julia/stdlib/v1.10/Downloads: .gitignore
Only in julia-1.10.4/share/julia/stdlib/v1.10/LibCURL: .github
Only in julia-1.10.4/share/julia/stdlib/v1.10/LibCURL: .gitignore
Only in julia-1.10.4/share/julia/stdlib/v1.10/NetworkOptions: .github
Only in julia-1.10.4/share/julia/stdlib/v1.10/NetworkOptions: .gitignore
Only in julia-1.10.4/share/julia/stdlib/v1.10/Pkg: .github
Only in julia-1.10.4/share/julia/stdlib/v1.10/Pkg: .gitignore
Only in julia-1.10.4/share/julia/stdlib/v1.10/Pkg/test/test_packages/BigProject: .gitignore
Only in julia-1.10.4/share/julia/stdlib/v1.10/Pkg/test/test_packages/BigProject/SubModule: .gitignore
Only in julia-1.10.4/share/julia/stdlib/v1.10/Pkg/test/test_packages/BigProject/SubModule2: .gitignore
Only in julia-1.10.4/share/julia/stdlib/v1.10/Pkg/test/test_packages/BuildProjectFixedDeps: .gitignore
Only in julia-1.10.4/share/julia/stdlib/v1.10/Pkg/test/test_packages/force_latest_compatible_version/BothOl
dAndNew: .gitignore
Only in julia-1.10.4/share/julia/stdlib/v1.10/Pkg/test/test_packages/force_latest_compatible_version/Direct
DepWithoutCompatEntry: .gitignore
Only in julia-1.10.4/share/julia/stdlib/v1.10/Pkg/test/test_packages/force_latest_compatible_version/NewOnl
y: .gitignore
Only in julia-1.10.4/share/julia/stdlib/v1.10/Pkg/test/test_packages/force_latest_compatible_version/OldOnly1: .gitignore
Only in julia-1.10.4/share/julia/stdlib/v1.10/Pkg/test/test_packages/force_latest_compatible_version/OldOnly2: .gitignore
Only in julia-1.10.4/share/julia/stdlib/v1.10/SHA: .github
Only in julia-1.10.4/share/julia/stdlib/v1.10/SHA: .gitignore
Only in julia-1.10.4/share/julia/stdlib/v1.10/SHA/docs: .gitignore
Only in julia-1.10.4/share/julia/stdlib/v1.10/SparseArrays: .github
Only in julia-1.10.4/share/julia/stdlib/v1.10/Statistics: .github
Only in julia-1.10.4/share/julia/stdlib/v1.10/SuiteSparse: .github
Only in julia-1.10.4/share/julia/stdlib/v1.10/TOML: .gitignore
Only in julia-1.10.4/share/julia/stdlib/v1.10/Tar: .github
Only in julia-1.10.4/share/julia/stdlib/v1.10/Tar: .gitignore
Only in julia-1.10.4/share/julia/test: .gitignore
Only in julia-1.10.4/share/julia/test/clangsa: .gitignore
Only in julia-1.10.4/share/julia/test/embedding: .gitignore
Only in julia-1.10.4/share/julia/test/gcext: .gitignore
Only in julia-1.10.4/share/julia/test/llvmpasses: .gitignore

What is the full output of versioninfo()?

Are there any environment variables that may be affecting Julia such as LD_LIBRARY_PATH?

There doesn’t seem to be any differences in versioninfo(;verbose=true)

I’ve activated the environment using direnv, so the same environment variables are active for both julia versions, and it still errors only for the pixi version.

I don’t see any LD_LIBRARY_PATH modifications that seem unusual in the .pixi folder:

$ rg LD_LIBRARY_PATH .pixi

.pixi/envs/default/share/doc/julia/html/en/devdocs/build/linux.html
6:</script><script data-outdated-warner src="../../assets/warner.js"></script><link href="https://cdnjs.cloudflare.com/ajax/libs/lato-font/3.0.0/css/lato-font.min.css" rel="stylesheet" type="text/css"/><link href="ht
tp [... 1 more match]

.pixi/envs/default/share/doc/julia/html/en/devdocs/build/macos.html
6:</script><script data-outdated-warner src="../../assets/warner.js"></script><link href="https://cdnjs.cloudflare.com/ajax/libs/lato-font/3.0.0/css/lato-font.min.css" rel="stylesheet" type="text/css"/><link href="http [... 2 more matches]

.pixi/envs/default/share/julia/test/clangsa/Makefile
14:LD_LIBRARY_PATH="${build_libdir}:$$LD_LIBRARY_PATH" \

.pixi/envs/default/share/julia/test/llvmpasses/Makefile
14:LD_LIBRARY_PATH=${build_libdir}:$$LD_LIBRARY_PATH \
22:LD_LIBRARY_PATH=${build_libdir}:$$LD_LIBRARY_PATH \
29:LD_LIBRARY_PATH=${build_libdir}:$$LD_LIBRARY_PATH \

.pixi/envs/default/share/doc/julia/html/en/search_index.js
2:[{"location":"stdlib/CRC32c.html","page":"CRC32c","title":"CRC32c","text":"EditURL = \"https://github.com/JuliaLang/julia/blob/master/stdlib/CRC32c/docs/src/index.md\"","category":"page"},{"location":"stdlib/CRC32c.h [... 3 more matches]

.pixi/envs/default/share/julia/base/linking.jl
26:const LIBPATH_env = "LD_LIBRARY_PATH"

.pixi/envs/default/share/julia/stdlib/v1.10/LLD_jll/src/LLD_jll.jl
34:const LIBPATH_env = "LD_LIBRARY_PATH"

.pixi/envs/default/share/julia/stdlib/v1.10/Downloads/src/Curl/utils.jl
44:2. You are overriding the library load path by setting `LD_LIBRARY_PATH`, in which case you are in advanced usage territory. You can try upgrading the system libcurl, unsetting `LD_LIBRARY_PATH`, or otherwise arrangi [... 0 more matches]

.pixi/envs/default/share/julia/stdlib/v1.10/p7zip_jll/src/p7zip_jll.jl
33:const LIBPATH_env = "LD_LIBRARY_PATH"

I even tried removing these files:

$ rm -rf .pixi/envs/default/build_env.sh 
$ rm -rf .pixi/envs/default/conda-meta 
$ rm -rf .pixi/envs/default/conda_build.sh

I don’t know exactly how pixi works, but these were the only files that had a lot of environment variables, and thought I’d try to delete them. But I still get an error:

╭─ ~/g/pixi-test 
╰ rm -rf .pixi/envs/default/build_env.sh .pixi/envs/default/conda-meta .pixi/envs/default/conda_build.sh

╭─ ~/g/pixi-test 
╰ ./.pixi/envs/default/bin/julia --project -e "using Pkg; Pkg.precompile()"
Precompiling project...
  ✗ LinearSolve
  ✗ LinearSolve → LinearSolveRecursiveArrayToolsExt
  0 dependencies successfully precompiled in 15 seconds. 92 already precompiled.