Open HealthyPear opened 1 month ago
Thanks for the report, @HealthyPear . It's possible that some extra setup is required off screen rendering on a mac -- I'll check it out later today on my laptop, will let you know what I find!
Ok, so on the yt_idv side, I do think there's an issue with how environment variables are being set (this issue actually). Before importing yt_idv, you'll need to set PYOPENGL_PLATFORM='egl'
. You can do this as an environment variable from your shell (e.g., export PYOPENGL_PLATFORM='egl'
) before starting your python session or from within your python session/script, just make sure it happens before all other imports:
import os
os.environ['PYOPENGL_PLATFORM'] = 'egl'
import yt_idv
# etc..
If you've not separately installed any EGL-related libraries, you'll get a new error related to EGL not being found. For headless rendering, you'll need to separately install EGL or osmesa. We do need some improved documentation for this in yt_idv (at a minimum describing the requirements for headless rendering that yt_idv does not install for you). Unfortunately I don't yet have good instructions for you on a mac (working on it.... hopefully soon...). On my linux machines, I usually install the required packages as system level installs: for osmesa on ubuntu it's just sudo apt-get install libosmesa6-dev
, for egl I follow these instructions. On a mac things don't seem quite as straightforward so far. There is a brew recipe for the mesa libraries that installed OK for me but i haven't yet got it working with yt_idv. I also just noticed the mesalib conda package that may also work but I haven't tested it yet. In any case, I'll update here if I actually get the headless rendering working on a mac.
Well one update! With the mesalib conda package it's very easy to setup osmesa headless rendering:
conda create --name yt_idv_mac python=3.10
conda activate yt_idv_mac
conda install mesalib
pip install yt_idv yt[enzo] pooch h5py
export PYOPENGL_PLATFORM='osmesa'
python amr_osmesa.py
no luck with egl yet.
Description
Off-screen Volume Rendering example on macos 14.7
What I Did
just ran the example then got
same with "cgl"