Installation¶
The following instructions for installing QSym² from source are specific to Linux operating systems. On Microsoft Windows platforms, Windows Subsystem for Linux is recommended.
There are two main ways of installing QSym²:
- as a binary named
qsym2
providing the command-line interface, or - as a Python library named
qsym2
providing the exposed Python bindings.
Both methods can be configured via Rust features.
Binary compilation¶
The following instructions assume that the full
feature is to be installed on a Linux operating system to make available the qsym2
binary.
-
Install the basic dependencies by running the following commands (sudo privileges required):
-
Install the Rust compiler by running the command below and following the on-screen instructions:
The default configurations should suffice in most cases. Ensure that the current shell is restarted or the commandsource "$HOME/.cargo/env"
is run upon installation completion so that the Rust compiler and thecargo
package manager can be found. -
Install the feature-specific dependencies by running the following command (sudo privileges required):
-
Obtain the source code of QSym² either via
or by downloading a compressed tarball release and extracting it.git
: -
Inside the source code directory, install QSym² by running the following command:
which will compile and install theqsym2
binary into$HOME/.cargo/bin
to allow for system-wide availability.Note that the
--features
option in the command above specifies that thefull
feature is to be installed. This option accepts a comma-separated list of features listed in the Rust features section and can be modified to select other features to be installed as appropriate.It is possible to install the
instead. The custom pathqsym2
binary into a different path by running/custom/install/path/for/qsym2
must then be added to the$PATH
environment variable to makeqsym2
discoverable by the operating system.
Python-library compilation¶
The following instructions assume that the openblas-static
, integrals
, and python
features are to be compiled on a Linux operating system and then installed as a Python library inside a conda environment. These features are specified in the pyproject.toml
file.
- Follow steps 1 to 4 under the Binary compilation section above to install the required prerequisites.
- Make sure that the Anaconda package manager is available on your system. Instructions for installing Anaconda on a Linux system can be found here.
- Create a new conda environment named
qsym2-python
(or a different name of your choice) running Python 3.11 (or a different version of your choice): and then activate this environment: -
From inside the source code directory, execute
This command callspip
which automatically acquires the build toolmaturin
to compile and install QSym² as a Python library into theqsym2-python
conda environment. This library has theopenblas-static
,integrals
, andpython
features enabled due to the specification in thepyproject.toml
file.The Python library
qsym2
can now be imported by any Python scripts running inside theqsym2-python
conda environment.