Installing PyThemis #
PyThemis is available on PyPi
and can be installed with the usual pip install
.
Additionally, Themis Core library has to be installed in your system as well.
Themis Core is available as a system package for Linux and macOS. Usually you want to install the stable package to benefit from automatic dependency management and security updates. However, you can also build and install the latest PyThemis from the source code.
Installing stable version on Linux #
The easiest way to install Themis on Linux is to use package repositories for your system. We build packages for a multitude of Linux distributions.
-
Add Cossack Labs package repositories to your system.
-
Install Themis Core development package.
For Debian, Ubuntu:
sudo apt install libthemis-dev
For CentOS, RHEL:
sudo yum install libthemis-devel
-
Install PyThemis via PyPi:
pip install pythemis
You may need
sudo
for global installation, if you are not using virtual environments.
Once PyThemis is installed, you can try out code examples.
Installing stable version on macOS #
The easiest way to install Themis on macOS is to use Homebrew.
-
Add Cossack Labs tap to your system:
brew tap cossacklabs/tap
-
Install Themis Core package:
brew install libthemis
-
Install PyThemis via PyPi:
pip install pythemis
Once PyThemis is installed, you can try out code examples.
Building latest version from source #
If the stable package version does not suit your needs, you can install the latest version of Themis from source code.
Either by installing into activated virtualenv or by building and installing .deb
/.rpm
package on your system.
Installing into virtualenv #
-
Build and install Themis Core library into your system.
-
Install PyThemis
# activate virtualenv if not done yet make pythemis_install
OS package #
A package for system-wide installation, for Debian-like and RHEL-like distros
-
Build and install Themis Core library into your system.
-
Install Python dependencies
For Debian, Ubuntu:
sudo apt install lsb-release python3-pip ruby sudo gem install fpm
For CentOS, RHEL:
sudo yum install redhat-lsb-core python3-pip ruby rpm-build sudo gem install fpm
On RHEL you also need to have working
pip
command. If it’s not, and you only gotpip3
, create a symlink like this:sudo ln -s $(which pip3) /usr/bin/pip
. -
Create a PyThemis package
For Debian, Ubuntu:
make deb_python
For CentOS, RHEL:
make rpm_python
The result will be located at
build/deb/python3-pythemis_...all.deb
orbuild/rpm/python3-pythemis_...all.rpm
respectively. -
Install PyThemis
For Debian, Ubuntu:
sudo make pythemis_install_deb
For manual installation, there are two ways:
sudo apt install ./path/to/package.deb
(the./
is important here)sudo dpkg -i path/to/package.deb
(need to installpython3-six
andlibthemis
beforehands)
For CentOS, RHEL:
sudo make pythemis_install_rpm
Or manually run
sudo yum install ./path/to/package.rpm
Building Themis < 0.15 version from sources (deprecated) #
The instructions below are relevant only for Themis older than 0.15. Most likely, you don’t need to follow them, and should install the latest Themis instead.
PEP 668 changed the way Python packages are managed. It is now recommended to usepip install
to only install packages into isolated virtual environments while installing things system-wide should be done using OS package manager (likeapt
orrpm
). This means runningsudo make pythemis_install
is no longer recommended as it copies files into system-managed Python directory (like/usr/lib/python3.X/site-packages
) that is no longer maintained bypip
. Consider building a.whl
and installing it into your venv instead.
-
Build and install Themis Core library into your system.
-
Install PyThemis package from the source code:
sudo make pythemis_install
The package will be installed globally into the system.
-
Run PyThemis test suite to verify the installation:
make prepare_tests_all test_python
To remove PyThemis after using pythemis_install
, run
sudo pip uninstall --break-system-packages pythemis