pip install -U ovito
For further information, please refer to https://pypi.org/project/ovito/.
If you work with an Anaconda or Miniconda environment, you should use the following conda install command line:
conda install --strict-channel-priority -c https://conda.ovito.org -c conda-forge ovito=3
ovito conda package is hosted in our conda channel https://conda.ovito.org. It can easily be confused with
the ovito package found in the popular conda-forge channel.
The latter includes only OVITO Basic but not the Python module. To make sure you’ve installed the right package version,
run conda list and check if the source channel of the installed package is https://conda.ovito.org and not conda-forge.
OVITO Pro integrated interpreter
OVITO Pro includes a preconfigured Python interpreter (commonly referred to as “ovitos”) that can execute scripts written in the Python 3.10 language.
This interpreter is equipped with the
ovito Python module and all other dependencies necessary to execute Python commands within the OVITO Pro desktop application
To run a standalone Python script from the terminal of your operating system, use the ovitos command that is part of every OVITO Pro installation:
ovitos [-o <file.ovito>] [-g] [<script.py>] [args...]
The ovitos executable is located in the
bin/ subdirectory of OVITO Pro for Linux, the
Ovito.app/Contents/MacOS/ directory of OVITO Pro for macOS, and the main application directory
of OVITO Pro for Windows. It should not be confused with ovito, which launches the graphical desktop application.
Let’s say you’ve written a simple Python script file named
import ovito print("Hello, this is OVITO %i.%i.%i" % ovito.version)
You can execute this script file from a system terminal as follows:
user@linux:~/ovito-pro-3.7.9-x86_64/bin$ ./ovitos hello.py Hello, this is OVITO 3.7.9
ovitos is a console program without a graphical user interface and behaves almost like a regular python interpreter.
It lets you easily run scripts on remote machines or computing clusters that don’t possess a graphical display.
Any command line arguments following the script name are passed to your Python program via
Invoking ovitos without a script filename starts an interactive interpreter session.
While you can use any regular Python interpreter to execute scripts that make use of the
ovitos provides a few extra capabilities, which are described in the following.
Preloading session state
The -o command line option tells ovitos to load an
.ovito session state file before executing your
script. This allows you to preload an existing data pipeline or visualization setup that you have
previously prepared using the OVITO Pro or OVITO Basic desktop applications. All script actions will subsequently be performed in the context of this preloaded session.
This approach can save you programming work because things like modifiers and the camera setup already get loaded from the state file, and
you don’t need to set everything up programmatically in your script anymore.
The -g command line option of ovitos starts a graphical program session of OVITO Pro, and the script
will be run in the context of this session. This lets you directly observe your script’s actions as they are being
executed. This function is useful for debugging purposes if you want to visually check the outcome of your script’s actions during the
development phase. Keep in mind that the viewports will only show pipelines that have been inserted into the current scene
Number of CPU cores
OVITO uses all available processor cores by default to perform certain computations. To explicitly restrict the program to a smaller number of parallel threads, use the --nthreads command line parameter, e.g. ovitos --nthreads 1 myscript.py. See Specifying the number of processor cores.
Installing third-party Python modules
ovitos is a preconfigured CPython interpreter with the
ovito Python package already built in. This makes it possible to run scripts both within the OVITO Pro desktop application as well as through the ovitos
command line tool. However, OVITO Pro’s embedded Python interpreter only ships with very few third-party packages, namely NumPy and matplotlib.
If you want to call other third-party Python packages from your script, you can install them in the ovitos interpreter using the usual pip install mechanism. Simply run
ovitos -m pip install --user <package_name>
from a system terminal to install any package from the PyPI repository. This will make the package also available to scripts running in the context of a graphical OVITO Pro session.
The described approach only applies to OVITO Pro installed via installers from www.ovito.org. If you work with the Anaconda version of OVITO Pro, use the conda install command to add additional packages to the Python interpreter shared by OVITO Pro and your Anaconda environment.
Installing a Python extension via pip that includes native code may fail if it is not compatible with the build-time configuration of the ovitos interpreter. In such a case, using the Anaconda version of OVITO Pro is recommended, which makes installing third-party packages straightforward.