Jupyter - DrAlzahraniProjects/csusb_fall2024_cse6550_team2 GitHub Wiki
- Make sure Python is version 3.7 or later by using this comand
python --version
- Make sure that pip is up to date using this command
python -m pip install --upgrade pip
1. Add Jupyter as a requirement in requirement.txt so it installs along with the other required Python packages
Image 1: Jupyter added to requirements.txt
Before adding jupyter to the docker, make sure docker is installed by using the following command in the terminal:
docker --version
If it is not installed, you should go to the Docker wiki page and follow the instillation steps
Image 2: Copy requirements.txt to Docker
This should copy the requirements.txt
into /app/requirements.txt
, from where the required packages will be downloaded
Make sure that the python version is at least 3.6 and you can go here to make sure its up to date. When on the required version you can use the following command in the terminal to install jupyter
pip install jupyter
When it is installed, we can use the lines in the image below to install Jupyter directly into the Dockerfile
Image 3: Install Jupyter notebook
Type the following command into the terminal to make sure that it's properly installed
jupyter --version
Using this url we are able to open the notebook
jupyter notebook --generate-config
2. The image below shows how the notebook’s configuration is set by creating a directory with all the configuration
Image 4: Configure notebook
###3. You should be able to access the notebook by using this command in the terminal
jupyter notebook
Or you can go to this url
The note book should look like the image below
Image 5: Jupyter Notebook
This makes sure that jupyter is implemented
Image 6: Jupyter notebook implementation
Use the flowing command to open Jupyter notebook with docker on port 6002. This allows you to open the notebook through localhost
docker run -p 6002:6002 team2-app
The command below allows us to run jupyter notebook on port 6002 through the docker
Image 7: Change jupyter port
Using Markdown and Python, we can create the following
Image 8: Juputer notebook example
by writing the text in image 9 into mark down
Image 9: Markdown text
Markdown allows us to write well-formatted notes using this format
# for titles
## for major headings
### for subheadings
- for bullet points
Jupyter allows us to use python normally alongside the markdowns so we can describe every segment of code in detail
Image 10: Python in jupyter notebook
Using the steps above we documented our code into jupyter notebook
Image 11: Jupyter Notebook with Markdown, Python code cell, and the output of the code cell
Visit the Jupyter Notebook Documentation for more details on how we documented the code.
If you are unable to open Jupyter Notebook in the browser, make sure that port 6002 is properly mapped to Docker. You can also use this command to check for port conflicts
docker run -p 82:82 -p 5002:5002 -p 6002:6002 team2-app
Increase Docker container resource limits to ensure sufficient resources are allocated by using the command below
docker run -m 4g --cpus="2" -p 6002:6002 your_image_name
If there are any errors installing packages, make sure the requirement.txt
file is correctly specified and check the version specified is comparable to avoid dependency conflicts
Used to check Jupyter logs
jupyter notebook --debug