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

j2cli unmaintained and broken on Python 3.12 - Consider alternatives? #20353

Open
cqjjjzr opened this issue Sep 26, 2024 · 0 comments
Open

j2cli unmaintained and broken on Python 3.12 - Consider alternatives? #20353

cqjjjzr opened this issue Sep 26, 2024 · 0 comments

Comments

@cqjjjzr
Copy link

cqjjjzr commented Sep 26, 2024

Description

I'm trying to build SONiC on Ubuntu 24.04, but the j2 tool fails to render the necessary templates. j2cli has been unmaintained for long, and the usage of removed feature is not likely to be fixed by the original author. A migration to alternatives may be necessary.

Possible candidate: https://github.com/kpfleming/jinjanator which is a fork of j2cli.

Steps to reproduce the issue:

Execute make init on a machine with Python 3.12 as the default Python installation.

Describe the results you received:

The environment normally initializes.

Describe the results you expected:

The build fails with the following output:

Traceback (most recent call last):
  File "/home/charlie/vsonic/venv/bin/j2", line 5, in <module>
    from j2cli import main
  File "/home/charlie/vsonic/venv/lib/python3.12/site-packages/j2cli/__init__.py", line 10, in <module>
    from j2cli.cli import main
  File "/home/charlie/vsonic/venv/lib/python3.12/site-packages/j2cli/cli.py", line 8, in <module>
    import imp, inspect
ModuleNotFoundError: No module named 'imp'

The builtin module imp was deprecated in Python 3.4 and removed in Python 3.12. However, the j2cli has been unmaintained since January (see kolypto/j2cli#80), so the issue is not likely to be fixed.

Workaround

Create the Python venv using version <= 3.11.

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

1 participant