Python wrapper for the MIMIQ Quantanium statevector engine.
Project description
Quantanium-python
Python Wrapper for the MIMIQ Quantanium statevector engine.
Prerequisites
Before installing, ensure you have:
- Python (version 3.10, 3.11, or 3.12)
- Git installed on your system
- Virtual environment support (e.g.,
venv)
Installation
Quantanium is implemented in C++, with a wrapper written in the Python programming language to enhance usability and ensure support with MIMIQ API. For the released versions of Quantanium, we provide binaries via our Git repository, specifically for the Linux platform, which only require a functional Python environment to install. You can do this very easily following the instructions from the next subsection.
Installation Quantanium-python from Binary
Installation Steps:
create a new python environment:
python -m venv .quantanium_venv
activate your environment:
source .quantanium/bin/acitvate
Download the latest release here: https://github.com/qperfect-io/quantanium-python/releases/latest
Extract the content of the zip file using
To install the wheel make sure to select the correct file for your system.
- the number after cp[NUM] in the name of the whl file must match your python version
- If you are using macos take the file with macos included in the name, otherwise take the file with manylinux. (not built for windows yet)
For example to install the wheels on ubuntu for python 3.12 run:
pip install quantaniumpy-0.1.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Troubleshooting
- If installation fails, check that you have the correct Python version (
python --version). - Ensure all dependencies are installed.
- In some cases you should consider upgrading via the 'pip install --upgrade pip' command.
Installation from Source
You can also build and install Quantaniumpy from source. Note, in this way, a g++ or clang++ compiler is necessary: make sure that the compiler installed.
In order to install quantaniumpy from source, please follow the next set of instructions:
- Clone this repository with
$ git git@git.unistra.fr:code-quantum/quantanium.git
$ cd quantanium
- Initialize all the dependencies of the project by typing the following instruction in the command line of your
shellterminal:
$ git submodule init && git submodule update
- Setup the build directory and build C++ code with python wrapper support by the following instructions in the command line of your
shellterminal:
$ mkdir release-python
$ cd release-python
$ cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=On -DQUANTANIUM_WITH_PYTHON=On ../
$ cmake --build . -j 4
- Since C++ source code is built, you have to prepare your library environement.
In order to do this, please, navigate to root folder of the project
quantaniumand make the following set of commands:
$ cd ..
$ mkdir python/quantaniumpy/lib
$ cp release-python/lib/quantaniumpy.cpython-310-x86_64-linux-gnu.so python/quantaniumpy/lib
$ export PYTHONPATH=$PYTHONPATH:../../release-python/lib
- You may need to export path to
spdloglibrary:
export LD_LIBRARY_PATH=../../release-python/libs/spdlog
- Building the Python Package with Poetry
- Navigate to the directory of the python project (supposing you are still in the root folder of the project
quantanium):
cd python/
- Set up Python virtual development environment
Virtual environments are used for development to isolate the development environment from system-wide packages.
This way helps to avoid inadvertently becoming dependent on a particular system configuration and makes it easy to maintain multiple environments: e.g. for older versions of Quantanium.
Start by creating a new virtual environment with venv:
python -m venv ~/.venvs/quapy
Activate the environment by invoking the activation command:
source ~/.venvs/quapy/bin/activate
- Ensure you have Poetry installed. If you don't have it installed, you can install it using the following command:
python -m pip install poetry
- Build the package using Poetry:
poetry build
- Install the package, use pip to install the wheel file generated by Poetry:
pip install dist/quantaniumpy-0.1.0-py3-none-any.whl
Accessible Functions
All accessible functions are defined within the Quantanium class inside Quantanium.py. These include:
- convert_qasm_to_qua_circuit(qasm_file): Converts a QASM file to a qua::Circuit.
- convert_qua_to_mimiq_circuit(qua_circuit): Converts a qua::Circuit to a mimiq::Circuit.
- convert_mimiq_to_qua_circuit(mimiq_circuit): Converts a mimiq::Circuit back to a qua::Circuit.
- convert_qua_results_to_mimiq_results(qua_results): Converts qua::Results to mimiq::Results.
- execute(circuit, label="pyapi_v1.0", algorithm="auto", nsamples=1000, bitstrings=None, timelimit=300, bonddim=None, entdim=None, seed=None, qasmincludes=None): Executes the given circuit.
Quick Start
In order to start, you can use an example script from folder examples, e.g.:
$ python examples/example_qasm.py
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file quantanium-0.1.13-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: quantanium-0.1.13-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 17.0 MB
- Tags: CPython 3.12, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c38b11c0c958dcecf61abd3f0ad327871b4d53016db1dd1c91705f5fde465980
|
|
| MD5 |
e9cba6aeb2ddc70f98d521749ab2cace
|
|
| BLAKE2b-256 |
21e7a8e16a3221967478eec1d2f3248b63266fc3c47d6552ea495078f8e281cc
|
File details
Details for the file quantanium-0.1.13-cp312-cp312-macosx_13_0_x86_64.whl.
File metadata
- Download URL: quantanium-0.1.13-cp312-cp312-macosx_13_0_x86_64.whl
- Upload date:
- Size: 3.7 MB
- Tags: CPython 3.12, macOS 13.0+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b8f3aa87fe06bf99a6234d411acf977169fad4201fa259f298c07d4f397cdd21
|
|
| MD5 |
f1da99bbaaabc6df8b231a315ddb618b
|
|
| BLAKE2b-256 |
f682fb920226be7b238a16dc7a1316c67ebb1f965303290dd0aefd2d5849308c
|
File details
Details for the file quantanium-0.1.13-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: quantanium-0.1.13-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 17.0 MB
- Tags: CPython 3.11, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6c14080ac03863345ce30c46b9f62c370e1db67de096bb0361e6501a8e8a9231
|
|
| MD5 |
3106d440bd726138b687f6857632a810
|
|
| BLAKE2b-256 |
8f9caa9524133523cddbce8bea632db32908063d61b6e84af2f271dbed595405
|
File details
Details for the file quantanium-0.1.13-cp311-cp311-macosx_13_0_x86_64.whl.
File metadata
- Download URL: quantanium-0.1.13-cp311-cp311-macosx_13_0_x86_64.whl
- Upload date:
- Size: 3.7 MB
- Tags: CPython 3.11, macOS 13.0+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3de4f5bae212ad063d24b10bd4b0243a6523aab9b7fb89e2ab6e0f6b68b5805a
|
|
| MD5 |
a2315ea0bbbc7ccad74359658e766707
|
|
| BLAKE2b-256 |
c6d2acbb9337c700e4f1a44fcd6e4d0a2330b01273fb47dca7139b3d53704b37
|
File details
Details for the file quantanium-0.1.13-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: quantanium-0.1.13-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 17.0 MB
- Tags: CPython 3.10, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2dda6224efbfe0c5df4ae7fc8df7ef88af46531196f998803ea67ab103a3cc6e
|
|
| MD5 |
ef5ba53291b94a22dd80bddc49c517bf
|
|
| BLAKE2b-256 |
171a76f6021a8e3374f15cfff9f4ddea8fcf8f8f76d1da664fdddd8b1886cd12
|
File details
Details for the file quantanium-0.1.13-cp310-cp310-macosx_13_0_x86_64.whl.
File metadata
- Download URL: quantanium-0.1.13-cp310-cp310-macosx_13_0_x86_64.whl
- Upload date:
- Size: 3.7 MB
- Tags: CPython 3.10, macOS 13.0+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0b3ade878a6cbbb7a60800b116a426dcc869a7ac38b1d0d2209e92533bb7dfdb
|
|
| MD5 |
d551ca6c38f04e1b53ed281da30aa954
|
|
| BLAKE2b-256 |
1af7103cf6ecb9d7a30c06c9ba0dbabcb145aee1589a1f7fb8420cca6ab4c412
|
File details
Details for the file quantanium-0.1.13-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: quantanium-0.1.13-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 17.0 MB
- Tags: CPython 3.9, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d52a6ea55124aef6b9995658962c3a1d3128faaad2db5acaf41481dcea4d9869
|
|
| MD5 |
60528e160b5531584ab728004a6f97b6
|
|
| BLAKE2b-256 |
c929d98fbb8c473dbd69d7a019e456ffccabdc4361a0b5a91acea4695eb65d47
|
File details
Details for the file quantanium-0.1.13-cp39-cp39-macosx_13_0_x86_64.whl.
File metadata
- Download URL: quantanium-0.1.13-cp39-cp39-macosx_13_0_x86_64.whl
- Upload date:
- Size: 3.7 MB
- Tags: CPython 3.9, macOS 13.0+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b567b50633a047a427ab3f6f53cdd52fa3060bf79fa269d100beb5f72aa05021
|
|
| MD5 |
02d860ddaf3a908a8ac301c401b95874
|
|
| BLAKE2b-256 |
b88c1b3da418f1c5ed142bfaacfd32baac81c1e5e97f1efc43795495bb3ff6e9
|