Skip to content

Installation

nastia-lado edited this page Feb 4, 2021 · 18 revisions

From scratch (no Python):

Mac:

Note: this tutorial is written for macOS Catalina. There may be small differences if you are using an older OS.

Mac OS X comes with Python 2.7 pre-installed. However, for this software Python 3.7 is needed. 1

Here's a step-by-step for installing Python 3.* and Homebrew, the developer-preferred package manager, onto Mac OS X1:

  1. Download and install OSX-GCC-Installer (Only if Xcode is not already installed).

  2. Open Terminal, install Homebrew:

    $ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

  3. Insert the Homebrew directory at the top of your PATH environmental variable by adding the following line at the bottom of your ~/.profile file:

    export PATH="/usr/local/opt/python/libexec/bin:$PATH"

  4. Install Python 3 by running the following line in your Terminal:

    brew install python

  5. Homebrew will automatically install pip, a robust package manager specifically for Python, but does not include any Virtual Environment managers. Next, install the virtual environment manager, Conda, instructions here. We recommend installing the minimal version, Miniconda, for the purposes of this project.

  6. The database runs via MySQL, version 5.7. Install MySQL 5.7 through Homebrew by running in Terminal:

    brew install mysql@5.7

    Homebrew has features which allow MySQL to work on macOS in a more Linux-like way. To use these features, run:

    brew tap homebrew/services

    Load and start the MySQL server:

    brew services start mysql@5.7

    Check that the server is running:

    brew services list

    Link the brew installation of MySQL to any other pre-existing installations:

    brew link --force mysql@5.7

    Verify the installation by checking the version:

    mysql -V

    If you're having issues with the installation here, check out some common troubleshooting issues here.

  7. Create a new environment by running the following line in your Terminal:

    conda create --name dhv python=3.7

    and activate the new environment by entering:

    conda activate dhv

    Now, you can mess with the packages in the virtual environment without affecting others on your machine.

  8. Within the dhv environment, install git via:

    conda install -c anaconda git

  9. Clone the DHV_deploy package:

    git clone https://github.com/mackelab/DeepHumanVision_deploy.git

  10. Navigate to the DeepHumanVision_deploy directory and install the required packages:

    pip install -r requirements.txt

  11. Go to the top-level folder DeepHumanVision_deploy and install the package itself

    pip install -e .

  12. Download and install docker here (for Mac, Docker Desktop includes Docker Compose). Test the installation by running the following line in Terminal:

    docker run --rm hello-world

  13. From within the DHV_deploy top level (/home/user/../DeepHumanVision_deploy/), set up the datajoint database by running the following command in Terminal:

    sudo docker-compose up -d

    then, test the mysql build by entering:

    mysql -h 127.0.0.1 -u root -P 3306

    If either of the above commands do not work, please refer to common mysql errors.

  14. To launch Jupyter Lab (an interactive programming interface, learn more here, run:

    jupyter lab

    This command should launch a programming console within your default browser. Within the file browser of Jupyter, navigate to the top-level of the DHV_deploy directory.

  15. Re-configure the PATH_TO_REPO variable in DeepHumanVision_deploy/database/config.py to the path leading to the directory where DHV_deploy is installed.

    Set the variable to:

    PATH_TO_REPO = your/local/installation/of/DHV_deply

    and save the file.

  16. Within Jupyter, open the notebook database/database_set_up.ipynb (notebooks are a mix of executable code and markdown).

    Execute the first cell of code (with the imports) via selecting it and hitting Shift + Crtl or via the drop-down menu.

    You will be prompted for your database username and password. These are pre-set by MySQL. Enter:

    Please enter DataJoint username: root

    Please enter DataJoint password: (enter nothing; pressing enter to skip)

    The output should be:

    Connecting root@localhost:3306

    Now, you can get the database up and running by executing the remaining code cells in order. Once completed, the database will be up and functional!

Linux (currently support Ubuntu & Fedora):

  1. Instructions for installing Python3 via command line are available for the various Linux distributions here.

  2. Next, install the virtual environment manager, Conda, instructions here. We recommend installing the minimal version, Miniconda, for the purposes of this project.

  3. Create a new environment by running the following line in your Terminal:

conda create --name dhv python=3.7

and activate the new environment by entering:

conda activate dhv

Now, you can mess with the packages in the virtual environment without affecting others on your machine.

  1. Within the dhv environment, install git via:

conda install -c anaconda git

  1. Clone the DHV_deploy package:

git clone https://github.com/mackelab/DeepHumanVision_deploy.git

  1. Navigate to the DeepHumanVision_deploy directory and install the required packages:

pip install -r requirements_pip.txt

  1. Go to the top-level folder DeepHumanVision_deploy and install the package itself

pip install -e .

  1. Install docker via Command Line here, followed by docker compose, here.

  2. Install mysql:

    sudo apt install mysql-client-core-8.0 (Ubuntu version 8.0.21 - 20.04.4)

  3. After checking that docker and docker-compose are installed correctly, set up the datajoint database by running the following command in Terminal:

sudo docker-compose up -d

then, test the mysql build by entering:

mysql -h 127.0.0.1 -u root -P 3306

If either of the above commands do not work, please refer to common mysql errors.

  1. Re-configure the PATH_TO_REPO variable in DeepHumanVision_deploy/database/config.py to the path leading to the directory where DHV_deploy is installed.

  2. Run database/database_set_up.ipynb to fill the database with mock data.

  3. Finished??


References: