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

RDT build suddenly starts failing without any changes in conf.py #9037

Closed
RobiFag opened this issue Mar 24, 2022 · 10 comments · Fixed by wagtail/sphinx-wagtail-theme#142
Closed

Comments

@RobiFag
Copy link

RobiFag commented Mar 24, 2022

Details

Actual Result

Everything worked fine till few hours ago then the build started failing. We don't have modified any configuration in the conf.py file and just added text and images to a page of the manual.

The errors are:
ImportError: cannot import name 'contextfunction' from 'jinja2' (/home/docs/checkouts/readthedocs.org/user_builds/manuale-catasto-strade/envs/novara/lib/python3.7/site-packages/jinja2/__init__.py)

Could not import extension sphinx.builders.latex (exception: cannot import name 'contextfunction' from 'jinja2' (/home/docs/checkouts/readthedocs.org/user_builds/manuale-catasto-strade/envs/novara/lib/python3.7/site-packages/jinja2/__init__.py))

We get the same errors in another manual:

@ericholscher
Copy link
Member

ericholscher commented Mar 24, 2022

I'm guessing this is because of a new release of jinja2 (https://github.com/pallets/jinja/releases). You'll need to pin your jinja2 requirement in your build to ensure it continues to work to jinja2<3.1.0. We recommend upgrading from Sphinx 1.8 though, because these kind of issues will continue to happen on older dependencies.

We are also deploying a fix to Sphinx 1.8 to work around this, but we generally do recommend upgrading: https://docs.readthedocs.io/en/latest/guides/reproducible-builds.html#using-a-configuration-file

@RobiFag
Copy link
Author

RobiFag commented Mar 24, 2022

Hi @ericholscher now the build starts working correctly without any changes!

Anyway thanks for the suggestions, I will try to update Sphinx!

@lizadams
Copy link

Also having this issue https://readthedocs.org/projects/cyclecloud-cmaq/

@lizadams
Copy link

lizadams commented Mar 24, 2022

The error is also described here: pallets/jinja#1631
It hasn't been resolved for two of my projects.
ericholscher
I've set

# File: docs/requirements.txt
#
# sphinx==4.2.0
# sphinx_rtd_theme==1.0.0
# readthedocs-sphinx-search==0.1.1
# jinja2==3.0.0

and

# File: docs/environment.yaml

name: docs
channels:
  - conda-forge
  - defaults
dependencies:
  - sphinx==4.2.0
  - nbsphinx==0.8.1
  - pip:
    - sphinx_rtd_theme==1.0.0
    - jinja2==3.0.0

It doesn't resolve the error.

@ericholscher
Copy link
Member

ericholscher commented Mar 24, 2022

@lizadams it looks like your requirements file is commented out. You need to remove the # before the dependencies, and likely pin your mkdocs version, not sphinx.

@lizadams
Copy link

lizadams commented Mar 24, 2022

@ericholscher - Thanks!
This seems to have worked:

# File: docs/requirements.txt
mkdocs==1.2.3
jinja2==3.0.0
# File: docs/environment.yaml

name: docs
channels:
  - conda-forge
  - defaults
dependencies:
  - mkdocs==1.2.3
  - pip:
    - jinja2==3.0.0

rgacogne added a commit to rgacogne/pdns that referenced this issue Mar 25, 2022
Jinja2 3.1.0 removed deprecated code that is still used by sphinx
1.8.x, and it looks like our custom sphinx extensions are not working
with more recent versions of sphinx..

See:
- pallets/jinja#1631
- readthedocs/readthedocs.org#9037

and

- PowerDNS#7712

The exact error is:
```
Extension error:
Could not import extension sphinx.builders.latex (exception: cannot import name 'contextfunction' from 'jinja2' (/dnsdist/pdns/dnsdistdist/.venv/lib/python3.7/site-packages/jinja2/__init__.py))
```
gkunz added a commit to gkunz/CNTT that referenced this issue Mar 25, 2022
A recent update of Jinja2 breaks builds using the old version of Sphinx we are
using. We still use Sphinx < 2 to build the overall documentation containing
both markdown and rst files. Newer versions seem to have problems with this.

