-
Notifications
You must be signed in to change notification settings - Fork 215
/
Apptainer.def
55 lines (42 loc) · 1.42 KB
/
Apptainer.def
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# Build an Apptainer SIF file containing a working copy of PySR and its prereqs
Bootstrap: docker
From: julia:1.10.4-bullseye
Stage: jl
Bootstrap: docker
From: python:3.12-bullseye
Stage: runtime
%environment
# Use the container Julia binary
export PATH="/usr/local/julia/bin:$PATH"
# Create a stacked environment for additional Julia packages
export JULIA_DEPOT_PATH="$HOME/.pysr:/pysr/depot:$JULIA_DEPOT_PATH"
export JULIA_LOAD_PATH="$HOME/.pysr:/pysr:$JULIA_LOAD_PATH"
%files from jl
/usr/local/julia /usr/local/julia
%files
./requirements.txt /pysr/requirements.txt
./pyproject.toml /pysr/pyproject.toml
./setup.py /pysr/setup.py
./pysr /pysr/pysr
%post
# Ensure we don't use the local pysr commands:
cd $(mktemp -d)
export PATH="/usr/local/julia/bin:$PATH"
# Install IPython and other useful libraries:
pip3 install --no-cache-dir ipython matplotlib pytest nbval
# Install PySR and requirements:
pip3 install --no-cache-dir /pysr
# Put the Julia dependencies in /pysr/depot
mkdir /pysr/depot
export JULIA_DEPOT_PATH="/pysr/depot"
# And set a specific environment for Julia dependencies
mkdir /pysr/env
export PYTHON_JULIAPKG_PROJECT="/pysr/env"
# Pull in all the Julia dependencies
python3 -c 'import pysr; pysr.load_all_packages()'
%test
python3 -m pysr test main,cli,startup
%runscript
# Start ipython when the container is executed
[ ! -d $HOME/.pysr ] && mkdir $HOME/.pysr
PYTHONPATH=/pysr ipython