Installation

cosymlib is available in both the GitHub and PyPI repositories (https://pypi.org/project/cosymlib/). Installation via PyPI is simpler and it is recommended for most users. Follow the instructions below to install cosymlib in your computer.

Installing cosymlib’s source code

Alternatively, you can download the latest version of cosymlib from github using git (https://git-scm.com) and install it manually through the setup.py file using setuptools (https://setuptools.readthedocs.io/).

cosymlib contains libraries written in Fortran that require a compiler to build them. Before installing cosymlib make sure you have a working Fortran compiler installed in your system. For UNIX based systems you can install the GNU Fortran Compiler from package repositories by opening a terminal and typing the following commands:

  • Linux

    On YUM-based systems (Fedora/RedHat/CentOS)

    sudo yum install yum-utils
    

    On APT-based systems (Debian/Ubuntu)

    sudo apt-get build-dep
    
  • Mac

  1. Install command-line tools:

    xcode-select --install
    
  2. Get Homebrew following the instructions at https://brew.sh, and install GCC formula by:

    brew install gcc
    
  • Windows
  1. Install the Windows development environment Visual Studio (https://developer.microsoft.com/en-us/windows/downloads/)
  2. Install C/Fortran compiler for Windows. We have tested and recommend mingw (https://www.mingw-w64.org)

To install cosymlib, download the source code using git in your computer by typing:

git clone https://github.com/GrupEstructuraElectronicaSimetria/cosymlib.git

This creates a copy of the repository in your computer. You can keep it updated by synchronizing it with the GitHub repository by using the command:

git pull

Once this is done, move to the repository root directory (where setup.py is found) and type the following command to install cosymlib :

python setup.py install --user

Note

The requirements.txt file located at the repository root directory contains a list of all dependency python modules needed for cosymlib to run. If any of them are missing in your system you will need to install them before running cosymlib.

In both cases (PyPI & Github installations) the code will be installed as a python module. To check that it is properly installed you can run the python interpreter and execute:

import cosymlib

If the execution does not show any errors, then cosymlib has been installed successfully.

Note

For users with Apple M1, the scipy library might not properly install when following the instructions above. To solve this, install it manually:

brew install openblas
brew install lapack
brew install python
pip install cython pybind11 pythran numpy
OPENBLAS=$(brew --prefix openblas) CFLAGS="-falign-functions=8 ${CFLAGS}" pip install --no-use-pep517 scipy==1.7.0

Note

When using an IDE, remember to select the python interpreter in the hombrew path. To find it:

which python3
>> /opt/homebrew/bin/python3