-
Notifications
You must be signed in to change notification settings - Fork 1
Installation
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:
-
Download and install OSX-GCC-Installer (Only if Xcode is not already installed).
-
Open Terminal, install Homebrew:
$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
-
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"
-
Install Python 3 by running the following line in your Terminal:
brew install python
-
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. -
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.
-
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.
-
Within the
dhv
environment, install git via:conda install -c anaconda git
-
Clone the DHV_deploy package:
git clone https://github.com/mackelab/DeepHumanVision_deploy.git
-
Navigate to the DeepHumanVision_deploy directory and install the required packages:
pip install -r requirements.txt
-
Go to the top-level folder DeepHumanVision_deploy and install the package itself
pip install -e .
-
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
-
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.
-
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.
-
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.
-
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!
-
Instructions for installing Python3 via command line are available for the various Linux distributions here.
-
Next, install the virtual environment manager, Conda, instructions here. We recommend installing the minimal version, Miniconda, for the purposes of this project.
-
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.
- Within the
dhv
environment, install git via:
conda install -c anaconda git
- Clone the DHV_deploy package:
git clone https://github.com/mackelab/DeepHumanVision_deploy.git
- Navigate to the DeepHumanVision_deploy directory and install the required packages:
pip install -r requirements_pip.txt
- Go to the top-level folder DeepHumanVision_deploy and install the package itself
pip install -e .
-
Install docker via Command Line here, followed by docker compose, here.
-
Install mysql:
sudo apt install mysql-client-core-8.0
(Ubuntu version 8.0.21 - 20.04.4) -
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.
-
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.
-
Run database/database_set_up.ipynb to fill the database with mock data.
-
Finished??
References: