Skip to content

Installation#

Required Dependencies#

Installation Methods#

It's recommended to install statista in a virtual environment to avoid conflicts with your system's Python packages.

Conda#

The easiest way to install statista is using the conda package manager. statista is available in the conda-forge channel. To install, use the following command:

conda install -c conda-forge statista

This will install statista with all dependencies including Python, numpy, scipy, scikit-learn, and other required packages. If this works, you can skip the rest of the installation instructions.

Installing Python#

The main dependencies for statista are Python 3.11+ and the scientific Python stack.

For Python, we recommend using the Anaconda Distribution for Python 3, which is available for download from https://www.anaconda.com/download/. The installer gives the option to add python to your PATH environment variable. We will assume in the instructions below that it is available in the path, such that python, pip, and conda are all available from the command line.

Note that there is no hard requirement specifically for Anaconda's Python, but it makes installation of required dependencies easier using the conda package manager.

Install in a New Conda Environment#

The easiest and most robust way to install statista is by installing it in a separate conda environment. You can create a new environment with the required dependencies and then install statista.

Run these commands to create a new environment with the necessary dependencies:

conda create -n statista python=3.11
conda activate statista
conda install -c conda-forge numpy pandas scipy scikit-learn matplotlib loguru

This creates a new environment with the name statista and installs the required dependencies. To activate this environment in a session, run:

conda activate statista

For the installation of statista there are two options (from the Python Package Index (PyPI) or from GitHub):

  1. To install the latest release of statista from PyPI:
pip install statista
  1. To install a specific version (e.g., 0.6.1):
pip install statista==0.6.1

From Sources#

The sources for statista can be downloaded from the GitHub repository.

You can either clone the public repository:

git clone https://github.com/Serapieum-of-alex/statista.git

Or download the tarball:

curl -OJL https://github.com/Serapieum-of-alex/statista/tarball/main

Once you have a copy of the source, you can install it with:

python -m pip install .

To install directly from GitHub (from the HEAD of the main branch):

pip install git+https://github.com/Serapieum-of-alex/statista.git

Or from GitHub for a specific release (e.g., 0.6.1):

pip install git+https://github.com/Serapieum-of-alex/statista.git@0.6.1

Now you should be able to start this environment's Python with python and try import statista to see if the package is installed.

More details on how to work with conda environments can be found in the Conda documentation.

Development Installation#

If you are planning to make changes and contribute to the development of statista, it is best to make a git clone of the repository and do an editable install. This will not move a copy to your Python installation directory, but instead create a link in your Python installation pointing to the folder you installed it from, so any changes you make there are directly reflected in your install.

git clone https://github.com/Serapieum-of-alex/statista.git
cd statista
conda activate statista  # or your preferred environment
pip install -e .

For development, you might also want to install the development dependencies:

pip install -e ".[dev]"

Alternatively, if you want to avoid using git and simply want to test the latest version from the main branch, you can download a zip archive from GitHub.

Install Using Pip#

Besides the recommended conda environment setup described above, you can also install statista with pip. For the scientific Python dependencies, you might want to use the conda package manager first:

conda install numpy scipy scikit-learn matplotlib pandas
pip install loguru notebook

Then install statista with pip:

pip install statista

Or install a specific version (e.g., 0.6.1):

pip install statista==0.6.1

You can check libraries.io to see the latest versions of the dependencies.

Verifying the Installation#

To check if the installation is successful, run the following command in your Python environment:

import statista
print(statista.__version__)

You can also try running one of the example scripts from the examples directory:

python examples/extreme-value-statistics.py