Troubleshooting
Common issues and quick fixes
Installation & Environment
ModuleNotFoundError: devito
Devito is installed automatically when you run python -m pip install -e ., but you still need to set the compiler environment variables described on the home page. Ensure the DEVITO_* variables are exported before running examples.
Devito compilation fails on macOS
Use the LLVM toolchain from Homebrew and make sure OMP_NUM_THREADS is set. Double-check that /opt/homebrew/opt/llvm/bin appears before /usr/bin in PATH.
Data Loading
“No SEG-Y files found”
- When calling
Dataset.from_segy, pass the directory containing the SEG-Y files, or one.segy/.sgyfile. A wildcard is not a path it can resolve:Dataset.from_segy("data/*.sgy")raises this very error. - A directory is scanned for
*.segy, and for*.sgywhen it holds no.segy, so both extensions work without saying which.
Shot indices are wrong / geometries swapped
Call dataset.discover_shots() to inspect the order DevitoHorizon detected. You can also pass an explicit list to Dataset(..., shot_ids=[0, 5, 10]).
Physics / Gradient Issues
Datum muting does nothing
Check that gradient={"mute": {"type": "datum"}} is passed to DevitoPhysics. The automatic surface estimator only runs after the first few calls to compute_shot_gradient, so make sure you are not re-instantiating the physics object between shots.
Gradients explode near the surface
Reduce the cone angle ("cone_angle": 55.0) or add a taper below the datum ("taper_width": 300.0). These settings live inside the gradient dictionary.
Misfit is zero but gradients non-zero
Ensure the preprocessing configuration is applied to both the dataset and the physics object. If only one side has the filter, the misfit still compares unfiltered data and the reported value will not match the gradient.
Optimisation
SPG stops after one iteration
Check the stopping tolerances. If your misfit is already near zero, the default ftol=1e-6 may trigger early. Increase maxiter and/or reduce ftol.
SPG fails with “bounds missing key”
Bounds are per-parameter. Provide entries for every active parameter or omit the dict entirely. Example:
bounds = {'vp': (1.4, 5.0), 'epsilon': (0.0, 0.3)}
optimizer.fwi(..., bounds=bounds)Want SciPy back?
Call physics.objective(batch, model) inside your SciPy callback. Gradient dictionaries map nicely onto flattened arrays; see the examples for a minimal manual loop.
Dask / cloud
For what has to exist in the account before any of this runs — credentials, registry, permissions, networking — see Cloud Setup.
Reaching the dask dashboard from your own machine
The scheduler logs an address on the instance’s private network:
dashboard at: http://172.31.12.65:8787/status
which is not reachable from anywhere else, and the tls://… addresses in the log are worker connections rather than the dashboard. Forward the port instead:
ssh -i <key.pem> -N -L 8787:localhost:8787 ubuntu@<instance public DNS>
and open http://localhost:8787/status. The dashboard listens on all interfaces and the containers run with host networking, so the tunnel reaches it without anything else being opened up.
A tunnel rather than opening 8787 in the security group: the dashboard carries no authentication, and the run’s state would be readable by anyone who found the address.
Workers killed by signal 11 (or 6) with no traceback
A worker that dies this way has died inside compiled C, where a Python traceback cannot be raised. The usual cause is the instance running out of local disk part-way through the forward.
The adjoint reads the forward wavefield back, so the forward serializes a compressed snapshot every t_sub steps to the instance’s own disk, two fields for an anisotropic recipe. That is not a small number: a 364x327x256 grid over 2205 steps at t_sub=5 writes 68 GB for one shot. The writer sits in the kernel and nothing checks the write, so filling the volume gives a glibc abort (munmap_chunk(): invalid pointer) or a segfault rather than ENOSPC.
Two things address it, and both are the default now:
ec2_clustersizes the root volume fromWORKER_DISK_GB(300 GB), not dask-cloudprovider’s 40 GB. Passfilesystem_sizeto raise it for a bigger model or a longer record.- Each shot’s snapshots are dropped when the shot ends, however it ends. Without that the directory grows by a whole wavefield per shot and a worker fills any volume eventually.
Tells that it is this and not something else: only shots that save a wavefield die, a forward-only pass over the same model is fine, and the gradient never appears in the log because no shot ever reaches the adjoint.
Those tells are necessary, not sufficient. They are equally true of a worker that dies at the start of a saving forward, before it could have written anything, and a volume with room to spare does not rule the symptom out. The confirmation is a worker log carrying the OSError(28) at compressed.py:_arg_apply, or a df on the instance.
PYTHONFAULTHANDLER=1 is set on cloud workers so the interpreter dumps the Python stack on the way down; the frame it names is where to start.
pickle errors when submitting DevitoPhysics
A physics object is not sent to workers as itself. worker_config() describes it — module, class name and a stripped state — and each worker rebuilds one from that, so Devito’s non-picklable state never crosses the wire. If you hit a pickling error, something you attached to the physics is travelling in that state: a live client, an open file handle, a compiled operator.
Client and cluster disagree on the dask stack
The symptom is rarely a clean error: an unpickling TypeError deep in a worker, a hung handshake, or a task that silently never runs. Horizon pins the stack in pyproject.toml, and the worker image is built from those same pins, so installing horizon gives a client that matches an image built from the same commit:
from devitohorizon.cloud import check_cluster_versions
check_cluster_versions(client) # right after Client(cluster)azure_vm_cluster and ec2_cluster run the local half of this before provisioning anything, so a mismatch costs a traceback rather than a booted cluster you cannot talk to. A differing Python minor is reported but not fatal — pip cannot fix it, and it only breaks a task that pickles a closure by value.
Blob or S3 authentication failures
Set creds when building your dataset and your model specification:
creds = json.load(open("azure_creds.json"))
dataset = Dataset.from_segy("az://container/shots", creds=creds)Ensure the storage account key has “Blob Data Reader” permissions.
Give the model its credentials too, as part of the specification rather than beside it:
physics = DevitoPhysics(..., model={'model': {'vp': 'vp.sgy'},
'container_name': container,
'creds': creds})That is what tells a run it has storage every node can reach. Without it the staged model, the compiled operators and the immersed-boundary index maps go to a local directory, which is correct on a shared filesystem and invisible to a cloud worker. Only the storage keys are forwarded to workers; the provisioning and registry fields stay on the client.
On S3 the same credentials are read from aws_creds.json and used the same way. The one difference is that they may be empty: a node running under an IAM instance profile finds its own, and only has to be told which store the paths are on.
creds = {"provider": "s3"} # boto3 finds the credentials itself
dataset = Dataset.from_segy("s3://bucket/shots", creds=creds)Written out by scripts/make_aws_creds.sh, which fills in the bucket, region and the networking ec2_cluster needs alongside it. If a run configured this way writes to the driver’s own disk instead, the credentials reached it empty — {} means the local filesystem, and {"provider": "s3"} is what distinguishes “on S3, credentials ambient” from “no store at all”.
No immersed-boundary index maps at ...
The maps are built once on the full model by prebuild_operators and read by every shot. The message names where it looked: a path under output_dir for a run on a shared filesystem, or a key on the model’s storage for one with credentials. Getting it means the two halves disagreed — most often a model specification without creds, so the prebuild wrote locally and the workers looked in the store.