Skip to content
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

Double check that codespaces containers are functioning for assignments #60

Open
sgbaird opened this issue Sep 20, 2024 · 5 comments
Open
Assignees

Comments

@sgbaird
Copy link
Member

sgbaird commented Sep 20, 2024

I.e., fresh/from scratch. If they're not functioning properly (i.e., codespaces goes into container recovery mode), then the .devcontainer file will likely need to be updated. While debugging, it may be necessary to delete the codespace altogether and create a new one (or maybe just use factory rebuild container command).

@sgbaird
Copy link
Member Author

sgbaird commented Nov 8, 2024

creation-log.txt from https://github.com/ACC-Robotics/robotics-8a3a78-5-computer-vision-5-Computer-vision (reported by @RubainaFarin31).

Current (non-functioning) devcontainer.json:

{
	"name": "Python 3",
	"build": {
		"dockerfile": "Dockerfile",
		"context": "..",
		"args": {
			"VARIANT": "3.10-bullseye",
			"NODE_VERSION": "none"
		}
	},
	"customizations": {
		"vscode": {
			"extensions": [
				"ms-python.python",
				"ms-python.vscode-pylance",
				"GitHub.vscode-github-actions",
				"GitHub.copilot",
				"GitHub.copilot-chat",
				"ms-toolsai.jupyter",
				"ms-python.black-formatter"
			]
		}
	},
	"onCreateCommand": "sudo cp .devcontainer/welcome.txt /usr/local/etc/vscode-dev-containers/first-run-notice.txt",
	"postCreateCommand": "sudo -H pip3 install -r requirements.txt && sudo apt-get update && sudo apt-get install -y libopencv-dev"
}

Notice the additional sudo apt-get install -y libopencv-dev.

Makefile

ARG VARIANT="3.10-bullseye"
FROM mcr.microsoft.com/vscode/devcontainers/python:0-${VARIANT}

