Setting up a Python virtual environment

This topic describes the process to set up a Python virtual environment.

Procedure

  1. Clone the cryptography and maturin repositories:
    $ git clone git@github.com:pyca/cryptography.git
    $ git clone git@github.com:PyO3/maturin.git
  2. Set up the C/C++ compilers, along with the appropriate compiler flags:
    $ export CC="ibm-clang_r"
    $ export CXX="ibm-clang++_r"
    $ export CFLAGS="-O3 -fPIC -fno-lto"
    $ export CXXFLAGS="-O3 -fPIC -fno-lto"
  3. Set up a virtual environment for the cryptography build with:
    $ python3 –m venv myenv
    $ source myenv/bin/activate && cd cryptography
  4. From inside the repo, use pip to install dependencies and the package:
    $ pip3 install setuptools wheel cffi
    $ pip3 install –vvv /path/to/maturin
    $ pip3 install -–no-build-isolation . -vvv