Giter Club home page Giter Club logo

jupyter-mentor's Introduction

jupyter-mentor

Developing locally with conda

Assuming you have conda installed…

  1. Create a new environment using version 3.11 of python with the following command:
conda create -f environment.yml
  1. Go to the directory of your cloned repository and activate your envrionment:
conda activate jupyter-mentor
  1. Open the JupyterLab editor:
cd path/to/your/cloned/repo
jupyter lab

Developing with Docker

WARNING! Development with Docker is not recommended at this time. However, GitHub actions runs repo2docker to verify that this repository is compatible with Binder.

Developing on MacOS

  1. Install Docker with brew install --cask docker. If this command does not work, you may need to install Homebrew
  2. Start Docker by clicking on application icon or by running open -a Docker
  3. Pull the docker image from DockerHub to you local machine using docker image pull brewer36/jupyter-mentor:macos
  4. cd <location_of_your_clone>
  5. Launch JupyterLab with docker run -it --rm -p 8888:8888 brewer36/jupyter-mentor:macos jupyter lab --ip=0.0.0.0 --port=8888

Updating brewer36/jupyter-mentor:latest (linux) image with GitHub acitons

No extra steps required. This GitHub action automatically updates the image with each new commit.

Updating brewer36/jupyter-mentor:macos (arm64 for M1 chip) image with repo2docker

  1. Install repo2docker with python3 -m pip install jupyter-repo2docker
  2. cd <location_of_your_clone>
  3. repo2docker --Repo2Docker.platform=linux/arm64 --image-name=brewer36/jupyter-mentor:macos ./

jupyter-mentor's People

Contributors

nicole-brewer avatar namitasshah avatar alexandsomeadventures avatar

jupyter-mentor's Issues

Voila interface

According to the JupyterAI docs, "Custom prompt templates are not used in the chat interface yet."

But that doesn't mean we can't create our own interface using ipywidgets and Voila.

Docker image doesn't work on Mac with M1 chip

My goal

I'd like to be able to use the repo2docker-action to create a Docker image based of the configuration files in my repository.

What is working

I am able to successfully create such an image under name brewer36/jupyter-mentor:latest with the following GitHub actions configuration:

name: Build Notebook Container
on: [push, workflow_dispatch]
jobs:
  build:
    runs-on: ubuntu-latest
    steps:

    - name: checkout files in repo
      uses: actions/checkout@main

    - name: update jupyter dependencies with repo2docker
      uses: jupyterhub/repo2docker-action@master
      with:
        DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
        DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}

The problem

My problem is that I'm finding it difficult to get GitHub actions to create a Docker image that is compatible with the Mac M1 chip, which has arm64 architecture. All of my attempts thus far, no matter what configuration variables I use, result in an amd64 image. Docker warns me that that this image may have poor performance or fail, because the image is based off of a different architecture.

Screenshot 2024-03-15 at 12 30 04 PM

What I have been able to get working

As debugging a remote action is time consuming and difficult, I started first trying to make progress locally. I installed repo2docker and looked at various issues discussing how to make repo2docker work with a Mac M1. Issue #1174 was helpful because it showed me how to specify extra build args that are not in the repo2docker documentation on the web (it is only available by running repo2docker --help-all). Specifically the argument --Repo2Docker.extra_build_args=platform=linux/amd64. Using this flag, I am able to build a similar Docker image on my local machine using the command

repo2docker --Repo2Docker.platform=linux/arm64 --image-name=brewer36/jupyter-mentor:macos ./

where ./ refers to the current directory, which is the base directory of my local clone of the Jupyter4Science/jupyter-mentor) repository. This results in a local Docker image I can then push to my DockerHub account.

Screenshot 2024-03-15 at 1 24 43 PM

This solution may have to be "good enough".

What has not worked for me

Ideally, I'd like to get this working from github actions so I don't have to do it locally, but as of today I'm not sure this is possible. I tried using the platform=linux/arm64 argument in repo2docker-action as such:

    - name: update jupyter dependencies with repo2docker
      uses: jupyterhub/repo2docker-action@master
      with:
        DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
        DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
        REPO2DOCKER_EXTRA_ARGS: --Repo2Docker.platform=linux/arm64

but on the update jupyter dependencies with repo2docker step of the action I received and error because the image platform doesn't match the host platform:

  Step 2/50 : ENV DEBIAN_FRONTEND=noninteractive
  Warning: rning] The requested image's platform (linux/arm64/v8) does not match the detected host platform (linux/amd64/v3) and no specific platform was requested
   ---> Running in b74454c1f2a4
  Removing intermediate container b74454c1f2a4
   ---> ad1affe2197d
  Step 3/50 : RUN apt-get -qq update &&     apt-get -qq install --yes --no-install-recommends locales > /dev/null &&     apt-get -qq purge &&     apt-get -qq clean &&     rm -rf /var/lib/apt/lists/*
  Warning: rning] The requested image's platform (linux/arm64/v8) does not match the detected host platform (linux/amd64/v3) and no specific platform was requested
   ---> Running in abe671557370
  exec /bin/sh: exec format error

In attempt to resolve this error, I tried running the action on macos-14 but that isn't currently supported by repo2docker.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.