2. How to install

There are two ways to install this program. You can download and install from PyPi or you can clone it from BitBucket. But first, it is recommended that you make these changes inside a virtual environment.

2.1. Setting up a virtual environment

if you are on Python 3.3 or superior, you can run:

$ python3 -m venv vEPIC

to create a virtual Python environment inside a folder named vEPIC. Activate it with:

$ source vEPIC/bin/activate

When you finish using the environment and want to leave it you can just use deactivate. To activate it again, which you need in a new session, just run the command above, you do not need to create it again. More details about Python3’s venv here.

With inferior versions of Python, you can install pyenv and pyenv-virtualenv, which let you create a virtual environment and even choose another versionof Python to install. This is done with:

$ pyenv virtualenv 3.6.1 vEPIC # or other version you like.

Then activate it running:

$ pyenv activate vEPIC # use pyenv deactivate vEPIC to deactivate it.

Your virtual environment name will appear in front of your username at the beginning of the line to indicate that the environment is activated.

2.2. Installing with pip

The easiest way to install this program is to get it from PyPi. It is also the most recommended since it can be easily updated when new versions come out. Inside your virtual environment, run:

$ pip install epic-code

Then, if you are using Linux, create a bind mount from your python path to an external directory for your convenience. For example, in your home, create the directories cosmology_codes/EPIC and cosmology_codes/EPIC-simulations. Run:

$ sudo mount --bind $PYTHONPATH/lib/python3.5/site-packages/EPIC/ cosmology_codes/EPIC

This will make your newly created folder reflect the contents of the installation directory and you will be able to run the scripts and access the associated files from there, rather than only importing the modules from inside the python interactive interpreter. If you do not have the privileges to mount the directory then follow the instructions below for downloading and extracting manually to your home directory.


If you are on Mac OS X or macOS, you can achieve the same effect but will need to install osxfuse and bindfs to create the link:

$ brew install osxfuse # or brew cask install osxfuse
$ brew install bindfs
$ bindfs $PYTHONPATH/lib/python3.5/site-packages/EPIC/ cosmology_codes/EPIC

Next, cd into cosmology_codes/EPIC, run:

$ python define_altdir.py

and pass the full path to cosmology_codes/EPIC-simulations to define this folder as the location for saving simulations results. You are now good to go. To check and install updates if available, just run:

$ pip install --upgrade epic-code

On a Windows computer, if you have Windows 10 Pro, I recommend enabling the Windows Subsystem for Linux and installing Bash on Ubuntu on Windows 10, then proceeding with the instructions above for installation on Linux. If not possible, then use the zip file as indicated below.

2.3. Downloading and extracting the tarball

If you rather not install it to your system you can just extract the tar.gz files from the Python Package Index at https://pypi.python.org/pypi/epic-code. Extract the file with:

$ tar -xzf epic-code-[version].tar.gz

cd into the root folder and install to your (virtual) environment:

$ python setup.py install

This is necessary to guarantee that all modules will be loaded correctly. It also applies to the source code extracted from the zip file or other compression format. You can then run the program from the EPIC folder. To update the program you will have to download the new tarball/zip file and execute this process again.

2.4. Cloning the repository

If you plan to contribute to this program you can clone the git repository at https://bitbucket.org/rmarcondes/epic.