Skip to content

Latest commit

 

History

History
125 lines (84 loc) · 3.52 KB

LOCAL_USE.md

File metadata and controls

125 lines (84 loc) · 3.52 KB

Local use

To run DeepCell Label locally, you will set up the client and the server from your computer. If you haven't worked with Python or Javascript projects before, follow the first time setup instructions to install Python and Node.js.

To start, clone the repository with:

git clone https://github.com/vanvalenlab/deepcell-label.git

and open the repository with:

cd deepcell-label

Configuring project size

There is a configurable upper bound to the size of project deepcell-label supports. This value is stored in backend/.platform/nginx/conf.d/proxy.conf and can be modified to support larger projects. Bear in mind however that projects are uploaded/downloaded from s3 buckets, so beware of increasing this value too much lest the size of the bucket grows too rapidly!

Set up Flask backend

Open the subfolder for the backend:

cd backend

Set up a virtual environment with conda or venv. After setting up and activating the virtual environment, install the Python dependencies with:

pip install -r requirements.txt
pip install -r requirements-test.txt

Flask requires some environment variables to be set, like FLASK_APP. We need to set export FLASK_APP=application in the terminal or in an .env file. There is an example .env.example with FLASK_APP already set. Make a copy and rename the file .env. Then, start the server with:

flask run

By default, DeepCell Label creates a temporary database in /tmp. Change SQLALCHEMY_DATABASE_URI in your .env, for example SQLALCHEMY_DATABASE_URI=sqlite:///~/Documents/deepcell_label.db, to make a persistent database in another location.

Running the backend tests

Make sure to be in the /deepcell_label folder inside of the backend:

cd deepcell-label/backend/deepcell_label

Then run the tests using the -m flag with pytest:

python -m pytest .

Run with Docker

The backend can also be containerized with Docker. To build a production-ready Docker image, run:

docker build -t vanvalenlab/deepcell-label:$USER

The built image can run the backend on port 5000 with:

docker run -p 5000:5000 -it vanvalenlab/deepcell-label:$USER

Envrionment variables like SQLALCHEMY_DATABASE_URI can be passed to the run command using the environment variable flags: -e and --env.

Set up Javascript frontend

Once the server is running, we need to set up the frontend. Install the dependencies for the frontend with:

cd frontend
yarn

Then, start the frontend with:

yarn start

Visit localhost:3000 to see the DeepCell Label homepage.

Running the frontend tests

Run the Jest tests with:

yarn test

And open the Cypress UI with:

npx cypress open

They can also be run from command line with:

npx cypress run

Common Issues (Especially on Windows)

  • If SQLAlchemy is giving Operational Errors, it could be because the /tmp folder does not exist, which will need to be created (e.g. on C: for Windows)
  • On Windows, after installing Python requirements, you probably have to run
    pip uninstall python-magic
    pip install python-magic-bin==0.4.14