conjure-cp / conjure-notebook

3 stars 2 forks source link

Installer for macos #39

Open mocher72 opened 7 months ago

mocher72 commented 7 months ago

I downloaded the zip and unzipped it locally but found setting visibility difficult to do so that the jupyter notabokk could us the conjure plugin.

I modified the linux install shell script to work for macos. I tested this on my Sonoma install and it seems to work.

There are still issues with having to set the run permissions due to security, which you have to do for each executable but that is another issue, maybe this could be sandboxed somehow.

I have pasted the shell script here.

#!/bin/bash

set -o errexit
set -o nounset

CONJURE_VERSION=v2.5.1
NOTEBOOK_VERSION=main

echo "Installing Conjure version ${CONJURE_VERSION} and Conjure Notebook version ${NOTEBOOK_VERSION}..."

# remove the sample-data directory that google colab creates, we don't need them
# rm -rf sample_data

conjure_installed=$((conjure --version 2> /dev/null) | head -n2 | tail -n1)

if [[ $conjure_installed == "Release version 2.5.1" ]]; then
    echo "Conjure is already installed."
else
    echo "Downloading..."
    # download the release from Github
    wget --quiet --no-check-certificate -c https://github.com/conjure-cp/conjure/releases/download/${CONJURE_VERSION}/conjure-${CONJURE_VERSION}-macos-arm-with-solvers.zip
    unzip -q -o conjure-${CONJURE_VERSION}-macos-arm-with-solvers.zip
    cp -r conjure-${CONJURE_VERSION}-macos-arm-with-solvers/* /usr/local/bin

    # we don't need to keep these around any more
    rm -rf conjure-${CONJURE_VERSION}-macos-arm-with-solvers conjure-${CONJURE_VERSION}-macos-arm-with-solvers.zip
fi

conjure_notebook_installed=$(pip freeze | grep Conjure-Notebook | wc -l)

if [[ $conjure_notebook_installed == "1" ]]; then
    echo "Conjure notebook is already installed."
else
    # installing the conjure extension
    pip --quiet install git+https://github.com/conjure-cp/conjure-notebook.git@${NOTEBOOK_VERSION} > /dev/null
fi

conjure --version
ozgurakgun commented 7 months ago

Thanks for this!

Alternative would be docker/podman.

Something like the following should work out of the box for example: podman run -it --rm --network=none ghcr.io/conjure-cp/conjure:v2.5.1 conjure --help