Once all files have been converted to rst, we can uplift Sphinx (see individual
builds which already today use much newer versions of Sphinx).

See also readthedocs/readthedocs.org#9037

As a temporary solution, I suggest to limit jinja2 to < 3.2.0 until we can
remove the version restriction in the overall build.

Fixes anuket-project#2891

Signed-off-by: Georg Kunz <georg.kunz@ericsson.com>
Habbie pushed a commit to Habbie/pdns that referenced this issue Mar 25, 2022
Jinja2 3.1.0 removed deprecated code that is still used by sphinx
1.8.x, and it looks like our custom sphinx extensions are not working
with more recent versions of sphinx..

See:
- pallets/jinja#1631
- readthedocs/readthedocs.org#9037

and

- PowerDNS#7712

The exact error is:
```
Extension error:
Could not import extension sphinx.builders.latex (exception: cannot import name 'contextfunction' from 'jinja2' (/dnsdist/pdns/dnsdistdist/.venv/lib/python3.7/site-packages/jinja2/__init__.py))
```

(cherry picked from commit 92ad297)
Habbie pushed a commit to Habbie/pdns that referenced this issue Mar 25, 2022
Jinja2 3.1.0 removed deprecated code that is still used by sphinx
1.8.x, and it looks like our custom sphinx extensions are not working
with more recent versions of sphinx..

See:
- pallets/jinja#1631
- readthedocs/readthedocs.org#9037

and

- PowerDNS#7712

The exact error is:
```
Extension error:
Could not import extension sphinx.builders.latex (exception: cannot import name 'contextfunction' from 'jinja2' (/dnsdist/pdns/dnsdistdist/.venv/lib/python3.7/site-packages/jinja2/__init__.py))
```

(cherry picked from commit 92ad297)
Habbie pushed a commit to Habbie/pdns that referenced this issue Mar 25, 2022
Jinja2 3.1.0 removed deprecated code that is still used by sphinx
1.8.x, and it looks like our custom sphinx extensions are not working
with more recent versions of sphinx..

See:
- pallets/jinja#1631
- readthedocs/readthedocs.org#9037

and

- PowerDNS#7712

The exact error is:
```
Extension error:
Could not import extension sphinx.builders.latex (exception: cannot import name 'contextfunction' from 'jinja2' (/dnsdist/pdns/dnsdistdist/.venv/lib/python3.7/site-packages/jinja2/__init__.py))
```

(cherry picked from commit 92ad297)
Habbie pushed a commit to Habbie/pdns that referenced this issue Mar 25, 2022
Jinja2 3.1.0 removed deprecated code that is still used by sphinx
1.8.x, and it looks like our custom sphinx extensions are not working
with more recent versions of sphinx..

See:
- pallets/jinja#1631
- readthedocs/readthedocs.org#9037

and

- PowerDNS#7712

The exact error is:
```
Extension error:
Could not import extension sphinx.builders.latex (exception: cannot import name 'contextfunction' from 'jinja2' (/dnsdist/pdns/dnsdistdist/.venv/lib/python3.7/site-packages/jinja2/__init__.py))
```

(cherry picked from commit 92ad297)
Habbie pushed a commit to Habbie/pdns that referenced this issue Mar 25, 2022
Jinja2 3.1.0 removed deprecated code that is still used by sphinx
1.8.x, and it looks like our custom sphinx extensions are not working
with more recent versions of sphinx..

See:
- pallets/jinja#1631
- readthedocs/readthedocs.org#9037

and

- PowerDNS#7712

The exact error is:
```
Extension error:
Could not import extension sphinx.builders.latex (exception: cannot import name 'contextfunction' from 'jinja2' (/dnsdist/pdns/dnsdistdist/.venv/lib/python3.7/site-packages/jinja2/__init__.py))
```

