Dynamic Signatures Generated by Regulatory Networks
To install DSGRN you will need a modern C++ compiler (supporting C++11) and Python 3. If you have these and the dependencies needed by DSGRN (see below) installed on your system, all you need to do to install DSGRN is to run the following command on the terminal:
pip install --upgrade --force-reinstall --no-deps --no-cache-dir git+https://github.com/marciogameiro/DSGRN.git
Alternatively, you can clone the GitHub repository and install with:
git clone https://github.com/marciogameiro/DSGRN.git
cd DSGRN
./install.sh
If you don't have all the dependencies installed or if the above fails, continue reading for options on how to proceed. Installing DSGRN as above on a Mac usually fails with the C++ compiler and the Python provided by Apple. In that case you need to install new versions as described below.
DSGRN needs the following dependencies installed on your system:
- Modern C++ compiler
- Python3
- CMake
- Graphviz
- progressbar2
- pyCHomP
- Jupyter Notebook
- Open MPI and mpi4py (optional)
The recommended way to install DSGRN on macOS is with Homebrew, although Anaconda (see below) is also a good option.
First install macOS Command Line Tools with the command:
xcode-select --install # Then click the "Install" button on the dialog
Next install Homebrew with the command:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
Then use Homebrew to install Python 3 and the GCC compilers (the ones provided by Apple usually won't work):
brew install python
brew install gcc
Now, when installing the additional dependencies and when running DSGRN you need to make sure that you are using the Python 3 and the corresponding pip installed by Homebrew. They are usually called python3
and pip3
and are installed at /usr/local/bin/python3
and /usr/local/bin/pip3
(you can make sure this is the case by typing brew info python
and checking the output).
You could try to make aliases by adding the commands alias python=/usr/local/bin/python3
and alias pip=/usr/local/bin/pip3
to your .zshrc
or .bash_profile
, but this is not recommended (see here for options on how to manage multiple Python versions). So let's just keep things the way they are and use python3
and pip3
from now on if needed, that is, when installing and running DSGRN you should replace pip
and python
by pip3
and python3
if this is how they are called.
We also need to make sure that the GCC compilers we installed with Homebrew are the ones used by CMake when we install DSGRN (use brew info gcc
to make sure they are installed as g++-9
and gcc-9
, otherwise update the commands below). You can do that by typing (depending on your system you may need to replace .zshrc
by .bash_profile
or .bashrc
or by the name of your shell configuration file):
echo "export CXX=g++-9" >> ~/.zshrc
echo "export CC=gcc-9" >> ~/.zshrc
Before proceeding we need to make sure that these definitions take effect. You can do that with the command source ~/.zshrc
or by closing your terminal window and oppening a new one.
Now we can use Homebrew to install the dependencies
brew install cmake
brew install openmpi
and use pip to install the Python depencies
pip install graphviz progressbar2 mpi4py jupyter ipython
Finally we can install pyCHomP
pip install --upgrade --force-reinstall --no-deps --no-cache-dir git+https://github.com/shaunharker/pyCHomP.git
and install DSGRN with the command (or by clonning the repo as described above):
pip install --upgrade --force-reinstall --no-deps --no-cache-dir git+https://github.com/marciogameiro/DSGRN.git
Another option is to use Anaconda to install Python and the other dependencies. You can install Anaconda through the website (use the Python 3.7 version) or with the commands (you may also need to install the macOS Command Line Tools as above):
curl -O https://repo.anaconda.com/archive/Anaconda3-2020.02-MacOSX-x86_64.sh
bash Anaconda3-2020.02-MacOSX-x86_64.sh
Note that the above commands are downloading and running the latest (at the time of this writting) install script for macOS. For other systems and for the most up to date version, please check the Anaconda website. After installing Anaconda you need to restart the terminal for the changes to take effect.
Next update Anaconda and Python (which is automatically installed with Anaconda):
conda update conda
conda update anaconda
conda update python
Install the dependencies:
conda install -c anaconda cmake
conda install -c anaconda mpi4py
The rest of the installation process (the steps using pip) should be the same as before
pip install graphviz progressbar2 mpi4py jupyter ipython
Then install pyCHomP:
pip install --upgrade --force-reinstall --no-deps --no-cache-dir git+https://github.com/shaunharker/pyCHomP.git
and DSGRN:
pip install --upgrade --force-reinstall --no-deps --no-cache-dir git+https://github.com/marciogameiro/DSGRN.git
If installing DSGRN fails, try to install GCC:
conda install -c anaconda gcc
and make it the default C++ compiler (change the path to g++
and gcc
below if needed):
echo "export CXX=~/.anaconda3/bin/g++" >> ~/.zshrc
echo "export CC=~/.anaconda3/bin/gcc" >> ~/.zshrc
On a local Linux machine you can install C++ and Python, if needed, using you prefered method (sudo apt-get install
in Ubuntu, for example) or use Anaconda as above. Just make sure you download the install script for Linux from the Anaconda site. The rest of the installation procedure should be the same as above.
On an HPC cluster it is likely that modern compilers, python, and a suitable version of MPI are already installed.
However, you cannot pip install
due to permissions issues. In this case one solution is to pass the --user
flag:
pip install mpi4py --user
pip install --upgrade --force-reinstall --no-deps --no-cache-dir --user git+https://github.com/shaunharker/pyCHomP.git
pip install --upgrade --force-reinstall --no-deps --no-cache-dir --user git+https://github.com/marciogameiro/DSGRN.git
You can also clone the repo and install with:
git clone https://github.com/marciogameiro/DSGRN.git
cd DSGRN
./install.sh --user
This would put the Signatures
script in ~/.local/bin
, so you may consider putting that on your PATH
.
On an HPC clusster you could also install Anaconda locally on your account and use it to install DSGRN and its dependencies. However this is not recommended.
pip uninstall DSGRN
Try Anaconda3 https://www.anaconda.com.
This will install into a folder named anaconda3
and add a line in ~/.bash_profile
:
#added by Anaconda3 5.0.1 installer
#export PATH="/PATH/TO/anaconda3/bin:$PATH"
This will redirect the command line python and pip. Note that you may have to start a new bash
session for the path changes to take effect (i.e. close and reopen the terminal program). This has the effect of plastering over any problems you might be having with multiple installations/permissions problems/jupyter not seeing the package/etc.
If the installation gives permissions issues, oftentimes the culprit is broken permissions on the subfolders of the homebrew folder /usr/local
.
First, see what
brew doctor
says. A common fix is:
sudo chown -R $(whoami) $(brew --prefix)/*
If it still doesn't work after this, then you might try uninstalling and reinstalling homebrew.
To uninstall homebrew:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall.sh)"
Or sudo
if it gives issues:
sudo /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall.sh)"
To install homebrew (don't use sudo
here!):
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
For missing dependencies, you'll need to contact your system admin.
For python modules, you can pass the --user
flag:
# Install DSGRN
git clone https://github.com/marciogameiro/DSGRN.git
cd DSGRN
./install.sh --user
If the package installs but it is not visible in jupyter, the likely problem is that the jupyter python kernel is not the same python for which pychomp was installed. That is, you may have multiple pythons on your system.
You can try to confirm this by typing
which python
which pip
which jupyter
Possible fixes include steps such as
- checking/changing your environmental variable
PATH
in~/.bash_profile
or.bashrc
- uninstalling python and jupyter, then reinstalling python then jupyter
- plastering over with anaconda3
- googling for answers until 3AM
In python, type
import DSGRN
print(DSGRN.__name__)
This will tell you the path to the DSGRN the python module loader used, and you can check if it is correct.