From 993f1ddf4111201a58aecaf6d98b410239dc5dfc Mon Sep 17 00:00:00 2001 From: Shuya Saeki Date: Mon, 21 Feb 2022 14:42:06 +0900 Subject: [PATCH 1/2] =?UTF-8?q?=E5=90=84=E3=83=97=E3=83=A9=E3=83=83?= =?UTF-8?q?=E3=83=88=E3=83=95=E3=82=A9=E3=83=BC=E3=83=A0=E5=90=91=E3=81=91?= =?UTF-8?q?=E3=81=AB=E3=82=A4=E3=83=B3=E3=82=B9=E3=83=88=E3=83=BC=E3=83=AB?= =?UTF-8?q?=E3=83=9E=E3=83=8B=E3=83=A5=E3=82=A2=E3=83=AB=E3=82=92=E6=9B=B4?= =?UTF-8?q?=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 5 +- docs/installation_for_linux.md | 293 ++++++++++++++ docs/installation_for_mac.md | 198 +++++++++ ...llation.md => installation_for_windows.md} | 376 ++---------------- 4 files changed, 532 insertions(+), 340 deletions(-) create mode 100644 docs/installation_for_linux.md create mode 100644 docs/installation_for_mac.md rename docs/{installation.md => installation_for_windows.md} (50%) diff --git a/README.md b/README.md index dd158f60c..aee8ea726 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,8 @@ # optinist How to install and use optinist -- [Installation](https://github.com/oist/optinist/blob/develop/docs/installation.md) +- Installation + - [for Windows](https://github.com/oist/optinist/blob/develop/docs/installation_for_windows.md) + - [for Mac](https://github.com/oist/optinist/blob/develop/docs/installation_for_mac.md) + - [for Linux](https://github.com/oist/optinist/blob/develop/docs/installation_for_linux.md) - [How to use gui flowchart](https://github.com/oist/optinist/blob/develop/docs/gui_flowchart.md) - [How to use gui visualize](https://github.com/oist/optinist/blob/develop/docs/gui_visualize.md) diff --git a/docs/installation_for_linux.md b/docs/installation_for_linux.md new file mode 100644 index 000000000..f90d9e392 --- /dev/null +++ b/docs/installation_for_linux.md @@ -0,0 +1,293 @@ +Table of Contents +================= + +* [Installation](#installation) +* [0. GitHub SSH access settings](#0-github-ssh-access-settings) +* [1. Clone optinist repository](#1-clone-optinist-repository) +* [2. Make frontend environment](#2-make-frontend-environment) + * [Install docker](#install-docker) + * [Install docker-compose](#install-docker-compose) + * [docker-compose buld frontend](#docker-compose-buld-frontend) + * [docker-compose up frontend](#docker-compose-up-frontend) + * [Launch browser. http://localhost:3000](#launch-browser--httplocalhost3000) +* [3. Make backend environment](#3-make-backend-environment) + * [For Linux Users](#for-linux-users) + * [Install gcc, g++](#install-gcc-g) + * [Install Anaconda](#install-anaconda) + * [Create anaconda environment](#create-anaconda-environment) + * [Install mamba](#install-mamba) + * [Install library](#install-library) + * [run backend](#run-backend) + * [Reload your browser. If you can select the "Algorithm" tab, it is working correctly!](#reload-your-browser-if-you-can-select-the-algorithm-tab-it-is-working-correctly) + +# Installation +We introduce how to install optinist. +We have developed optinist python(backend) and typescript(frontend), so you need to make both environment. +Please follow instructions below. + +
+ +**CAUTION**: We confirmed them on Ubuntu 18.04 or 20.04. + +# 0. GitHub SSH access settings +**You only need to do the following once.** + +On your shell, +``` +git config --global user.name "user.name" +git config --global user.email "user@oist.jp" +git config --global core.quotepath false +``` +make your ssh key +``` +mkdir ~/.ssh +cd ~/.ssh +ssh-keygen -t rsa -C 'user@oist.jp' +#Enter +#Input passphrase (empty for no passphrase): +#Input passphrase (again) +``` +Open the generated public key (rsa.pub) with a text editor and copy all the contents. +Go to GitHub and follow the steps below to register your public key. + +1. Log in to GitHub and select `Settings` from the menu on the top right +2. Select `SSH and GPG keys` +3. Press `New SSH Key` +4. Enter the `Title` (free) and `Key` (paste the copied content) and press `Add SSH` key. + +This completes the SSH connection settings! + +# 1. Clone optinist repository + +First, you get optinist code from github repository. +``` +cd "your working repository" +git clone git@github.com:oist/optinist.git +``` +
+ +# 2. Make frontend environment +### Install docker +``` +sudo apt update +sudo apt install apt-transport-https ca-certificates curl software-properties-common + +curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - +sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable" +sudo apt update + +sudo apt install docker-ce +``` +- To avoid using docker commands with sudo, you need to set $USER to docker user group. +``` +sudo usermod -aG docker $USER +``` +### Install docker-compose +``` +wget https://github.com/docker/compose/releases/download/v2.2.3/docker-compose-linux-x86_64 +mv docker-compose-linux-x86_64 docker-compose +sudo mv docker-compose /usr/local/bin/docker-compose +``` +### docker-compose buld frontend +``` +docker-compose build frontend +``` +- `docker-compose build frontend` log is as blow: +``` +$ docker-compose up frontend +Sending build context to Docker daemon 465kB +Step 1/8 : FROM node:14 as node +14: Pulling from library/node +a834d7c95167: Pull complete +57b3fa6f1b88: Pull complete +778df3ecaa0f: Pull complete +d353c340774e: Pull complete +6370e0bc373d: Pull complete +fb61153482cd: Pull complete +78fb5822e501: Pull complete +ba3577a691be: Pull complete +bd38fd0dd57b: Pull complete +Digest: sha256:b2c75df8c9706156c38b4f1f678d00e11cb2bfda09fc4ab6e36ec17ac9163865 +Status: Downloaded newer image for node:14 + ---> 9cb3f042a684 +Step 2/8 : COPY . ./ + ---> f688cc7411c1 +Step 3/8 : ENV GENERATE_SOURCEMAP false + ---> Running in bdcec15e8d6a +Removing intermediate container bdcec15e8d6a + ---> 3667fcdd6fda +Step 4/8 : RUN yarn install + ---> Running in 5f5656b1e45e +yarn install v1.22.17 +[1/4] Resolving packages... +[2/4] Fetching packages... +[3/4] Linking dependencies... +warning "@emotion/styled > @emotion/babel-plugin@11.7.2" has unmet peer dependency "@babel/core@^7.0.0". +warning "@emotion/styled > @emotion/babel-plugin > @babel/plugin-syntax-jsx@7.16.7" has unmet peer dependency "@babel/core@^7.0.0-0". +warning " > @mui/x-data-grid@5.5.1" has unmet peer dependency "@mui/system@^5.2.8". +warning " > @testing-library/user-event@12.8.3" has unmet peer dependency "@testing-library/dom@>=7.21.4". +warning " > react-plotlyjs-ts@2.2.2" has incorrect peer dependency "plotly.js@^1.31.2". +warning " > react-plotlyjs-ts@2.2.2" has incorrect peer dependency "react@^16.0.0". +warning " > react-plotlyjs-ts@2.2.2" has incorrect peer dependency "react-dom@^16.0.0". +warning " > react-plotlyjs-ts@2.2.2" has incorrect peer dependency "typescript@^2.5.3". +warning " > styled-components@5.3.3" has unmet peer dependency "react-is@>= 16.8.0". +[4/4] Building fresh packages... +$ cd .. && husky install frontend/.husky +fatal: Not a git repository (or any of the parent directories): .git +Done in 27.26s. +Removing intermediate container 5f5656b1e45e + ---> e2b5f0cd7788 +Step 5/8 : RUN yarn build + ---> Running in 4f2bd6935a86 +yarn run v1.22.17 +$ react-scripts build +Creating an optimized production build... +Compiled successfully. + +File sizes after gzip: + + 1.44 MB build/static/js/2.7d54d872.chunk.js + 21.99 KB build/static/js/main.d29046c0.chunk.js + 1.58 KB build/static/js/3.f30dcf7f.chunk.js + 1.14 KB build/static/css/2.17fb7f09.chunk.css + 1.12 KB build/static/js/runtime-main.3ef6eb24.js + 565 B build/static/css/main.021ef9c2.chunk.css + +The bundle size is significantly larger than recommended. +Consider reducing it with code splitting: https://goo.gl/9VhYWB +You can also analyze the project dependencies: https://goo.gl/LeUzfb + +The project was built assuming it is hosted at /. +You can control this with the homepage field in your package.json. + +The build folder is ready to be deployed. +You may serve it with a static server: + + yarn global add serve + serve -s build + +Find out more about deployment here: + + https://cra.link/deployment + +Done in 55.35s. +Removing intermediate container 4f2bd6935a86 + ---> 28912f086e58 +Step 6/8 : FROM nginx:1.20.1 +1.20.1: Pulling from library/nginx +b380bbd43752: Already exists +83acae5e2daa: Already exists +33715b419f9b: Already exists +eb08b4d557d8: Already exists +74d5bdecd955: Already exists +0820d7f25141: Already exists +Digest: sha256:a98c2360dcfe44e9987ed09d59421bb654cb6c4abe50a92ec9c912f252461483 +Status: Downloaded newer image for nginx:1.20.1 + ---> c8d03f6b8b91 +Step 7/8 : COPY --from=node ./build /usr/share/nginx/html + ---> be1970e94e1d +Step 8/8 : CMD nginx -g "daemon off;" + ---> Running in 53d799653e81 +Removing intermediate container 53d799653e81 + ---> a85095edc139 +Successfully built a85095edc139 +Successfully tagged optinist_frontend:latest + +Use 'docker scan' to run Snyk tests against images to find vulnerabilities and learn how to fix them +$ +``` +### docker-compose up frontend +``` +docker-compose up frontend +``` +- `docker-compose up frontend` log is as blow: +``` +$ docker-compose up frontend +[+] Running 1/1 + ⠿ Container optinist-frontend-1 Recre... 0.0s +Attaching to optinist-frontend-1 +optinist-frontend-1 | 2022/02/14 07:17:09 [notice] 7#7: using the "epoll" event method +optinist-frontend-1 | 2022/02/14 07:17:09 [notice] 7#7: nginx/1.20.1 +optinist-frontend-1 | 2022/02/14 07:17:09 [notice] 7#7: built by gcc 8.3.0 (Debian 8.3.0-6) +optinist-frontend-1 | 2022/02/14 07:17:09 [notice] 7#7: OS: Linux 5.4.0-99-generic +optinist-frontend-1 | 2022/02/14 07:17:09 [notice] 7#7: getrlimit(RLIMIT_NOFILE): 1048576:1048576 +optinist-frontend-1 | 2022/02/14 07:17:09 [notice] 7#7: start worker processes +optinist-frontend-1 | 2022/02/14 07:17:09 [notice] 7#7: start worker process 8 +optinist-frontend-1 | 2022/02/14 07:17:09 [notice] 7#7: start worker process 9 +optinist-frontend-1 | 2022/02/14 07:17:09 [notice] 7#7: start worker process 10 +optinist-frontend-1 | 2022/02/14 07:17:09 [notice] 7#7: start worker process 11 +optinist-frontend-1 | 2022/02/14 07:17:09 [notice] 7#7: start worker process 12 +optinist-frontend-1 | 2022/02/14 07:17:09 [notice] 7#7: start worker process 13 +optinist-frontend-1 | 2022/02/14 07:17:09 [notice] 7#7: start worker process 14 +optinist-frontend-1 | 2022/02/14 07:17:09 [notice] 7#7: start worker process 15 +optinist-frontend-1 | 2022/02/14 07:17:09 [notice] 7#7: start worker process 16 +optinist-frontend-1 | 2022/02/14 07:17:09 [notice] 7#7: start worker process 17 +optinist-frontend-1 | 2022/02/14 07:17:09 [notice] 7#7: start worker process 18 +optinist-frontend-1 | 2022/02/14 07:17:09 [notice] 7#7: start worker process 19 +optinist-frontend-1 | 2022/02/14 07:17:09 [notice] 7#7: start worker process 20 +optinist-frontend-1 | 2022/02/14 07:17:09 [notice] 7#7: start worker process 21 +optinist-frontend-1 | 2022/02/14 07:17:09 [notice] 7#7: start worker process 22 +optinist-frontend-1 | 2022/02/14 07:17:09 [notice] 7#7: start worker process 23 +optinist-frontend-1 | 2022/02/14 07:17:09 [notice] 7#7: start worker process 24 +optinist-frontend-1 | 2022/02/14 07:17:09 [notice] 7#7: start worker process 25 +optinist-frontend-1 | 2022/02/14 07:17:09 [notice] 7#7: start worker process 26 +optinist-frontend-1 | 2022/02/14 07:17:09 [notice] 7#7: start worker process 27 +optinist-frontend-1 | 2022/02/14 07:17:09 [notice] 7#7: start worker process 28 +optinist-frontend-1 | 2022/02/14 07:17:09 [notice] 7#7: start worker process 29 +optinist-frontend-1 | 2022/02/14 07:17:09 [notice] 7#7: start worker process 30 +optinist-frontend-1 | 2022/02/14 07:17:09 [notice] 7#7: start worker process 31 +``` +### Launch browser. http://localhost:3000 +It opens correctly! + +
+ +# 3. Make backend environment +## For Linux Users +### Install gcc, g++ +- For install CaImAn, you need to install gcc and g++. +``` +sudo apt install gcc g++ +``` +### Install Anaconda +``` +wget https://repo.anaconda.com/archive/Anaconda3-2021.11-Linux-x86_64.sh +bash Anaconda3-2021.11-Linux-x86_64.sh +``` +### Create anaconda environment +``` +conda create -n optinist python=3.8 +conda activate optinist +``` +### Install mamba +We use snakemake library, and it requires mamba. +``` +conda install -n base -c conda-forge mamba +``` +### Install library +```bash +cd backend +pip install -r requirements.txt +# for CaImAn +git clone https://github.com/flatironinstitute/CaImAn -b v1.9.7 +pip install cython opencv-python matplotlib scikit-image==0.18.0 scikit-learn ipyparallel holoviews watershed tensorflow +cd CaImAn +pip install -e . +cd .. +``` +### run backend +``` +python main.py +``` +- `python main.py` log is as blow: +``` +$ python main.py +INFO: Will watch for changes in these directories: ['/home/oist/optinist/backend'] +INFO: Uvicorn running on http://0.0.0.0:8000 (Press CTRL+C to quit) +INFO: Started reloader process [13700] using statreload +INFO: Started server process [13744] +INFO: Waiting for application startup. +INFO: Application startup complete. +``` +### Reload your browser. If you can select the "Algorithm" tab, it is working correctly! +Done! diff --git a/docs/installation_for_mac.md b/docs/installation_for_mac.md new file mode 100644 index 000000000..ccedb51f3 --- /dev/null +++ b/docs/installation_for_mac.md @@ -0,0 +1,198 @@ +Table of Contents +================= + +* [Installation](#installation) +* [0. GitHub SSH access settings](#0-github-ssh-access-settings) +* [1. Clone optinist repository](#1-clone-optinist-repository) +* [2. Make frontend environment](#2-make-frontend-environment) + * [Install Docker desktop](#install-docker-desktop) + * [docker-compose build frontend](#docker-compose-build-frontend) + * [docker-compose up frontend](#docker-compose-up-frontend) + * [Launch browser. http://localhost:3000](#launch-browser--httplocalhost3000) +* [3. Make backend environment](#3-make-backend-environment) + * [Install Anaconda](#install-anaconda) + * [Create anaconda environment](#create-anaconda-environment) + * [Install mamba](#install-mamba) + * [Install library](#install-library) + * [Install CaImAn](#install-caiman) + * [run backend](#run-backend) + * [Reload your browser. If you can select the "Algorithm" tab, it is working correctly!](#reload-your-browser-if-you-can-select-the-algorithm-tab-it-is-working-correctly) + * [FAQ](#faq) +# Installation +We introduce how to install optinist. +We have developed optinist python(backend) and typescript(frontend), so you need to make both environment. +Please follow instructions below. + +
+ +**CAUTION for M1 Mac User** +We use tensorflow in caiman code. We know that M1 mac doesn't install tensorflow easily, so if there is a problem, skip install caiman. (Release in progress…) + +# 0. GitHub SSH access settings +**You only need to do the following once.** + +Open terminal App, +``` +git config --global user.name "user.name" +git config --global user.email "user@oist.jp" +git config --global core.quotepath false +``` +make your ssh key +``` +mkdir ~/.ssh +cd ~/.ssh +ssh-keygen -t rsa -C 'user@oist.jp' +#Enter +#Input passphrase (empty for no passphrase): +#Input passphrase (again) +``` +Open the generated public key (rsa.pub) with a text editor and copy all the contents. +Go to GitHub and follow the steps below to register your public key. + +1. Log in to GitHub and select `Settings` from the menu on the top right +2. Select `SSH and GPG keys` +3. Press `New SSH Key` +4. Enter the `Title` (free) and `Key` (paste the copied content) and press `Add SSH` key. + +This completes the SSH connection settings! + +# 1. Clone optinist repository + +First, you get optinist code from github repository. +``` +cd "your working repository" +git clone git@github.com:oist/optinist.git +``` +
+ +# 2. Make frontend environment +### Install Docker desktop +- Install [Docker Desktop](https://www.docker.com/products/docker-desktop) for Mac. + +### docker-compose build frontend +``` +docker-compose build frontend +``` +- `docker-compose build frontend` log is as blow: +``` +$ docker-compose build frontend +[+] Building 301.5s (9/11) +[+] Building 329.7s (9/11) +[+] Building 455.9s (12/12) FINISHED + => [internal] load build definition from Dockerfile 0.0s + => => transferring dockerfile: 224B 0.0s + => [internal] load .dockerignore 0.0s + => => transferring context: 70B 0.0s + => [internal] load metadata for docker.io/library/nginx:1.20.1 4.3s + => [internal] load metadata for docker.io/library/node:14 4.3s + => [internal] load build context 0.2s + => => transferring context: 1.08MB 0.2s + => CACHED [node 1/4] FROM docker.io/library/node:14@sha256:b2c75df8c9706156c3 0.0s + => CACHED [stage-1 1/2] FROM docker.io/library/nginx:1.20.1@sha256:a98c2360dc 0.0s + => [node 2/4] COPY . ./ 0.1s + => [node 3/4] RUN yarn install 123.0s + => [node 4/4] RUN yarn build 316.1s + => [stage-1 2/2] COPY --from=node ./build /usr/share/nginx/html 0.1s + => exporting to image 0.1s + => => exporting layers 0.1s + => => writing image sha256:4953a0a63a7842e7a108d4d32c567e04de5fbae87d83d9f792 0.0s + => => naming to docker.io/library/optinist_frontend 0.0s +Use ‘docker scan’ to run Snyk tests against images to find vulnerabilities and learn how to fix them +$ +``` + +If you haven't installed docker-compose, you need to install docker-compose. +``` +wget https://github.com/docker/compose/releases/download/v2.2.3/docker-compose-darwin-x86_64 +mv docker-compose-darwin-x86_64 docker-compose +sudo mv docker-compose /usr/local/bin/docker-compose +``` + +### docker-compose up frontend +``` +docker-compose up frontend +``` +- `docker-compose up frontend` log is as blow: +``` +$ docker-compose up frontend ++] Running 1/1 +⠿ Container optinist-frontend-1 Recreated 0.2s +Attaching to optinist-frontend-1 +optinist-frontend-1 | 2022/02/14 06:38:16 [notice] 7#7: using the “epoll” event method +optinist-frontend-1 | 2022/02/14 06:38:16 [notice] 7#7: nginx/1.20.1 +optinist-frontend-1 | 2022/02/14 06:38:16 [notice] 7#7: built by gcc 8.3.0 (Debian 8.3.0-6) +optinist-frontend-1 | 2022/02/14 06:38:16 [notice] 7#7: OS: Linux 5.10.76-linuxkit +optinist-frontend-1 | 2022/02/14 06:38:16 [notice] 7#7: getrlimit(RLIMIT_NOFILE): 1048576:1048576 +optinist-frontend-1 | 2022/02/14 06:38:16 [notice] 7#7: start worker processes +optinist-frontend-1 | 2022/02/14 06:38:16 [notice] 7#7: start worker process 8 +optinist-frontend-1 | 2022/02/14 06:38:16 [notice] 7#7: start worker process 9 +``` +### Launch browser. http://localhost:3000 +It opens correctly! + +
+ +# 3. Make backend environment + +### Install Anaconda +Download https://repo.anaconda.com/archive/Anaconda3-2021.11-MacOSX-x86_64.pkg + +Install + +### Create anaconda environment +``` +conda create -n optinist python=3.8 +conda activate optinist +``` +### Install mamba +We use snakemake library, and it requires mamba. +``` +conda install -n base -c conda-forge mamba +``` +### Install library +```bash +cd backend +pip install -r requirements.txt +cd .. +``` + +In case an error occuered when you install ``` requirements.txt ```, pip upgrade command below may solve the error. +``` +pip install --upgrade pip +``` + +### Install CaImAn +**CAUTION for M1 Mac User** +We use tensorflow in caiman code. We know that M1 mac doesn't install tensorflow easily, so if there is a problem, skip install caiman. (Release in progress…) + +If you are m1 mac user, skip this. + +```bash +# for CaImAn +git clone https://github.com/flatironinstitute/CaImAn -b v1.9.7 +pip install cython opencv-python matplotlib scikit-image==0.18.0 scikit-learn ipyparallel holoviews watershed tensorflow +cd CaImAn +pip install -e . +cd .. +``` +### run backend +``` +python main.py +``` +- `python main.py` log is as blow: +``` +$ python main.py +INFO: Will watch for changes in these directories: [‘/Users/oist/work/optinist/backend’] +INFO: Uvicorn running on http://0.0.0.0:8000 (Press CTRL+C to quit) +INFO: Started reloader process [2678] using statreload +INFO: Started server process [2690] +INFO: Waiting for application startup. +INFO: Application startup complete. +``` +### Reload your browser. If you can select the "Algorithm" tab, it is working correctly! +Done! + + +### FAQ +If you get the warning message shown below, we recommend `rm -rf /Users/usename/opt/anaconda3/envs/optinist ` and recreate conda environment. +> WARNING: A directory already exists at the target location '/Users/usename/opt/anaconda3/envs/optinist' but it is not a conda environment. diff --git a/docs/installation.md b/docs/installation_for_windows.md similarity index 50% rename from docs/installation.md rename to docs/installation_for_windows.md index 77c9efb16..c03340300 100644 --- a/docs/installation.md +++ b/docs/installation_for_windows.md @@ -2,9 +2,8 @@ Table of Contents ================= * [Installation](#installation) +* [0. GitHub SSH access settings](#0-github-ssh-access-settings) * [1. Clone optinist repository](#1-clone-optinist-repository) - * [For Windows Users](#for-windows-users) - * [For Mac or Linux users](#for-mac-or-linux-users) * [2. Make frontend environment](#2-make-frontend-environment) * [For Windows(PowerShell) Users](#for-windowspowershell-users) * [Install nodejs and yarn](#install-nodejs-and-yarn) @@ -15,17 +14,6 @@ Table of Contents * [docker-compose build](#docker-compose-build) * [docker-compose up frontend](#docker-compose-up-frontend) * [Launch browser. http://localhost:3000](#launch-browser--httplocalhost3000-1) - * [For Linux Users](#for-linux-users) - * [Install docker](#install-docker) - * [Install docker-compose](#install-docker-compose-1) - * [docker-compose buld frontend](#docker-compose-buld-frontend) - * [docker-compose up frontend](#docker-compose-up-frontend-1) - * [Launch browser. http://localhost:3000](#launch-browser--httplocalhost3000-2) - * [For Mac Users](#for-mac-users) - * [Install Docker desktop](#install-docker-desktop) - * [docker-compose build frontend](#docker-compose-build-frontend) - * [docker-compose up frontend](#docker-compose-up-frontend-2) - * [Launch browser. http://localhost:3000](#launch-browser--httplocalhost3000-3) * [3. Make backend environment](#3-make-backend-environment) * [For Windows(PowerShell) Users](#for-windowspowershell-users-1) * [Install Visutal Studio Build Tools](#install-visutal-studio-build-tools) @@ -35,7 +23,7 @@ Table of Contents * [Install library](#install-library) * [run backend](#run-backend) * [Reload your browser. If you can select the "Algorithm" tab, it is working correctly!](#reload-your-browser-if-you-can-select-the-algorithm-tab-it-is-working-correctly) - * [For Windows(WSL2) or Linux Users](#for-windowswsl2-or-linux-users) + * [For Windows (WSL2) Users](#for-windows-wsl2-users) * [Install gcc, g++](#install-gcc-g) * [Install Anaconda](#install-anaconda-1) * [Create anaconda environment](#create-anaconda-environment-1) @@ -43,16 +31,6 @@ Table of Contents * [Install library](#install-library-1) * [run backend](#run-backend-1) * [Reload your browser. If you can select the "Algorithm" tab, it is working correctly!](#reload-your-browser-if-you-can-select-the-algorithm-tab-it-is-working-correctly-1) - * [For Mac Users](#for-mac-users-1) - * [Install Anaconda](#install-anaconda-2) - * [Create anaconda environment](#create-anaconda-environment-2) - * [Install mamba](#install-mamba-2) - * [Install library](#install-library-2) - * [Install CaImAn](#install-caiman) - * [run backend](#run-backend-2) - * [Reload your browser. If you can select the "Algorithm" tab, it is working correctly!](#reload-your-browser-if-you-can-select-the-algorithm-tab-it-is-working-correctly-2) - * [FAQ](#faq) - # Installation We introduce how to install optinist. We have developed optinist python(backend) and typescript(frontend), so you need to make both environment. @@ -60,12 +38,41 @@ Please follow instructions below.
-# 1. Clone optinist repository +**CAUTION**: We strongly recommend **Windows 10** (not 11). + +**CAUTION**: For WSL2, we confirmed them on [Ubuntu 20.04](https://www.microsoft.com/ja-jp/p/ubuntu-2004-lts/9n6svws3rx71). + + +# 0. GitHub SSH access settings +**You only need to do the following once.** -## For Windows Users If you don't have git installed, you need to install [git-for-windows](https://git-scm.com/download/win) or, git command in WSL2. -**CAUTION**: For WSL2, we confirmed them on [Ubuntu 20.04](https://www.microsoft.com/ja-jp/p/ubuntu-2004-lts/9n6svws3rx71). +On Git Bash or WSL2 +``` +git config --global user.name "user.name" +git config --global user.email "user@oist.jp" +git config --global core.quotepath false +``` +make your ssh key +``` +mkdir ~/.ssh +cd ~/.ssh +ssh-keygen -t rsa -C 'user@oist.jp' +#Enter +#Input passphrase (empty for no passphrase): +#Input passphrase (again) +``` +Open the generated public key (rsa.pub) with a text editor and copy all the contents. +Go to GitHub and follow the steps below to register your public key. + +1. Log in to GitHub and select `Settings` from the menu on the top right +2. Select `SSH and GPG keys` +3. Press `New SSH Key` +4. Enter the `Title` (free) and `Key` (paste the copied content) and press `Add SSH` key. + +This completes the SSH connection settings! +# 1. Clone optinist repository First, you get optinist code from github repository. ``` @@ -77,12 +84,6 @@ Clone CaImAn repository. cd optinist/backend git clone https://github.com/flatironinstitute/CaImAn -b v1.9.7 ``` -## For Mac or Linux users -First, you get optinist code from github repository. -``` -cd "your working repository" -git clone git@github.com:oist/optinist.git -```
# 2. Make frontend environment @@ -125,7 +126,7 @@ yarn run v1.22.17 $ react-scripts start i 「wds」: Project is running at http://192.168.1.xx/ i 「wds」: webpack output is served from -i 「wds」: Content not from webpack is served from C:\Users\playg\Documents\optinist\frontend\public +i 「wds」: Content not from webpack is served from C:\Users\oist\Documents\optinist\frontend\public i 「wds」: 404s will fallback to / Starting the development server... @@ -261,244 +262,6 @@ optinist-frontend-1 | 2022/02/14 04:06:31 [notice] 7#7: start worker process 39 ### Launch browser. http://localhost:3000 It opens correctly! -## For Linux Users -### Install docker -``` -sudo apt update -sudo apt install apt-transport-https ca-certificates curl software-properties-common - -curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - -sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable" -sudo apt update - -sudo apt install docker-ce -``` -- To avoid using docker commands with sudo, you need to set $USER to docker user group. -``` -sudo usermod -aG docker $USER -``` -### Install docker-compose -``` -wget https://github.com/docker/compose/releases/download/v2.2.3/docker-compose-linux-x86_64 -mv docker-compose-linux-x86_64 docker-compose -sudo mv docker-compose /usr/local/bin/docker-compose -``` -### docker-compose buld frontend -``` -docker-compose build frontend -``` -- `docker-compose build frontend` log is as blow: -``` -$ docker-compose up frontend -Sending build context to Docker daemon 465kB -Step 1/8 : FROM node:14 as node -14: Pulling from library/node -a834d7c95167: Pull complete -57b3fa6f1b88: Pull complete -778df3ecaa0f: Pull complete -d353c340774e: Pull complete -6370e0bc373d: Pull complete -fb61153482cd: Pull complete -78fb5822e501: Pull complete -ba3577a691be: Pull complete -bd38fd0dd57b: Pull complete -Digest: sha256:b2c75df8c9706156c38b4f1f678d00e11cb2bfda09fc4ab6e36ec17ac9163865 -Status: Downloaded newer image for node:14 - ---> 9cb3f042a684 -Step 2/8 : COPY . ./ - ---> f688cc7411c1 -Step 3/8 : ENV GENERATE_SOURCEMAP false - ---> Running in bdcec15e8d6a -Removing intermediate container bdcec15e8d6a - ---> 3667fcdd6fda -Step 4/8 : RUN yarn install - ---> Running in 5f5656b1e45e -yarn install v1.22.17 -[1/4] Resolving packages... -[2/4] Fetching packages... -[3/4] Linking dependencies... -warning "@emotion/styled > @emotion/babel-plugin@11.7.2" has unmet peer dependency "@babel/core@^7.0.0". -warning "@emotion/styled > @emotion/babel-plugin > @babel/plugin-syntax-jsx@7.16.7" has unmet peer dependency "@babel/core@^7.0.0-0". -warning " > @mui/x-data-grid@5.5.1" has unmet peer dependency "@mui/system@^5.2.8". -warning " > @testing-library/user-event@12.8.3" has unmet peer dependency "@testing-library/dom@>=7.21.4". -warning " > react-plotlyjs-ts@2.2.2" has incorrect peer dependency "plotly.js@^1.31.2". -warning " > react-plotlyjs-ts@2.2.2" has incorrect peer dependency "react@^16.0.0". -warning " > react-plotlyjs-ts@2.2.2" has incorrect peer dependency "react-dom@^16.0.0". -warning " > react-plotlyjs-ts@2.2.2" has incorrect peer dependency "typescript@^2.5.3". -warning " > styled-components@5.3.3" has unmet peer dependency "react-is@>= 16.8.0". -[4/4] Building fresh packages... -$ cd .. && husky install frontend/.husky -fatal: Not a git repository (or any of the parent directories): .git -Done in 27.26s. -Removing intermediate container 5f5656b1e45e - ---> e2b5f0cd7788 -Step 5/8 : RUN yarn build - ---> Running in 4f2bd6935a86 -yarn run v1.22.17 -$ react-scripts build -Creating an optimized production build... -Compiled successfully. - -File sizes after gzip: - - 1.44 MB build/static/js/2.7d54d872.chunk.js - 21.99 KB build/static/js/main.d29046c0.chunk.js - 1.58 KB build/static/js/3.f30dcf7f.chunk.js - 1.14 KB build/static/css/2.17fb7f09.chunk.css - 1.12 KB build/static/js/runtime-main.3ef6eb24.js - 565 B build/static/css/main.021ef9c2.chunk.css - -The bundle size is significantly larger than recommended. -Consider reducing it with code splitting: https://goo.gl/9VhYWB -You can also analyze the project dependencies: https://goo.gl/LeUzfb - -The project was built assuming it is hosted at /. -You can control this with the homepage field in your package.json. - -The build folder is ready to be deployed. -You may serve it with a static server: - - yarn global add serve - serve -s build - -Find out more about deployment here: - - https://cra.link/deployment - -Done in 55.35s. -Removing intermediate container 4f2bd6935a86 - ---> 28912f086e58 -Step 6/8 : FROM nginx:1.20.1 -1.20.1: Pulling from library/nginx -b380bbd43752: Already exists -83acae5e2daa: Already exists -33715b419f9b: Already exists -eb08b4d557d8: Already exists -74d5bdecd955: Already exists -0820d7f25141: Already exists -Digest: sha256:a98c2360dcfe44e9987ed09d59421bb654cb6c4abe50a92ec9c912f252461483 -Status: Downloaded newer image for nginx:1.20.1 - ---> c8d03f6b8b91 -Step 7/8 : COPY --from=node ./build /usr/share/nginx/html - ---> be1970e94e1d -Step 8/8 : CMD nginx -g "daemon off;" - ---> Running in 53d799653e81 -Removing intermediate container 53d799653e81 - ---> a85095edc139 -Successfully built a85095edc139 -Successfully tagged optinist_frontend:latest - -Use 'docker scan' to run Snyk tests against images to find vulnerabilities and learn how to fix them -$ -``` -### docker-compose up frontend -``` -docker-compose up frontend -``` -- `docker-compose up frontend` log is as blow: -``` -$ docker-compose up frontend -[+] Running 1/1 - ⠿ Container optinist-frontend-1 Recre... 0.0s -Attaching to optinist-frontend-1 -optinist-frontend-1 | 2022/02/14 07:17:09 [notice] 7#7: using the "epoll" event method -optinist-frontend-1 | 2022/02/14 07:17:09 [notice] 7#7: nginx/1.20.1 -optinist-frontend-1 | 2022/02/14 07:17:09 [notice] 7#7: built by gcc 8.3.0 (Debian 8.3.0-6) -optinist-frontend-1 | 2022/02/14 07:17:09 [notice] 7#7: OS: Linux 5.4.0-99-generic -optinist-frontend-1 | 2022/02/14 07:17:09 [notice] 7#7: getrlimit(RLIMIT_NOFILE): 1048576:1048576 -optinist-frontend-1 | 2022/02/14 07:17:09 [notice] 7#7: start worker processes -optinist-frontend-1 | 2022/02/14 07:17:09 [notice] 7#7: start worker process 8 -optinist-frontend-1 | 2022/02/14 07:17:09 [notice] 7#7: start worker process 9 -optinist-frontend-1 | 2022/02/14 07:17:09 [notice] 7#7: start worker process 10 -optinist-frontend-1 | 2022/02/14 07:17:09 [notice] 7#7: start worker process 11 -optinist-frontend-1 | 2022/02/14 07:17:09 [notice] 7#7: start worker process 12 -optinist-frontend-1 | 2022/02/14 07:17:09 [notice] 7#7: start worker process 13 -optinist-frontend-1 | 2022/02/14 07:17:09 [notice] 7#7: start worker process 14 -optinist-frontend-1 | 2022/02/14 07:17:09 [notice] 7#7: start worker process 15 -optinist-frontend-1 | 2022/02/14 07:17:09 [notice] 7#7: start worker process 16 -optinist-frontend-1 | 2022/02/14 07:17:09 [notice] 7#7: start worker process 17 -optinist-frontend-1 | 2022/02/14 07:17:09 [notice] 7#7: start worker process 18 -optinist-frontend-1 | 2022/02/14 07:17:09 [notice] 7#7: start worker process 19 -optinist-frontend-1 | 2022/02/14 07:17:09 [notice] 7#7: start worker process 20 -optinist-frontend-1 | 2022/02/14 07:17:09 [notice] 7#7: start worker process 21 -optinist-frontend-1 | 2022/02/14 07:17:09 [notice] 7#7: start worker process 22 -optinist-frontend-1 | 2022/02/14 07:17:09 [notice] 7#7: start worker process 23 -optinist-frontend-1 | 2022/02/14 07:17:09 [notice] 7#7: start worker process 24 -optinist-frontend-1 | 2022/02/14 07:17:09 [notice] 7#7: start worker process 25 -optinist-frontend-1 | 2022/02/14 07:17:09 [notice] 7#7: start worker process 26 -optinist-frontend-1 | 2022/02/14 07:17:09 [notice] 7#7: start worker process 27 -optinist-frontend-1 | 2022/02/14 07:17:09 [notice] 7#7: start worker process 28 -optinist-frontend-1 | 2022/02/14 07:17:09 [notice] 7#7: start worker process 29 -optinist-frontend-1 | 2022/02/14 07:17:09 [notice] 7#7: start worker process 30 -optinist-frontend-1 | 2022/02/14 07:17:09 [notice] 7#7: start worker process 31 -``` -### Launch browser. http://localhost:3000 -It opens correctly! -## For Mac Users -### Install Docker desktop -- Install [Docker Desktop](https://www.docker.com/products/docker-desktop) for Mac. - -### docker-compose build frontend -``` -docker-compose build frontend -``` -- `docker-compose build frontend` log is as blow: -``` -$ docker-compose build frontend -[+] Building 301.5s (9/11) -[+] Building 329.7s (9/11) -[+] Building 455.9s (12/12) FINISHED - => [internal] load build definition from Dockerfile 0.0s - => => transferring dockerfile: 224B 0.0s - => [internal] load .dockerignore 0.0s - => => transferring context: 70B 0.0s - => [internal] load metadata for docker.io/library/nginx:1.20.1 4.3s - => [internal] load metadata for docker.io/library/node:14 4.3s - => [internal] load build context 0.2s - => => transferring context: 1.08MB 0.2s - => CACHED [node 1/4] FROM docker.io/library/node:14@sha256:b2c75df8c9706156c3 0.0s - => CACHED [stage-1 1/2] FROM docker.io/library/nginx:1.20.1@sha256:a98c2360dc 0.0s - => [node 2/4] COPY . ./ 0.1s - => [node 3/4] RUN yarn install 123.0s - => [node 4/4] RUN yarn build 316.1s - => [stage-1 2/2] COPY --from=node ./build /usr/share/nginx/html 0.1s - => exporting to image 0.1s - => => exporting layers 0.1s - => => writing image sha256:4953a0a63a7842e7a108d4d32c567e04de5fbae87d83d9f792 0.0s - => => naming to docker.io/library/optinist_frontend 0.0s -Use ‘docker scan’ to run Snyk tests against images to find vulnerabilities and learn how to fix them -$ -``` - -If you haven't installed docker-compose, you need to install docker-compose. -``` -wget https://github.com/docker/compose/releases/download/v2.2.3/docker-compose-darwin-x86_64 -mv docker-compose-darwin-x86_64 docker-compose -sudo mv docker-compose /usr/local/bin/docker-compose -``` - -### docker-compose up frontend -``` -docker-compose up frontend -``` -- `docker-compose up frontend` log is as blow: -``` -$ docker-compose up frontend -+] Running 1/1 -⠿ Container optinist-frontend-1 Recreated 0.2s -Attaching to optinist-frontend-1 -optinist-frontend-1 | 2022/02/14 06:38:16 [notice] 7#7: using the “epoll” event method -optinist-frontend-1 | 2022/02/14 06:38:16 [notice] 7#7: nginx/1.20.1 -optinist-frontend-1 | 2022/02/14 06:38:16 [notice] 7#7: built by gcc 8.3.0 (Debian 8.3.0-6) -optinist-frontend-1 | 2022/02/14 06:38:16 [notice] 7#7: OS: Linux 5.10.76-linuxkit -optinist-frontend-1 | 2022/02/14 06:38:16 [notice] 7#7: getrlimit(RLIMIT_NOFILE): 1048576:1048576 -optinist-frontend-1 | 2022/02/14 06:38:16 [notice] 7#7: start worker processes -optinist-frontend-1 | 2022/02/14 06:38:16 [notice] 7#7: start worker process 8 -optinist-frontend-1 | 2022/02/14 06:38:16 [notice] 7#7: start worker process 9 -``` -### Launch browser. http://localhost:3000 -It opens correctly! -
# 3. Make backend environment @@ -555,7 +318,7 @@ python main.py ### Reload your browser. If you can select the "Algorithm" tab, it is working correctly! Done! -## For Windows(WSL2) or Linux Users +## For Windows (WSL2) Users ### Install gcc, g++ - For install CaImAn, you need to install gcc and g++. ``` @@ -602,69 +365,4 @@ INFO: Waiting for application startup. INFO: Application startup complete. ``` ### Reload your browser. If you can select the "Algorithm" tab, it is working correctly! -Done! - - -## For Mac Users -### Install Anaconda -Download https://repo.anaconda.com/archive/Anaconda3-2021.11-MacOSX-x86_64.pkg - -Install - -### Create anaconda environment -``` -conda create -n optinist python=3.8 -conda activate optinist -``` -### Install mamba -We use snakemake library, and it requires mamba. -``` -conda install -n base -c conda-forge mamba -``` -### Install library -```bash -cd backend -pip install -r requirements.txt -cd .. -``` - -In case an error occuered when you install ``` requirements.txt ```, pip upgrade command below may solve the error. -``` -pip install --upgrade pip -``` - -### Install CaImAn -**CAUTION for M1 Mac User** -We use tensorflow in caiman code. We know that M1 mac doesn't install tensorflow easily, so if there is a problem, skip install caiman. (Release in progress…) - -If you are m1 mac user, skip this. - -```bash -# for CaImAn -git clone https://github.com/flatironinstitute/CaImAn -b v1.9.7 -pip install cython opencv-python matplotlib scikit-image==0.18.0 scikit-learn ipyparallel holoviews watershed tensorflow -cd CaImAn -pip install -e . -cd .. -``` -### run backend -``` -python main.py -``` -- `python main.py` log is as blow: -``` -$ python main.py -INFO: Will watch for changes in these directories: [‘/Users/oist/work/optinist/backend’] -INFO: Uvicorn running on http://0.0.0.0:8000 (Press CTRL+C to quit) -INFO: Started reloader process [2678] using statreload -INFO: Started server process [2690] -INFO: Waiting for application startup. -INFO: Application startup complete. -``` -### Reload your browser. If you can select the "Algorithm" tab, it is working correctly! -Done! - - -### FAQ -If you get the warning message shown below, we recommend `rm -rf /Users/usename/opt/anaconda3/envs/optinist ` and recreate conda environment. -> WARNING: A directory already exists at the target location '/Users/usename/opt/anaconda3/envs/optinist' but it is not a conda environment. +Done! \ No newline at end of file From facc8e96d9841259d64b6fcf06a4c6b1ec2154cc Mon Sep 17 00:00:00 2001 From: Shuya Saeki Date: Mon, 21 Feb 2022 14:45:26 +0900 Subject: [PATCH 2/2] Fixed link URL. --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index aee8ea726..9294ed807 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ # optinist How to install and use optinist - Installation - - [for Windows](https://github.com/oist/optinist/blob/develop/docs/installation_for_windows.md) - - [for Mac](https://github.com/oist/optinist/blob/develop/docs/installation_for_mac.md) - - [for Linux](https://github.com/oist/optinist/blob/develop/docs/installation_for_linux.md) -- [How to use gui flowchart](https://github.com/oist/optinist/blob/develop/docs/gui_flowchart.md) -- [How to use gui visualize](https://github.com/oist/optinist/blob/develop/docs/gui_visualize.md) + - [for Windows](docs/installation_for_windows.md) + - [for Mac](docs/installation_for_mac.md) + - [for Linux](docs/installation_for_linux.md) +- [How to use gui flowchart](docs/gui_flowchart.md) +- [How to use gui visualize](docs/gui_visualize.md)