(cherry picked from commit 92ad297)
Habbie pushed a commit to Habbie/pdns that referenced this issue Mar 25, 2022
Jinja2 3.1.0 removed deprecated code that is still used by sphinx
1.8.x, and it looks like our custom sphinx extensions are not working
with more recent versions of sphinx..

See:
- pallets/jinja#1631
- readthedocs/readthedocs.org#9037

and

- PowerDNS#7712

The exact error is:
```
Extension error:
Could not import extension sphinx.builders.latex (exception: cannot import name 'contextfunction' from 'jinja2' (/dnsdist/pdns/dnsdistdist/.venv/lib/python3.7/site-packages/jinja2/__init__.py))
```

(cherry picked from commit 92ad297)
Xarthisius added a commit to Xarthisius/yt that referenced this issue Mar 25, 2022
Some deprecated features were removed in jinja2==3.1.0.
For details see e.g. pallets/jinja#1626 and
readthedocs/readthedocs.org#9037
We should probably update sphinx instead, but that breaks other
things...
sgpearse added a commit to NCAR/VAPOR that referenced this issue Apr 18, 2022
sgpearse added a commit to NCAR/VAPOR that referenced this issue Apr 18, 2022
sgpearse added a commit to NCAR/VAPOR that referenced this issue Apr 18, 2022
jasongrout added a commit to jasongrout/ipywidgets that referenced this issue Jun 10, 2022
Habbie pushed a commit to Habbie/pdns that referenced this issue Jun 17, 2022
Jinja2 3.1.0 removed deprecated code that is still used by sphinx
1.8.x, and it looks like our custom sphinx extensions are not working
with more recent versions of sphinx..

See:
- pallets/jinja#1631
- readthedocs/readthedocs.org#9037

and

- PowerDNS#7712

The exact error is:
```
Extension error:
Could not import extension sphinx.builders.latex (exception: cannot import name 'contextfunction' from 'jinja2' (/dnsdist/pdns/dnsdistdist/.venv/lib/python3.7/site-packages/jinja2/__init__.py))
```

(cherry picked from commit 92ad297)
Habbie pushed a commit to Habbie/pdns that referenced this issue Jun 20, 2022
Jinja2 3.1.0 removed deprecated code that is still used by sphinx
1.8.x, and it looks like our custom sphinx extensions are not working
with more recent versions of sphinx..

See:
- pallets/jinja#1631
- readthedocs/readthedocs.org#9037

and

- PowerDNS#7712

The exact error is:
```
Extension error:
Could not import extension sphinx.builders.latex (exception: cannot import name 'contextfunction' from 'jinja2' (/dnsdist/pdns/dnsdistdist/.venv/lib/python3.7/site-packages/jinja2/__init__.py))
```

(cherry picked from commit 92ad297)
Alxaline added a commit to Alxaline/ComScan that referenced this issue Jul 27, 2022
martinvol pushed a commit to celo-org/celo-monorepo that referenced this issue Sep 15, 2022
### Description

Recent builds of the typedoc autogenerated docs have been failing because of some dependency upgrades. This PR specifies the packages for the read the docs site to use so the build will work.

Related issue, readthedocs/readthedocs.org#9037
Habbie pushed a commit to Habbie/pdns that referenced this issue Oct 12, 2022
Jinja2 3.1.0 removed deprecated code that is still used by sphinx
1.8.x, and it looks like our custom sphinx extensions are not working
with more recent versions of sphinx..

See:
- pallets/jinja#1631
- readthedocs/readthedocs.org#9037

and

- PowerDNS#7712

The exact error is:
```
Extension error:
Could not import extension sphinx.builders.latex (exception: cannot import name 'contextfunction' from 'jinja2' (/dnsdist/pdns/dnsdistdist/.venv/lib/python3.7/site-packages/jinja2/__init__.py))
```

(cherry picked from commit 92ad297)
jgehrcke added a commit to jgehrcke/gipc that referenced this issue Feb 7, 2023
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 a pull request may close this issue.

6 participants