thefuck
thefuck copied to clipboard
ModuleNotFoundError: No module named 'imp' when running 'fuck'
The output of thefuck --version
(something like The Fuck 3.1 using Python 3.5.0 and Bash 4.4.12(1)-release
):
Package Version: 'thefuck' version 3.32
Your system (Debian 7, ArchLinux, Windows, etc.):
Windows 11
How to reproduce the bug:
1. Install the 'thefuck' package using pip.
2. Attempt to run the 'fuck' command in the terminal.
The output of The Fuck with THEFUCK_DEBUG=true
exported (typically execute export THEFUCK_DEBUG=true
in your shell before The Fuck):
C:\Users\D-Sensei>set THEFUCK_DEBUG=true
C:\Users\D-Sensei>fuck --debug
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "C:\Users\D
Sensei\AppData\Roaming\Python\Python312\Scripts\fuck.exe\__main__.py", line 4, in
<module>
File "C:\Users\D-Sensei\AppData\Roaming\Python\Python312\site
packages\thefuck\entrypoints\not_configured.py", line 13, in <module>
from .. import logs, const # noqa: E402
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\D-Sensei\AppData\Roaming\Python\Python312\site
packages\thefuck\logs.py", line 8, in <module>
from .conf import settings
File "C:\Users\D-Sensei\AppData\Roaming\Python\Python312\site
packages\thefuck\conf.py", line 1, in <module>
from imp import load_source
ModuleNotFoundError: No module named 'imp'
[!] the program is unable to find the 'imp' module, resulting in a `ModuleNotFoundError`.
This problem likely stems from a compatibility issue between'thefuck' and the Python
version being used, or from a corrupted package installation
If the bug only appears with a specific application, the output of that application and its version:
The bug prevents users from utilizing the 'thefuck' application as intended, impacting their
ability to correct previous console commands.
Anything else you think is relevant:
- The issue seems to be related to the 'thefuck' package's dependency on the 'imp' module,
which is not being recognized or found during execution.
- This error prevents the 'fuck' command from functioning as intended, affecting its usability
and functionality.
Got the same issue :(
+1
Running python 3.10 Do I need to install a library or something?
Same here, running Python 3.12
The imp module has been removed in Python3.12 in favor of importlib. Use a python version before 3.12, it might work. Edit: should be fixed by this pull request https://github.com/nvbn/thefuck/pull/1415
The imp module has been removed in Python3.12 in favor of importlib. Use a python version before 3.12, it might work. Edit: should be fixed by this pull request #1415
Works in python 3.11.8!
It's not working on the Python v3.12.2. :(
It's not working on the Python v3.12.2. :(
I'm quite sure they won't return that deprecated and removed library if there's another one we can use.
Too bad the maintainer/s are not doing anything about it; there's an open pull request for this, too
Same here on Ubuntu 24.04 LTS. Python 3.12 is the default version installed by APT. (thefuck is also installed by sudo apt install thefuck
)
This issue is still present Ubuntu 24.04, Python 312
@tes-balo I think this is already fixed in this repository but there was no release. You can try
pip uninstall thefuck
pip install https://github.com/nvbn/thefuck/archive/master.zip
See also https://github.com/nvbn/thefuck/pull/1415#issuecomment-1952056754 and https://github.com/nvbn/thefuck/pull/1415#issuecomment-2094093754
@tes-balo I think this is already fixed in this repository but there was no release. You can try
pip uninstall thefuck pip install https://github.com/nvbn/thefuck/archive/master.zip
See also #1415 (comment) and #1415 (comment)
Yes! This works for me!
Hi Everyone, Thanks for your responses. I believe that anyone following this issue's thread can debug the bug. Before I close this issue, I will post an edit summarizing the solution.
Happy coding!
@tes-balo I think this is already fixed in this repository but there was no release. You can try
pip uninstall thefuck pip install https://github.com/nvbn/thefuck/archive/master.zip
See also #1415 (comment) and #1415 (comment)
Yes! This works for me!
I just wanted to add that this worked for me, too! Thanks for finding us the solution, @tes-balo ! :)
Error confirmed
pip3 install thefuck --user ─╯
WARNING: Skipping /usr/lib/python3.12/dist-packages/argcomplete-3.1.4.dist-info due to invalid metadata entry 'name'
WARNING: Skipping /usr/lib/python3.12/dist-packages/charset_normalizer-3.3.2.dist-info due to invalid metadata entry 'name'
Collecting thefuck
Using cached thefuck-3.32-py2.py3-none-any.whl.metadata (28 kB)
Requirement already satisfied: psutil in /usr/lib/python3/dist-packages (from thefuck) (5.9.8)
Requirement already satisfied: colorama in /usr/lib/python3/dist-packages (from thefuck) (0.4.6)
Requirement already satisfied: six in /usr/lib/python3/dist-packages (from thefuck) (1.16.0)
Requirement already satisfied: decorator in ./.local/lib/python3.12/site-packages (from thefuck) (5.1.1)
Requirement already satisfied: pyte in ./.local/lib/python3.12/site-packages (from thefuck) (0.8.2)
Requirement already satisfied: wcwidth in ./.local/lib/python3.12/site-packages (from pyte->thefuck) (0.2.13)
Using cached thefuck-3.32-py2.py3-none-any.whl (127 kB)
WARNING: Skipping /usr/lib/python3.12/dist-packages/argcomplete-3.1.4.dist-info due to invalid metadata entry 'name'
WARNING: Skipping /usr/lib/python3.12/dist-packages/charset_normalizer-3.3.2.dist-info due to invalid metadata entry 'name'
Installing collected packages: thefuck
Successfully installed thefuck-3.32
Traceback (most recent call last):
File "/home/usr/.local/bin/thefuck", line 5, in <module>
from thefuck.entrypoints.main import main
File "/home/usr/.local/lib/python3.12/site-packages/thefuck/entrypoints/main.py", line 8, in <module>
from .. import logs # noqa: E402
^^^^^^^^^^^^^^^^^^^
File "/home/usr/.local/lib/python3.12/site-packages/thefuck/logs.py", line 8, in <module>
from .conf import settings
File "/home/usr/.local/lib/python3.12/site-packages/thefuck/conf.py", line 1, in <module>
from imp import load_source
ModuleNotFoundError: No module named 'imp'
When is a release planned which will address this bug?
When is a release planned which will address this bug?
As soon as the last task of the next milestone roadmap will be addressed ?
got error from latest home-manager (nix)
Executing pytestCheckPhase
/nix/store/av50cj3isi4b2sq4bcr9q959ij8am4wn-python3.12-pytest-7.4.4/lib/python3.12/site-packages/_pytest/config/__init__.py:331: PluggyTeardownRaisedWarning: A plugin raised an exception during an old-style hookwrapper teardown.
Plugin: helpconfig, Hook: pytest_cmdline_parse
ConftestImportFailure: ModuleNotFoundError: No module named 'imp' (from /private/tmp/nix-build-thefuck-3.32.drv-0/source/tests/conftest.py)
For more information see https://pluggy.readthedocs.io/en/stable/api_reference.html#pluggy.PluggyTeardownRaisedWarning
got error from latest home-manager (nix)
got the same error using home-manager, it is related to the fix not being in the last release, and the error appeared because nixpkgs changed the default python version from 3.11 to 3.12 recently, but a fix for using the 3.11 python packages for thefuck has been done, and will be available for nixos-unstable as soon as the tests are finished
So does the latest nix-unstable have the fix now?
it does have it now yes !