Install fails with "ModuleNotFoundError: No module named 'imp'"
Describe the bug
Python 3.12+ is currently unsupported, trying to install tl will result in an error due to missing the imp module.
Expected Behavior
Install successfully with no error.
Current Behavior
Install will produce an error that says:
ModuleNotFoundError: No module named 'imp'
According to the Python documentation, imp was deprecated in Python 3.4, and removed in 3.12.
Steps to Reproduce
- Install Python 3.12.x
- Install
tlwithpipx install tlorpip install tl
Logs
❯ cat /root/.local/state/pipx/log/cmd_2025-01-04_10.54.09_pip_errors.log
PIP STDOUT
----------
Collecting tl
Using cached tl-0.5.tar.gz (1.2 MB)
Installing build dependencies: started
Installing build dependencies: finished with status 'done'
Getting requirements to build wheel: started
Getting requirements to build wheel: finished with status 'error'
PIP STDERR
----------
error: subprocess-exited-with-error
× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> [22 lines of output]
Traceback (most recent call last):
File "/root/.local/share/pipx/shared/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
main()
File "/root/.local/share/pipx/shared/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/.local/share/pipx/shared/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
return hook(config_settings)
^^^^^^^^^^^^^^^^^^^^^
File "/tmp/pip-build-env-7isk7fjs/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 334, in get_requires_for_build_wheel
return self._get_build_requires(config_settings, requirements=[])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/tmp/pip-build-env-7isk7fjs/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 304, in _get_build_requires
self.run_setup()
File "/tmp/pip-build-env-7isk7fjs/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 522, in run_setup
super().run_setup(setup_script=setup_script)
File "/tmp/pip-build-env-7isk7fjs/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 320, in run_setup
exec(code, locals())
File "<string>", line 53, in <module>
File "/tmp/pip-install-0d6ir6uc/tl_0c227157fc1742d593b7b7e38edeb694/tl/__init__.py", line 10, in <module>
import imp
ModuleNotFoundError: No module named 'imp'
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error
× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip.
Context (Environment)
- OS: Linux (Nobara 41)
- toolong Version: 1.4.0
- Python Version: 3.12.3
Please Note: I am not a developer and don't really know what I am doing. I am posting this bug report using a similar one I found on another project as a template. So if you have any question or need anything, please provide explicit instructions to me on how to get the information you need so that I may properly report back to you in a useful way. Thank you.
See https://github.com/Textualize/toolong/pull/63
and in particular https://github.com/Textualize/toolong/pull/63#issuecomment-2440027052
So I am experiencing the issue because this pull request is not yet merged? (I'm kinda just guessing here)
If it is preventing even installation, is this not an urgent issue? Is there any kind of timeline on when the pr might get merged?
So I am experiencing the issue because this pull request is not yet merged? (I'm kinda just guessing here)
You are trying to use python 3.12.
If it is preventing even installation, is this not an urgent issue?
No. Toolong supports python 3.8. you are trying to use a newer python version.
https://github.com/Textualize/toolong/blob/main/pyproject.toml
Is there any kind of timeline on when the pr might get merged?
No timeline. It's a question of when the maintainer has time or inclination to look at it.
I created the PR because I wanted to use a newer version of Textual with toolong, and that required a newer version of python.
HTH.
Toolong doesn't use imp, which indicates either a dependency or the builds system.
if it doesn't run with Python 3.12, try using 3.11
pipx install --python 3.11 tl