-
Notifications
You must be signed in to change notification settings - Fork 6
Add guide to run tutorials using a Jupyter Docker image #518
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,22 +6,22 @@ These tutorials were designed with the goal of building intution and introduce s | |
|
|
||
| ### Setup using conda | ||
|
|
||
| 1. Check that you have [conda](https://docs.conda.io/en/latest/) installed. | ||
| To do so, run | ||
| 1. Check that you have [conda](https://docs.conda.io/en/latest/) installed. | ||
| To do so, run | ||
| ```sh | ||
| conda list | ||
| ``` | ||
| 2. Run | ||
| 2. Run | ||
| ```sh | ||
| ./create_environment | ||
| ``` | ||
| to generate the environment and install the dependencies. | ||
| to generate the environment and install the dependencies. | ||
|
|
||
| 1. `cd` into the [python](../python) directory. | ||
|
|
||
| ### Setup using virtualenv | ||
|
|
||
| 1. Check that [virtualenv](https://github.com/pyenv/pyenv) is installed, if not then run | ||
| 1. Check that [virtualenv](https://github.com/pyenv/pyenv) is installed, if not then run | ||
| ```sh | ||
| pip install virtualenv | ||
| ``` | ||
|
|
@@ -42,10 +42,102 @@ pip install -r requirements.txt | |
| ## Starting the notebooks | ||
|
|
||
| 1. Make sure the `albatross` virtual environment is activated. | ||
| 2. `cd` into to the [tutorials](../tutorials) directory. | ||
| 3. Run | ||
| 2. `cd` into to the [tutorials](../tutorials) directory. | ||
| 3. Run | ||
| ```sh | ||
| jupyter notebook | ||
| ``` | ||
| to start up the IPython notebooks in your browser. | ||
| to start up the IPython notebooks in your browser. | ||
|
|
||
|
|
||
| ## Launching the tutorials using Docker | ||
|
|
||
| Docker provides an isolated environment with all necessary dependencies pre-installed, making it the easiest way to get started with the Albatross tutorials without worrying about local Python environment conflicts. | ||
|
|
||
| ### Prerequisites | ||
|
|
||
| 1. Install [Docker](https://docs.docker.com/get-docker/) on your system | ||
| 2. Ensure Docker is running by checking: | ||
|
|
||
| ```sh | ||
| docker --version | ||
| ``` | ||
|
|
||
| ### Step-by-step Docker setup | ||
|
|
||
| 1. **Navigate to the albatross root directory** | ||
|
|
||
| ```sh | ||
| cd /path/to/albatross | ||
| ``` | ||
|
|
||
| 2. **Pull the Jupyter Data Science notebook image** | ||
|
|
||
| ```sh | ||
| docker pull jupyter/datascience-notebook:latest | ||
| ``` | ||
|
|
||
| This image contains Jupyter Lab with popular data science libraries (numpy, pandas, matplotlib, scipy, etc.) pre-installed. | ||
|
|
||
| 3. **Launch the Docker container** | ||
|
|
||
| ```sh | ||
| docker run -ti -p 8888:8888 -v `pwd`:/home/jovyan jupyter/datascience-notebook:latest | ||
| ``` | ||
|
|
||
| **Command breakdown:** | ||
| - `-ti`: Run in interactive mode with a TTY | ||
| - `-p 8888:8888`: Map port 8888 from container to host | ||
| - `-v \`pwd\`/albatross:/home/jovyan`: Mount the albatross directory into the container | ||
|
||
| - The container will start and display a URL with a token | ||
|
|
||
| 4. **Access Jupyter Lab** | ||
|
|
||
| Copy the URL from the terminal output (it will look like `http://127.0.0.1:8888/lab?token=...`) and paste it into your browser, or simply go to [http://127.0.0.1:8888/lab](http://127.0.0.1:8888/lab) and enter the token when prompted. | ||
|
|
||
| 5. **Install Albatross-specific requirements** | ||
|
|
||
| Once Jupyter Lab is open, click on the "Terminal" tile in the launcher to open a terminal, then run: | ||
|
|
||
| ```bash | ||
| pip install -r python/requirements.txt | ||
| ``` | ||
|
|
||
| This installs additional packages required for the tutorials: | ||
| - `emcee`: MCMC sampling library | ||
| - `gpflow`: Gaussian Process library | ||
| - `pyproj`: Cartographic projections | ||
| - `seaborn`: Statistical visualization | ||
| - And other dependencies | ||
|
|
||
| 6. **Start working with tutorials** | ||
|
|
||
| Navigate to the `tutorials/` folder in the file browser and open any of the available notebooks: | ||
| - `tutorial_1_one_dimension.ipynb` - Introduction to 1D Gaussian Processes | ||
| - `tutorial_2_maximum_likelihood_estimation.ipynb` - Parameter estimation | ||
| - `tutorial_3_one_dimension_sparse.ipynb` - Sparse GPs for scalability | ||
| - `tutorial_4_kalman_fliter_equivalent.ipynb` - Time series applications | ||
| - `tutorial_5_evaluating_uncertainty.ipynb` - Uncertainty quantification | ||
|
|
||
| ### Troubleshooting | ||
|
|
||
| - **Port 8888 already in use**: If you get a port binding error, either stop the existing service using port 8888 or use a different port: | ||
|
|
||
| ```sh | ||
| docker run -ti -p 8889:8888 -v `pwd`/albatross:/home/jovyan jupyter/datascience-notebook:latest | ||
|
||
| ``` | ||
|
|
||
| Then access via [http://127.0.0.1:8889/lab](http://127.0.0.1:8889/lab) | ||
|
|
||
| - **Permission issues**: On Linux/macOS, you might need to add your user to the docker group or run with `sudo` | ||
|
|
||
| - **Volume mounting issues**: Ensure you're running the command from the albatross root directory | ||
|
|
||
| ### Stopping the container | ||
|
|
||
| To stop the container, press `Ctrl+C` in the terminal where Docker is running, or run: | ||
|
|
||
| ```sh | ||
| docker ps # Find the container ID | ||
| docker stop <container_id> | ||
| ``` | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we include the
--rmflag? https://docs.docker.com/reference/cli/docker/container/run/#rmThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added in a new commit of this PR. Thanks!