Installation
aseview needs Python 3.11 or newer.
This is enough for saved HTML and the CLI. Optional extras add more:
| Extra | Adds | Install |
|---|---|---|
md |
Separate MD topology and coordinate files through MDAnalysis | pip install "aseview[md]" |
notebook |
Jupyter and widgets | pip install "aseview[notebook]" |
surface |
SurfaceViewer for CUBE/CHGCAR isosurfaces (installs cvve and marching cubes) |
pip install "aseview[surface]" |
export |
save_png() / save_gif() from Python (headless Chromium through Playwright) |
pip install "aseview[export]" then python -m playwright install chromium |
Note
The export extra pins Playwright below 1.15 so it also runs on CentOS
7 (glibc 2.17). PNG and GIF export from the viewer toolbar needs no extra.
For Python 3.10, install the last compatible release: pip install "aseview<0.0.14".
Upgrading from 0.0.x? See Migrating to 1.0.
Native PNG without Chromium
The native backend renders inside the server. It shares the web viewer's Three.js scene, geometry, material shaders, lighting, camera, colormaps and image-export path. HTML viewers and the default browser PNG/GIF backend remain available.
Install Node.js 18.18+ and npm for your operating system, then:
from ase.build import molecule
from aseview import MolecularViewer
MolecularViewer(molecule("H2O"), style="cinematic").save_png(
"water.png", backend="native", width=800, height=600, scale=2,
)
The runtime is optional and installed in your user cache, without changing
system packages. Export never downloads dependencies. Set
ASEVIEW_NATIVE_MODULE_DIR (or native_module_dir=) for a custom installation;
node_executable_path= selects a Node executable.
On Linux the renderer needs EGL and OpenGL ES 3.0 or newer, from a GPU driver
or software Mesa. LIBGL_ALWAYS_SOFTWARE=1 EGL_PLATFORM=surfaceless enables
headless CPU rendering with a compatible system Mesa. The presence of
libEGL.so alone does not guarantee ES 3.0 support.
On CentOS 7 / glibc 2.17, the installer automatically uses Cairo instead of Skia (Skia requires glibc 2.18), builds private Mesa 22.3.6 with softpipe and rebuilds the small EGL addon for the host's C++ ABI. Build requirements are a C++17 compiler, Python with pip, pkg-config, Cairo/Pango, zlib and expat headers, and flex/bison. A glibc 2.17-compatible Node binary is also required. No LLVM, Chromium, Xvfb, GPU or root install is needed by this private Mesa path.
# Explicit settings; --jobs limits compiler concurrency.
python -m aseview.native install --canvas cairo --software-mesa yes --jobs 4
--software-mesa no reuses a compatible system driver. CPU software rendering
can be slower than a GPU. Native width and height refer to the canvas,
whereas the browser backend sizes the whole page, including any sidebar.
Independent drivers, font libraries and Canvas implementations can produce
small differences in pixels and antialiasing. The Cairo adapter rejects
show_blur=True because it lacks Canvas filters; the Skia and browser paths
support blur. GIF export currently uses the browser backend.
Check the install
Development
git clone https://github.com/kangmg/aseview.git
cd aseview
python3 scripts/run_locked_verification.py python -m pytest tests/test_imports.py -q
Checks run through the committed hash-locked verification runner rather than an editable checkout install. To validate documentation changes (this regenerates the embedded viewers and runs a strict MkDocs build):