# Install system dependencies
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
    && apt-get -y install --no-install-recommends \
    libopencv-dev \
    python3-opencv \
    && apt-get clean -y && rm -rf /var/lib/apt/lists/*

# Install Python packages
COPY requirements.txt /tmp/pip-tmp/
RUN pip3 --disable-pip-version-check --no-cache-dir install -r /tmp/pip-tmp/requirements.txt \
    && rm -rf /tmp/pip-tmp

`requirements.txt

-e . # package from this repo
numpy
scipy
pandas
matplotlib
opencv-python
apriltag
pytest
pylint
black
ipython
ipykernel

Creation log snippet:

...
2024-11-08 16:50:23.602Z: #6 54.41 Setting up libopencv-contrib4.5:amd64 (4.5.1+dfsg-5) ...
2024-11-08 16:50:23.603Z: 
#6 54.42 Setting up libopencv-videostab-dev:amd64 (4.5.1+dfsg-5) ...

#6 54.42 Setting up libopencv-stitching-dev:amd64 (4.5.1+dfsg-5) ...

#6 54.43 Setting up python3-opencv (4.5.1+dfsg-5) ...

#6 54.44 Setting up libopencv-superres4.5:amd64 (4.5.1+dfsg-5) ...

#6 54.45 Setting up libopencv-superres-dev:amd64 (4.5.1+dfsg-5) ...

#6 54.45 Setting up libopencv-contrib-dev:amd64 (4.5.1+dfsg-5) ...

#6 54.46 Setting up libopencv-dev (4.5.1+dfsg-5) ...

#6 54.47 Processing triggers for libc-bin (2.31-13+deb11u6) ...

2024-11-08 16:50:24.618Z: #6 DONE 55.6s
2024-11-08 16:50:24.808Z: 
2024-11-08 16:50:24.808Z: #7 [dev_container_auto_added_stage_label 3/4] COPY requirements.txt /tmp/pip-tmp/
#7 DONE 0.0s

#8 [dev_container_auto_added_stage_label 4/4] RUN pip3 --disable-pip-version-check --no-cache-dir install -r /tmp/pip-tmp/requirements.txt     && rm -rf /tmp/pip-tmp
2024-11-08 16:50:25.770Z: #8 1.112 Obtaining file:/// (from -r /tmp/pip-tmp/requirements.txt (line 1))
2024-11-08 16:50:25.941Z: #8 1.114 ERROR: file:/// (from -r /tmp/pip-tmp/requirements.txt (line 1)) does not appear to be a Python project: neither 'setup.py' nor 'pyproject.toml' found.
#8 ERROR: process "/bin/sh -c pip3 --disable-pip-version-check --no-cache-dir install -r /tmp/pip-tmp/requirements.txt     && rm -rf /tmp/pip-tmp" did not complete successfully: exit code: 1
------
2024-11-08 16:50:25.942Z:  > [dev_container_auto_added_stage_label 4/4] RUN pip3 --disable-pip-version-check --no-cache-dir install -r /tmp/pip-tmp/requirements.txt     && rm -rf /tmp/pip-tmp:
1.112 Obtaining file:/// (from -r /tmp/pip-tmp/requirements.txt (line 1))
1.114 ERROR: file:/// (from -r /tmp/pip-tmp/requirements.txt (line 1)) does not appear to be a Python project: neither 'setup.py' nor 'pyproject.toml' found.
------
2024-11-08 16:50:25.943Z: Dockerfile-with-features:15
--------------------
  14 |     COPY requirements.txt /tmp/pip-tmp/
  15 | >>> RUN pip3 --disable-pip-version-check --no-cache-dir install -r /tmp/pip-tmp/requirements.txt \
  16 | >>>     && rm -rf /tmp/pip-tmp
  17 |     
--------------------
ERROR: failed to solve: process "/bin/sh -c pip3 --disable-pip-version-check --no-cache-dir install -r /tmp/pip-tmp/requirements.txt     && rm -rf /tmp/pip-tmp" did not complete successfully: exit code: 1
2024-11-08 16:50:25.949Z: Stop: Run: docker buildx build --load --build-arg BUILDKIT_INLINE_CACHE=1 -f /tmp/devcontainercli-root/container-features/0.68.0-1731084521696/Dockerfile-with-features -t vsc-5-computer-vision-********-61014790013b1d184ccc1db265d0bf138f72c6a528fe056a9c1672b6a63a9bd5 --target dev_containers_target_stage --build-arg VARIANT=3.10-bullseye --build-arg NODE_VERSION=none --build-arg _DEV_CONTAINERS_BASE_IMAGE=dev_container_auto_added_stage_label /var/lib/docker/codespacemount/workspace/5-computer-vision-********
2024-11-08 16:50:25.949Z: Error: Command failed: docker buildx build --load --build-arg BUILDKIT_INLINE_CACHE=1 -f /tmp/devcontainercli-root/container-features/0.68.0-1731084521696/Dockerfile-with-features -t vsc-5-computer-vision-sgbaird-61014790013b1d184ccc1db265d0bf138f72c6a528fe056a9c1672b6a63a9bd5 --target dev_containers_target_stage --build-arg VARIANT=3.10-bullseye --build-arg NODE_VERSION=none --build-arg _DEV_CONTAINERS_BASE_IMAGE=dev_container_auto_added_stage_label /var/lib/docker/codespacemount/workspace/5-computer-vision-sgbaird
2024-11-08 16:50:25.949Z:     at FtA (/.codespaces/agent/bin/node_modules/@devcontainers/cli/dist/spec-node/devContainersSpecCLI.js:466:1933)
2024-11-08 16:50:25.950Z: {"outcome":"error","message":"Command failed: docker buildx build --load --build-arg BUILDKIT_INLINE_CACHE=1 -f /tmp/devcontainercli-root/container-features/0.68.0-1731084521696/Dockerfile-with-features -t vsc-5-computer-vision-sgbaird-61014790013b1d184ccc1db265d0bf138f72c6a528fe056a9c1672b6a63a9bd5 --target dev_containers_target_stage --build-arg VARIANT=3.10-bullseye --build-arg NODE_VERSION=none --build-arg _DEV_CONTAINERS_BASE_IMAGE=dev_container_auto_added_stage_label /var/lib/docker/codespacemount/workspace/5-computer-vision-sgbaird","description":"An error occurred building the image."}
2024-11-08 16:50:25.950Z:     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
2024-11-08 16:50:25.950Z:     at async Pm (/.codespaces/agent/bin/node_modules/@devcontainers/cli/dist/spec-node/devContainersSpecCLI.js:465:1896)
2024-11-08 16:50:25.950Z:     at async NH (/.codespaces/agent/bin/node_modules/@devcontainers/cli/dist/spec-node/devContainersSpecCLI.js:465:610)
2024-11-08 16:50:25.951Z:     at async YtA (/.codespaces/agent/bin/node_modules/@devcontainers/cli/dist/spec-node/devContainersSpecCLI.js:482:3771)
2024-11-08 16:50:25.951Z:     at async eB (/.codespaces/agent/bin/node_modules/@devcontainers/cli/dist/spec-node/devContainersSpecCLI.js:482:4886)
2024-11-08 16:50:25.952Z:     at async prA (/.codespaces/agent/bin/node_modules/@devcontainers/cli/dist/spec-node/devContainersSpecCLI.js:663:200)
2024-11-08 16:50:25.952Z:     at async drA (/.codespaces/agent/bin/node_modules/@devcontainers/cli/dist/spec-node/devContainersSpecCLI.js:662:14706)
2024-11-08 16:50:25.957Z: devcontainer process exited with exit code 1

====================================== ERROR ====================================
2024-11-08 16:50:25.966Z: Failed to create container.
=================================================================================
2024-11-08 16:50:25.966Z: Error: Command failed: docker buildx build --load --build-arg BUILDKIT_INLINE_CACHE=1 -f /tmp/devcontainercli-root/container-features/0.68.0-1731084521696/Dockerfile-with-features -t vsc-5-computer-vision-sgbaird-61014790013b1d184ccc1db265d0bf138f72c6a528fe056a9c1672b6a63a9bd5 --target dev_containers_target_stage --build-arg VARIANT=3.10-bullseye --build-arg NODE_VERSION=none --build-arg _DEV_CONTAINERS_BASE_IMAGE=dev_container_auto_added_stage_label /var/lib/docker/codespacemount/workspace/5-computer-vision-sgbaird
2024-11-08 16:50:25.969Z: Error code: 1302 (UnifiedContainersErrorFatalCreatingContainer)

====================================== ERROR ====================================
2024-11-08 16:50:25.976Z: Container creation failed.
=================================================================================

Similar behavior for 3.6. Maybe for later versions, too.

Related:

Taking from https://github.com/ACC-Robotics/robotics-8a3a78-intro-to-github-classroom-3-0.2-intro-github-classroom/tree/main/.devcontainer may work instead (only visible to those with access).

@sgbaird
Copy link
Member Author

sgbaird commented Nov 8, 2024

@RubainaFarin31, for now, can you try modifying the codespace ad-hoc or by running locally in VS Code?

It looks like what you need is:

apt-get install -y libopencv-dev (you might need sudo here)

and

pip install -r requirements.txt

@sgbaird
Copy link
Member Author

sgbaird commented Nov 8, 2024

@SissiFeng looks like maybe just an issue with the Makefile:

2024-11-08 16:50:25.942Z:  > [dev_container_auto_added_stage_label 4/4] RUN pip3 --disable-pip-version-check --no-cache-dir install -r /tmp/pip-tmp/requirements.txt     && rm -rf /tmp/pip-tmp:
1.112 Obtaining file:/// (from -r /tmp/pip-tmp/requirements.txt (line 1))
1.114 ERROR: file:/// (from -r /tmp/pip-tmp/requirements.txt (line 1)) does not appear to be a Python project: neither 'setup.py' nor 'pyproject.toml' found.
------
2024-11-08 16:50:25.943Z: Dockerfile-with-features:15
--------------------
  14 |     COPY requirements.txt /tmp/pip-tmp/
  15 | >>> RUN pip3 --disable-pip-version-check --no-cache-dir install -r /tmp/pip-tmp/requirements.txt \
  16 | >>>     && rm -rf /tmp/pip-tmp
  17 |     
--------------------
ERROR: failed to solve: process "/bin/sh -c pip3 --disable-pip-version-check --no-cache-dir install -r /tmp/pip-tmp/requirements.txt     && rm -rf /tmp/pip-tmp" did not complete successfully: exit code: 1

@RubainaFarin31
Copy link

RubainaFarin31 commented Nov 8, 2024

@RubainaFarin31, for now, can you try modifying the codespace ad-hoc or by running locally in VS Code?

It looks like what you need is:

apt-get install -y libopencv-dev (you might need sudo here)

and

pip install -r requirements.txt

running to locally worked!

I opened VS Code, clicked clone repo in the new window, connected my cloned repository and was able to continue the work from there.

EDIT: To clarify for the installation requirements, I had most of them already installed so manually added the ones left using CMD. For example for 3.4, I just required cv2 and apriltags thus inputed

'pip install cv2' 
and 
'pip install apriltag'

@RubainaFarin31
Copy link

RubainaFarin31 commented Nov 11, 2024

4.3 Comment - lack of clarity within the statement "Use print statements to debug your implementation" for calculate_average. Unclear where to put print statement. If put into the function itself, you get "maximum recursion depth exceeded while calling a Python object."

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants