This is supporting content for the video tutorial: Cross Platform Mojo App with Conda, PyTorch and Matplotlib
Latest working version: 24.01
If you don't have conda
, install miniconda here
Create and activate conda environment:
conda env create -f environment.yaml
conda activate mojo-plotter
To automatically set Mojo to use the python environment when you activate it:
mkdir -p $CONDA_PREFIX/etc/conda/activate.d
export MOJO_PYTHON_LIBRARY="$(find $CONDA_PREFIX/lib -iname 'libpython*.[s,d]*' | sort -r | head -n 1)"
echo "export MOJO_PYTHON_LIBRARY=\"$MOJO_PYTHON_LIBRARY\"" > $CONDA_PREFIX/etc/conda/activate.d/export-mojo.sh
mkdir -p $CONDA_PREFIX/etc/conda/deactivate.d
echo "unset MOJO_PYTHON_LIBRARY" > $CONDA_PREFIX/etc/conda/deactivate.d/unset-mojo.sh
Simply activate the environment and run the program:
conda activate mojo-plotter
mojo main.mojo