Skip to content

Fix Dockerfile Error for UDF Tests #495

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

Merged
merged 8 commits into from
Jun 2, 2025
Merged

Conversation

afleisc
Copy link
Collaborator

@afleisc afleisc commented May 22, 2025

Step #1 - "build-ci-image-from-kaniko-cache": INFO[0092] Running: [/bin/bash -o pipefail -c pip3 install --no-cache-dir -r requirements.txt  && curl -fsSL https://deb.nodesource.com/setup_20.x | bash -  && apt-get install --no-install-recommends -y nodejs  && npm i -g @dataform/[email protected]]
Step #1 - "build-ci-image-from-kaniko-cache": error: externally-managed-environment
Step #1 - "build-ci-image-from-kaniko-cache": 
Step #1 - "build-ci-image-from-kaniko-cache": × This environment is externally managed
Step #1 - "build-ci-image-from-kaniko-cache": ╰─> To install Python packages system-wide, try apt install
Step #1 - "build-ci-image-from-kaniko-cache":     python3-xyz, where xyz is the package you are trying to
Step #1 - "build-ci-image-from-kaniko-cache":     install.
Step #1 - "build-ci-image-from-kaniko-cache":     
Step #1 - "build-ci-image-from-kaniko-cache":     If you wish to install a non-Debian-packaged Python package,
Step #1 - "build-ci-image-from-kaniko-cache":     create a virtual environment using python3 -m venv path/to/venv.
Step #1 - "build-ci-image-from-kaniko-cache":     Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
Step #1 - "build-ci-image-from-kaniko-cache":     sure you have python3-full installed.
Step #1 - "build-ci-image-from-kaniko-cache":     
Step #1 - "build-ci-image-from-kaniko-cache":     If you wish to install a non-Debian packaged Python application,
Step #1 - "build-ci-image-from-kaniko-cache":     it may be easiest to use pipx install xyz, which will manage a
Step #1 - "build-ci-image-from-kaniko-cache":     virtual environment for you. Make sure you have pipx installed.
Step #1 - "build-ci-image-from-kaniko-cache":     
Step #1 - "build-ci-image-from-kaniko-cache":     See /usr/share/doc/python3.11/README.venv for more information.
Step #1 - "build-ci-image-from-kaniko-cache": 
Step #1 - "build-ci-image-from-kaniko-cache": note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.

This is reproducible by following the steps currently listed here: https://github.com/GoogleCloudPlatform/bigquery-utils/blob/master/udfs/CONTRIBUTING.md#test-your-udf

As suggested in the error messages, modified Dockerfile.ci to use a venv. Also updated cloudbuild_udf_test_image.yaml to ignore a linter warning that emerged with the change.

@danieldeleo
Copy link
Collaborator

/gcbrun

1 similar comment
@danieldeleo
Copy link
Collaborator

/gcbrun

@danieldeleo
Copy link
Collaborator

/gcbrun

@danieldeleo
Copy link
Collaborator

/gcbrun

@danieldeleo
Copy link
Collaborator

/gcbrun

@danieldeleo danieldeleo merged commit 2c5639b into master Jun 2, 2025
94 checks passed
@danieldeleo danieldeleo deleted the fix-unit-tests-ext branch June 2, 2025 21:31
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

Successfully merging this pull request may close these issues.

2 participants