Warning

You are reading the documentation related to the development version. Go here if you are looking for the documentation of the stable release.

Installation from sources (master or develop versions)

Installing git

To install SpectroChemPy from sources, you first need to install git on your system if it is not already present.

Git is a free and open source distributed control system used in well-known software repositories, such as GitHub or Bitbucket. For this project, we use a GitHub repository: spectrochempy repository.

Depending on your operating system, you may refer to these pages for installation instructions:

To check whether or not git is correctly installed, use this command in the terminal:

$ git --version

Cloning the repository locally

The fastest way is to type these commands in a terminal on your machine:

$ git clone --depth=50 https://github.com/spectrochempy/spectrochempy.git
$ cd spectrochempy
$ git remote add upstream https://github.com/spectrochempy/spectrochempy.git

These commands create the directory spectrochempy and connects your repository to the upstream (master branch) SpectroChemPy repository.

Create a conda environment

  • Install either Anaconda, miniconda, or miniforge

  • Make sure your conda is up to date (conda update conda)

  • cd to the SpectroChemPy source directory (i.e., spectrochempy created previously)

  • Create and activate an environment using python v.3.x.

    This will create a new environment and will not touch any of your other existing environments, nor any existing Python installation. (conda installer is somewhat very slow, this is why we prefer to replace it by mamba

    $ conda update conda
    $ conda install -c conda-forge mamba
    $ mamba env create -n scpy -f environment.yml
    $ conda activate scpy
    

    Of course, you can also name your environment differently by replacing scpy by the name of your choice.

Install SpectroChemPy in this environment

(scpy) $ python -m pip install .

At this point you should be able to import spectrochempy:

(scpy) $ python

This start an interpreter in which you can check your installation.

>>> print(scp.version)
SpectroChemPy's API ...
>>> exit()

To view your environments:

(scpy) $ conda env list

To return to the base environment:

(scpy) $ conda deactivate

Updating SpectroChemPy

One definite advantage of installing for git sources is that you can update your version very easily.

To update your local master branch, you can do:

(scpy) $ git pull upstream master --ff-only

and if some changes are notified, run pip again:

(scpy) $ python -m pip install .

To go further and eventually contribute to the code on the upstream, you can consult the Developer’s Guide .