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.gitand open the repository with:
cd deepcell-labelThere 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!
Open the subfolder for the backend:
cd backendSet 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.txtFlask 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 runBy 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.
Make sure to be in the /deepcell_label folder inside of the backend:
cd deepcell-label/backend/deepcell_labelThen run the tests using the -m flag with pytest:
python -m pytest .The backend can also be containerized with Docker. To build a production-ready Docker image, run:
docker build -t vanvalenlab/deepcell-label:$USERThe built image can run the backend on port 5000 with:
docker run -p 5000:5000 -it vanvalenlab/deepcell-label:$USEREnvrionment variables like SQLALCHEMY_DATABASE_URI can be passed to the run command using the environment variable flags: -e and --env.
Once the server is running, we need to set up the frontend. Install the dependencies for the frontend with:
cd frontend
yarnThen, start the frontend with:
yarn startVisit localhost:3000 to see the DeepCell Label homepage.
Run the Jest tests with:
yarn testAnd open the Cypress UI with:
npx cypress openThey can also be run from command line with:
npx cypress run- If SQLAlchemy is giving Operational Errors, it could be because the
/tmpfolder 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