Installation
- There are two ways for installing the project:
install all the dependencies yourself.
use a Docker image to run the code.
The Docker image contains all the C dependencies and python packages, that can be sometimes very time consuming to install depending on your OS. So I recommend using the Docker image. The code is using some of the astromatic softwares that can be difficult to run on Windows. So, it is strongly advised to use the Docker image for Windows users.
Prerequisites
For both ways you will need to get the project first.
The sources for otrain can be downloaded from the Github repo.
Either clone public repository:
If git is not installed on your machine, see: https://git-scm.com/book/en/v2/Getting-Started-Installing-Git
Then clone the project:
git clone git://github.com/dcorre/otrain
Note that you will need to update the project regularly to check for updates. Ideally each time you want to use it, type the following command to search for updates:
git pull origin master
Or download:
Simply download this tarball. Or through the console:
curl -OL https://github.com/dcorre/otrain/tarball/master
Cloning the project allows to retrieve easily future code updates. If you downloaded the project, you will need to download it again to retrieve future updates.
Installation with Docker
The usage of a Docker allows to build an OS environment on your machine and thus avoid compatibility problems when running the code under Linux, Mac or Windows. If you have not Docker installed on your machine install it first.
Install the Docker desktop for your OS: https://docs.docker.com/get-docker/
To run Docker without appending sudo, type:
sudo groupadd docker
sudo usermod -aG docker $USER
Log out and log back in so that your group membership is re-evaluated. For more information see https://docs.docker.com/engine/install/linux-postinstall/#manage-docker-as-a-non-root-user.
You can test that Docker is installed correctly and can be run without sudo:
docker run hello-world
Download the otrain Docker image
To retrieve the Docker image:
docker pull dcorre/otrain
Check that it appears in the list of images:
docker images
Installation without Docker
I advise to create a virtual environment to avoid messing with different python libraries version that could be already installed on your computer and required for other projects.
Install conda: https://docs.conda.io/en/latest/miniconda.html
You can also install everything with pip if you prefer not to use conda.
Python 3 environment:
conda create -n otrain python=3.8 numpy scipy matplotlib astropy h5py scikit-image
Activate the environment:
conda activate otrain
Install other libraries
Once you have activated the environment, install the packages that are not available with conda using pip:
python3 -m pip install keras tensorflow opencv-python-headless sklearn
Testing that it is working
Run Docker
Run the Docker image in the background:
docker run --name otrain -dit -v /path_to_your_data/:/home/newuser/data/ dcorre/otrain
:.Once you have executed this command, you can run any command in the container by typing:
docker exec otrain ls
docker exec otrain pwd
to make a ls or a pwd in the container named otrain, or any other bash commands.
In the following, if you are using a Docker image just prepend the command `docker exec otrain` to run the given commands within the container instead of your machine.
The container is alive as long as you do not shut down your machine. It is important to know that you can not give the same name to two containers. So if for some reasons you need to remove the current container to start a new one, type:
docker rm otrain
You can list the containers, active or not, on your machine with:
docker ps -a
Install otrain
Inside the Docker image
Already installed.
Without Docker image
python3 setup.py develop
Run otrain on a test image
To test if otrain is running normally:
otrain-train -h
It should return you the list of accepted arguments for this executable.