danielfrg / mkdocs-jupyter

Use Jupyter Notebook in mkdocs
https://mkdocs-jupyter.danielfrg.com
Apache License 2.0
362 stars 45 forks source link

Install and Adjust Locales #190

Open michelmetran opened 4 months ago

michelmetran commented 4 months ago

I used mkdocs-jupyter to document a project called "brazilian-holidays":

There is a lot of use of pandas in the project and, in the development, I left a function that uses locale

df['dia_semana'] = df['date'].dt.day_name(locale='pt_BR.utf8')

I leave it to that I'm in trouble.

  1. when I use mkdocs serve, the code renders correctly.
  2. when I try to build the documentation in ReadTheDocs, it gives an error, as the locale is not installed!

I've already tried adjusting .readthedocs.yaml to install locales, but it gives an error.

build:
    os: ubuntu-22.04
    tools:
        python: "3.11"

    jobs:
        pre_create_environment:
            - locale -a
            #- sudo apt-get update
            # - apt-get update && apt-get install -y locales
        pre_install:
            #- apt-get update && apt-get install -y locales
            #- locale-gen pt_BR.UTF-8
            #- update-locale LANG=pt_BR.UTF-8​
            - date


After some attempts, I discovered that it is possible to install locales with tweaks to the file .readthedocs.yaml. I read this link.

build:
    os: ubuntu-22.04

    apt_packages:
        - locales

    tools:
        python: "3.11"

    jobs:
        pre_create_environment:
            - locale -a
        pre_install:
            - locale-gen pt_BR.UTF-8
            - update-locale LANG=pt_BR.UTF-8​
            - date


However, it gives an error in locale-gen pt_BR.UTF-8. I received the message

[rtd-command-info] start-time: 2024-03-04T03:40:38.032279Z, end-time: 2024-03-04T03:40:38.293630Z, duration: 0, exit-code: 4
locale-gen pt_BR.UTF-8
sed: couldn't open temporary file /etc/sedJBmcXj: Permission denied


Is there any way to fix it? Has anyone ever experienced this problem?

I know this is more related to Read The Docs restrictions, but this tends to occur more for those who use Jupyter