Installation#

Installing the hmclab package is dead-simple. It requires you to have Python 3.7 on your system. Using either virtual environments or Conda is recommended.

Quick installation#

Run the following inside your local copy of the source code:

> $ conda env create -f environment.yml
> $ conda activate hmclab
> $ pip install -e .

After this you can use the code anywhere on your system, or start a Jupyter Notebook server and have a look at our examples.

Installing the package#

Activate your environment of choice. This can be your system Python, a virtualenv, Conda environment, etc.

Environment setup#

To create e.g. a new Conda environment with the appropriate Python version and dependencies, run the following from your terminal:

> $ git clone https://github.com/larsgeb/hmclab.git
> $ conda create -n hmclab python=3.8
> $ conda activate hmclab
> $ conda install h5py # Needed, as Pip itself can't install hdf5

You can also create this environment byu first downloading this repo, and running the following command inside of it:

> $ conda env create -f environment.yml
> $ conda activate hmclab

This does exactly the same as the previous commands.

Installing the package#

There’s at the moment three ways to install the package:

  1. Install the code directly from GitHub;

  2. Clone the GitHub repo and install from that directory.

  3. Download the .zip file of the repo, unzip, and install from that directory.

Installation option 1#

Option one simply requires you to run the following command from your shell (with the appropriate environment activated):

> $ pip install -e git+git@github.com:larsgeb/hmclab.git@master#egg=hmclab

This won’t work as long as the GitHub repo is private. If you’ve set up SSH keys with your GitHub account, and we’ve granted you access, you can run the following command instead:

> $ pip install -e git+ssh://git@github.com/larsgeb/hmclab.git#egg=hmclab

Installation option 2#

Option two requires you to run the following commands (with the appropriate environment activated):

> $ git clone git@github.com:larsgeb/hmclab.git
> $ cd hmclab
> $ pip install -e .

This also won’t work as long as the GitHub repo is private and you don’t have access.

Installation option 3#

Option three requires you to decompress the .zip file and open a terminal in the resulting folder (such that you see the files setup.py, README.md, etc. Once you have activated the proper environment in your shell, run the following:

> $ pip install -e .

Installing development dependencies#

If you want to develop within this repo, we recommend a few extra packages. They can also be installed using pip.

In Bash:

    # from github
> $ pip install -e \
    git+git@github.com:larsgeb/hmclab.git@master#egg=hmclab[dev]

    # from local clone
> $ pip install -e .[dev]

… or Zsh, which requires escapes for brackets:

    # from github
> $ pip install -e\
    git+git@github.com:larsgeb/hmclab.git@master#egg=hmclab\[dev\]

    # from local clone
> $ pip install -e .\[dev\]

One could now test if all the package components run well by invoking PyTest:

> $ pytest .