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 · 2 comments
Open

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

cqjjjzr opened this issue Sep 26, 2024 · 2 comments
Labels
Triaged this issue has been triaged

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.

@judyjoseph
Copy link
Contributor

Please add more details as to which branch you are seeing this issue. @sonic-build please check @xumia

@judyjoseph judyjoseph added the Triaged this issue has been triaged label Oct 9, 2024
@cqjjjzr
Copy link
Author

cqjjjzr commented Oct 9, 2024

I've see this problem on branch master and 202405, but I expect it to appear on all branches since they are all using j2cli to apply the templates.

Edit: Please refer to kolypto/j2cli#80 for more details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Triaged this issue has been triaged
Projects
None yet
Development

No branches or pull requests

2 participants