Skip to content

Instantly share code, notes, and snippets.

@nijave
Created October 31, 2020 16:10
Show Gist options
  • Save nijave/83966542f9197e3bfadebcee506b3ca4 to your computer and use it in GitHub Desktop.
Save nijave/83966542f9197e3bfadebcee506b3ca4 to your computer and use it in GitHub Desktop.
Compile code required for Jupyter on FreeBSD (jupyter on opnsense)
# Set up a jail
iocage create -r 12.1-RELEASE -n wheelhouse
iocage set dhcp=on bpf=on vnet=on wheelhouse
iocage start wheelhouse
# Build some wheels inside the jail
iocage console wheelhouse
env ASSUME_ALWAYS_YES=yes pkg update
pkg install -y python38 libzmq4 bash
bash --login
python3.8 -m ensurepip --user
export PATH=/root/.local/bin:$PATH
ln -s `which python3.8` /root/.local/bin/python3
mkdir -p ~/.local/src
cd ~/.local/src
pip3 install -U --user pip setuptools wheel
pip download jupyter
pip download flit flit_core
for m in *.tar.gz; do
tar xf $m
done
for m in $(find . -type d -mindepth 1 -maxdepth 1); do
pushd $m 1>/dev/null
if [[ $(find . -name "*.whl" | wc -l) -lt 1 ]]; then
echo $m
pip wheel .
fi
popd 1>/dev/null
done
find . -name "*.whl" -exec mv {} . \;
pip install --no-index -f ./ $(find . -name "*.whl")
exit
# Install using the fils from the jail
mkdir -p /mnt/primary/.local/lib
cd /mnt/primary/iocage/jails/wheelhouse/root
cp ./usr/local/lib/libzmq.so.5 /mnt/primary/.local/lib
cp ./usr/local/lib/libpgm-5.2.so.0 /mnt/primary/.local/lib
cp ./usr/local/lib/libnorm.so.1 /mnt/primary/.local/lib
pip3 install --user -f root/.local/src jupyter
cd /mnt/primary/.local/bin
env LD_LIBRARY_PATH=/mnt/primary/.local/lib /root/.local/bin/jupyter notebook --allow-root --port=8889
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment