Installation#
Note
Gloria requires Python version \(\ge\) 3.9 and \(<\) 3.13. If you do not have it installed, please refer to python.org.
Installing Gloria#
We recommend to install Gloria into a dedicated virtual environment. Once the environment is created and activated use [1]
pip install gloria
to install the package. To verify it is correctly installed, run the following command:
> pip show gloria
Name: gloria
Version: 0.1.0
Summary: ...
Installing CmdStan#
Gloria’s backend employs the statistical programming language Stan and uses CmdStan as interface. As of now, Gloria needs to have a full installation of CmdStan, which will be automatically triggered once you create a Gloria model for the first time. However, prior to that a C++ toolchain consisting of a modern C++ compiler and GNU-Make utility need to be installed. Depending on your system, do one of the following [2]
The Python interface to CmdStan provides the necessary functionality to install the toolchain automatically. Nothing needs to be done on a Windows machine (that’s a first).
The Xcode and Xcode command line tools must be installed. Xcode is available for free from the Mac App Store. To install the Xcode command line tools, run the shell command: xcode-select --install.
The required C++ compiler is g++ 4.9 3
. On most systems the GNU-Make utility is pre-installed and is the default make
utility. There is usually a pre-installed C++ compiler as well, but not necessarily new enough.
With the toolchain ready, start a Python REPL session by simply entering python
into your shell and run the following commands:
>>> from gloria import Gloria
>>> Gloria()
Now you need a little patience while the CmdStan Toolchain and CmdStan itself are being installed. You shoul see an output in your your console similar to the following
>>> 12:45:37 - gloria - INFO - Cannot find CmdStan version 2.36.0. Installing now.
>>> CmdStan install directory: path\to\site-packages\gloria\stan_models
>>> 12:45:37 - cmdstanpy - INFO - Add C++ toolchain to $PATH: C:\Users\thatsyou\.cmdstan\RTools40
>>> Installing CmdStan version: 2.36.0
>>> Downloading CmdStan version 2.36.0
>>> Download successful, file: C:\Users\thatsyou\AppData\Local\Temp\tmpzjwnmxh2
>>> Extracting distribution
>>> Unpacked download as cmdstan-2.36.0
>>> Building version cmdstan-2.36.0, may take several minutes, depending on your system.
>>> Installed cmdstan-2.36.0
>>> Test model compilation
>>> 12:50:31 - gloria - INFO - CmdStan successfully installed.
Once this is finished you are all set. You should now be able to use gloria inside your python applications.
Footnotes