Python API of the TREXIO library
Project description
TREXIO Python API
TREXIO provides a Python API, which enables interactive calls to the library. It facilitates the development of interfaces between different codes and can be used to convert data from one input/output file format into another.
Requirements
- python3 (>= 3.6)
- numpy
- C compiler (gcc/icc)
Installation from PyPI
In short, you can run the following command:
pip install trexio
However, it is good practice to first check for updates of the build-system packages. This can be achieved by running
python3 -m pip install --upgrade pip setuptools wheel
Note: we highly recommend to use virtual environments to avoid compatibility issues and to improve reproducibility. For more details, see the corresponding part of the Python documentation.
Additional requirements (for installation from source)
- HDF5 library (>= 1.8)
- pkgconfig (Python package)
Installation from source
- Download the
trexio-<version>.tar.gz
file with the latest Python API gzip -cd trexio-<version>.tar.gz | tar xvf -
cd trexio-<version>
pip3 install -r requirements.txt
(this installs all required python dependencies)- Export custom environment variables needed for the installation following the procedure below and replacing
/path/to/hdf5/
with your paths. Steps (i) and (ii) can be skipped if HDF5 is properly configured forpkg-config
(i.e. if executingpkg-config --libs hdf5
returns a list of options).export H5_CFLAGS=-I/path/to/hdf5/include
export H5_LDFLAGS=-L/path/to/hdf5/lib
source tools/set_NUMPY_INCLUDEDIR.sh
pip3 install .
(this installstrexio
in your environment)cd test && python3 test_api.py
(this executes several tests that verify the installation)
You are ready to go!
Note:
installation based on pip
compiles its own C extension (shared library) called pytrexio
.
This extension is built from the TREXIO source files coupled to the wrapper code generated by SWIG.
The compiler options during this installation may differ from the ones used to compile the primary TREXIO API in C.
Furthermore, custom compiler flags provided to ./configure
or make
are not applied to the Python API.
Examples
An interactive Jupyter notebook called tutorial_benzene.ipynb
is provided in the examples
directory.
The notebook can be lauched either locally (see next section for details) or using pre-built environment on Binder.
Jupyter can be installed using pip install jupyter
. If you are not familiar with it, feel free to consult the Jupyter documentation.
Running the notebook
The example notebook can be launched using the following command:
jupyter notebook tutorial_benzene.ipynb
Additional steps needed to run a custom virtual environment in Jupyter notebooks
In some cases, it may happen that the Jupyter kernels in the activated virtual environment (e.g. myvenv
) still point to the system-wide python binaries and not to the environment ones.
This will result in ImportError
when importing trexio
in the notebook cell. In order to avoid this, the myvenv
has to be installed as an additional kernel.
This requires ipykernel
python package, which usually comes together with the Jupyter installation. If this is not the case, run pip install ipykernel
.
You can install myvenv
as a kernel by executing the following command:
python3 -m ipykernel install --user --name=myvenv
Now you can launch a Jupyter notebook. Once it is open, make sure that your virtual environment is selected as the current kernel. If this is not the case, try this:
- Press the
Kernel
button in the navigation panel - In the output list of options select
Change kernel
- Find the name of your virtual environment (e.g.
myvenv
) in the list and select it
That's it, you have activated the custom virtual environment called myvenv
in your notebook.
To uninstall the kernel named myvenv
, execute the following command:
jupyter kernelspec uninstall myvenv
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 Distribution
Built Distributions
Hashes for trexio-0.1.0-cp39-cp39-manylinux_2_24_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c6b0cdc036780dc3eb5818c84bc12725b9563128e717f682ea96abbc41630c5a |
|
MD5 | ed692aeb0ec5178a95cf49d1bdc07341 |
|
BLAKE2b-256 | c12c47a11c5b6c3a7c4d9d29bf153f06d583653d3e95a0464d06bc6f87c7f55c |
Hashes for trexio-0.1.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c14dad504cd182e8b98c6b9e78040dda5189dcf70e3544d22a12eca418adea03 |
|
MD5 | f3c478dac573ba55e659cb6ebc6c1c14 |
|
BLAKE2b-256 | 6bcaf0f92ce1692dd8e8f72efba4b767a69226a6446fdea8e461ac62bccf3edf |
Hashes for trexio-0.1.0-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9b7446c292380eb90bdf2d1e7b4f31d46ac5606e0711af1370f5312ca3c451b3 |
|
MD5 | bb369a5d0feb7d2618db0400022e5783 |
|
BLAKE2b-256 | 21ed0d33af1e82bacd635913d3096a30440eb87c722700ec76b00d6db286c96c |
Hashes for trexio-0.1.0-cp39-cp39-macosx_11_0_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cd4ec033ea7dfcd256964e5c5d246dc2b75a20b87da4a61eed661a1b0121f40f |
|
MD5 | e2a9c1d112d60e99adb9df156716869d |
|
BLAKE2b-256 | daac561b3a6a91ff134481226df5eee9f487d29e029135d3c24d36c9bf997217 |
Hashes for trexio-0.1.0-cp38-cp38-manylinux_2_24_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 182045a9ecc396e764b1df524c961c3b35ea9b4d58ecb1d6ba8e23a073f102a5 |
|
MD5 | ce29fb76f83875b5fa93e0acf529cbdd |
|
BLAKE2b-256 | b9cf88176fa91a5daffd68d478c266461a757cf24130ca769e3f354ba7b60e30 |
Hashes for trexio-0.1.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b782b38cc2f118e646f5a9d70df6822e7f21055525a95ad41f29ea029a556bc9 |
|
MD5 | da5c90cf6ff9befebeaa72c95628e77f |
|
BLAKE2b-256 | 2103d5644581ed0c7a96f95aa763ce9b50dd3e7641bcb6ec4d0d667686a6a35e |
Hashes for trexio-0.1.0-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e7a8c57a7f8bde1bcb9dfe81341f36640b7d9463b2f156b2e021cb416c62bd50 |
|
MD5 | 9c3e21355420626485ba867d820f00f0 |
|
BLAKE2b-256 | db44a365da04d9aff6900d452039ff05d7bcc442f13c9d832e5d7761f1d90acd |
Hashes for trexio-0.1.0-cp38-cp38-macosx_11_0_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a23a6d258e0ce24461bbc14371749b2c61190eb91a2b037c359783fd7df2ba00 |
|
MD5 | 39e284d0ce06bde92cdd1a8013432f10 |
|
BLAKE2b-256 | 3112a20dff889861fcd3084276df5017b9e074644db840d9696256775238c04f |
Hashes for trexio-0.1.0-cp37-cp37m-manylinux_2_24_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | feb256b1bb84acc0d0b4693645b54ed15daf10c1aebc9e8f5ee72930c831bd48 |
|
MD5 | 41de884d437ffa3d95f65b2661edc13e |
|
BLAKE2b-256 | 51b974237a7e183246d60aaf85c663d2c06b4b967a068687b56ac50b5db43639 |
Hashes for trexio-0.1.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3897e7aa7c18cfe88f4d732fffd18055d4e13f53affa3c2f19ab29b70118761e |
|
MD5 | 7a6c61ef1787c454233e3f40ebe2b285 |
|
BLAKE2b-256 | 32596945584772d9d340bc74b21f64e54c89c21927aff56f776948b151e2e691 |
Hashes for trexio-0.1.0-cp37-cp37m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 92a766c95775d20a40477b00e4d17793aefb7664125ee7cb77b3630440ee83d7 |
|
MD5 | 3aafef32635e835be3ea10e036001b84 |
|
BLAKE2b-256 | 13abc5f522dd233556f0f413bbb85e15b54c771ce74d94b5cef634c81dcb48f7 |
Hashes for trexio-0.1.0-cp37-cp37m-macosx_11_0_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | db848cdaa12fa37f06a49bfd5d87dc8b928982bc8eb932af9534fb6d76160231 |
|
MD5 | 692f084b76e44ea5e322f6704e318c0e |
|
BLAKE2b-256 | 9670e5a2a27d958a429422a44f29d2b7fb8b3de586fe9bddbcc626a72f3435b8 |
Hashes for trexio-0.1.0-cp36-cp36m-manylinux_2_24_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d5cfd288cc0362d63003e6843cf53028ccc9b320aaaedf385e656c5f026e364f |
|
MD5 | 648d1d08844c0eb09f3e981aa955285a |
|
BLAKE2b-256 | a4340e1d0358ba7c0274bd214b826c9819d0d6554397d5e749718d88a00e0cc6 |
Hashes for trexio-0.1.0-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9abc2b0c6629e134f8ae94c5ec079d8b8f92977d7a58aaa831db4c2f45aa9203 |
|
MD5 | e2d4975598eca2c00cf7454eadf6d305 |
|
BLAKE2b-256 | f044c87567f1b993b91b4568974abcfbfeb07317ee7622106d3a79e4b55f3f9d |
Hashes for trexio-0.1.0-cp36-cp36m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 52f6d68fe17648e4957897c7cd4ac74470e14d0721e74580006802c7fe1fdd78 |
|
MD5 | ebd4d8fd44aed7a861fc4a227380fbb1 |
|
BLAKE2b-256 | b0d13cdeb905553543c393561d8bd608d8d09146fc9a3fdb07c231eb62f691fb |