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

Add custom Python packages #2600

Closed
2 tasks done
wilcopots opened this issue Aug 28, 2024 · 4 comments
Closed
2 tasks done

Add custom Python packages #2600

wilcopots opened this issue Aug 28, 2024 · 4 comments
Labels
documentation Improvements or additions to the documentation.

Comments

@wilcopots
Copy link

wilcopots commented Aug 28, 2024

Describe the issue

Since Weblate version 5.5, one of the changes is:

  • Docker image now ships Python packages in /app/venv and installs using uv.

I am using the package elastic-apm for monitoring and a custom Python module for label changes.
Both I'm not able to install anymore.

I already tried

  • I've read and searched the documentation.
  • I've searched for similar filed issues in this repository.

Steps to reproduce the behavior

What I used to do in the dockerfile until version 5.4.3.1:
FROM weblate/weblate:5.4.3.1
RUN pip install elastic-apm
RUN echo 'INSTALLED_APPS += ("elasticapm.contrib.django",)' >> "/app/data/settings-override.py"
RUN echo "MIDDLEWARE += ('elasticapm.contrib.django.middleware.Catch404Middleware',)" >> "/app/data/settings-override.py"
RUN echo "ELASTIC_APM = {'DJANGO_TRANSACTION_NAME_FROM_ROUTE': True, 'DEBUG': True}" >> "/app/data/settings-override.py"

COPY --chown=weblate:weblate weblate_customization/ /usr/lib/python3.9/site-packages/weblate_customization/
RUN pip install -e /usr/lib/python3.9/site-packages/weblate_customization/
RUN echo "CHECK_LIST += ('weblate_customization.checks.TranslationSameAsKeyCheck',)" >> "/app/data/settings-override.py"

But since UV, Python package and project manager is used (version 5.5+), I tried:
RUN uv pip install elastic-apm
but the response is:
error: failed to create file /app/venv/.lock
Caused by: Permission denied (os error 13)

Same for the weblate_customization package:
RUN uv pip install /usr/lib/python3.12/site-packages/weblate_customization/ -editable
error: failed to create file /app/venv/.lock
Caused by: Permission denied (os error 13)

I have also looked up the documentation, but there UV is not mentioned at all:
https://docs.weblate.org/en/latest/admin/customize.html

Expected behavior

I would expect I can simply install the elastic-apm package and custom Weblate modules without altering file permissions or changing user rights.

Screenshots

No response

Exception traceback

No response

Additional context

No response

@nijel
Copy link
Member

nijel commented Aug 29, 2024

Migration to uv wasn't supposed to change this. Neither installation should work with UID 1000 which is used by the container. You should first change UID to 0 before doing changes to the system. This is documented in https://docs.weblate.org/en/latest/admin/install/docker.html#overriding-settings-by-extending-the-docker-image (but the docs wasn't updated for uv).

nijel added a commit to WeblateOrg/weblate that referenced this issue Aug 29, 2024
@nijel
Copy link
Member

nijel commented Aug 29, 2024

I've updated the docs WeblateOrg/weblate@177dff0

@wilcopots
Copy link
Author

Thank you for the fast response, that did work for me!

Copy link

The issue you have reported is now resolved. If you don’t feel it’s right, please follow its labels to get a clue for further steps.

  • In case you see a similar problem, please open a separate issue.
  • If you are happy with the outcome, don’t hesitate to support Weblate by making a donation.

@nijel nijel added the documentation Improvements or additions to the documentation. label Aug 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to the documentation.
Projects
None yet
Development

No branches or pull requests

2 participants