Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,31 @@ Here are the steps to check out, build, and test the OSL distribution:

make test

Conda Environment
-----------------

To simplify installation of Python and other dependencies, you can use
the provided Conda environment setup script located at `src/build-scripts/`
by running:

source src/build-scripts/configure_conda_env.bash

**This script will:**
* Check for Miniconda installation.
* Create a Conda environment named `osl-env` if it doesn't exist.
* Install all required dependencies into the environment.
* Activate the environment for the current shell session.

After running this script, the `osl-env` environment will be created, and
all you need to do when opening a new shell session is simply activate the
Conda environment.

**When to use it:**
Run this script after cloning the repository and before building OSL. It
sets up a consistent development environment without manually installing
all dependencies. If you already have all required dependencies installed,
running it is optional.

Troubleshooting
----------------

Expand Down
55 changes: 55 additions & 0 deletions src/build-scripts/configure_conda_env.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#!/bin/bash

# Copyright Contributors to the Open Shading Language project.
# SPDX-License-Identifier: BSD-3-Clause
# https://github.com/AcademySoftwareFoundation/OpenShadingLanguage

# --- Colors ---
RED='\033[0;31m'
YELLOW='\033[1;33m'
GREEN='\033[0;32m'
NC='\033[0m' # No Color


# --- Check if the script is sourced ---
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
echo -e "${YELLOW}Please run this script as:"
echo -e " ${NC}source $(basename "${BASH_SOURCE[0]}")"
echo -e "Otherwise, '${YELLOW}conda activate${NC}' won't persist in your current shell."
return 0 2>/dev/null || exit 0
fi

# --- Check if Miniconda exists ---
if [ ! -f "$HOME/miniconda3/etc/profile.d/conda.sh" ]; then
echo -e "${RED}Miniconda not found at ~/miniconda3.${NC}"
echo -e "Please install Miniconda before running this script"
echo -e "${YELLOW}Important:${NC} During installation, decline any PATH modifications."
echo -e "This script activates the environment per session using 'source'."
return 0 2>/dev/null || exit 0
else
# Load Conda
source ~/miniconda3/etc/profile.d/conda.sh

# Create OSL environment if it doesn't exist
if ! conda info --envs | grep -q "osl-env"; then
echo "Creating osl-env Conda environment..."
conda create -y -n osl-env

# Activate the environment
conda activate osl-env

# Install dependencies
echo "Installing dependencies in osl-env..."
conda install -y -c conda-forge \
cmake \
llvmdev=20.1.8 clangdev clangxx_linux-64 libcxx \
python=3.12 numpy pybind11 \
openimageio=2.5 imath flex bison pugixml zlib
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's pretty old. Can we use at least OpenImageIO 3.0 by default?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like conda-forge has up to v2.5.18.0 sadly :/
https://anaconda.org/conda-forge/openimageio

Maybe mamba could be an alternative?
https://openmamba.org/en/rpms/base/python-OpenImageIO/aarch64/

Copy link
Contributor Author

@bisqottii bisqottii Sep 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What we could do is, download from the OpenImageIO repo binaries and install them directly

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The OpenImageIO repo does not currently provide pre-built binaries.

However, this OSL repo already has a src/build-scripts/build_openimageio.bash that can build OIIO from scratch.

else
echo -e "${GREEN}osl-env environment already exists.${NC}"

# Activate the environment
conda activate osl-env
fi

fi
Loading