Open D4llo opened 7 months ago
yooo, same shit happens to me
According to PEP 632, distutils
has been removed from Python 3.12.
A band-aid fix for us users for now would be to follow the above report and just install the python-setuptools
package.
Edit: #1404 and/or #1247 appears to fix this, but they are still open PRs
I did a little research before coming here and discovered the same fix. It's been a while since the last commit. Hope the project isn't abandoned
I installed with pipx
, and found that I still ended up with an error even after running pipx inject thefuck distutils
.
Traceback (most recent call last):
File "/home/migue/.local/bin/thefuck", line 5, in <module>
from thefuck.entrypoints.main import main
File "/home/migue/.local/pipx/venvs/thefuck/lib64/python3.12/site-packages/thefuck/entrypoints/main.py", line 8, in <module>
from .. import logs # noqa: E402
^^^^^^^^^^^^^^^^^^^
File "/home/migue/.local/pipx/venvs/thefuck/lib64/python3.12/site-packages/thefuck/logs.py", line 8, in <module>
from .conf import settings
File "/home/migue/.local/pipx/venvs/thefuck/lib64/python3.12/site-packages/thefuck/conf.py", line 1, in <module>
from imp import load_source
ModuleNotFoundError: No module named 'imp'
Looks like getting thefuck to work nicely with Python 3.12 may be a little more painful than just adding a missing dependency, since I can't find any drop-in replacement for imp
(which has been deprecated since Python 3.4, and got removed in Python 3.12, source).
The easiest solution for pipx
users is to stick to Python 3.11. For me, this was as simple as
$ sudo dnf install python3.11 # changes depending on your distro
$ pipx reinstall --python python3.11 thefuck
Same issue with me. If you use pipx but don't want to downgrade your system Python version (dangerous if tools from your distro rely on system Python), the following command installs thefuck
into a venv with Python 3.11 while keeping the system Python untouched.
$ pipx install --fetch-missing-python --python "3.11" thefuck
$ thefuck --help
usage: thefuck [-v] [-a [ALIAS]] [-l SHELL_LOGGER]
...
$ python --version
Python 3.12.3
I have the same issue since I upgraded my Ubuntu from 23.10 to 24.04 today.
Some here on a fresh install of Linux Mint on my new notebook. :-/
Same issue with me. If you use pipx but don't want to downgrade your system Python version (dangerous if tools from your distro rely on system Python), the following command installs
thefuck
into a venv with Python 3.11 while keeping the system Python untouched.$ pipx install --fetch-missing-python --python "3.11" thefuck $ thefuck --help usage: thefuck [-v] [-a [ALIAS]] [-l SHELL_LOGGER] ... $ python --version Python 3.12.3
Thank you !
I also had to uninstall pipx
from APT (sudo apt remove pipx
) and reinstall it with brew
instead (brew install pipx
) because Debian & Ubuntu repositories are too outdated for --fetch-missing-python
& --python
parameters to be available.
Packages previously installed with I thought so because pipx
didn't have to be reinstalled after the switch.pipx list
still listed the previously installed packages, but they don't actually work, so they have to be reinstalled with pipx install <package> --force
.
Same here, rolling back on python3.11 did the trick for me.
For uv
users : uv tool install --python 3.11 thefuck
Thank you for making me discover uv
!
The issue may be related to #1434
Opening a terminal throws:
The output of
thefuck --version
(something likeThe Fuck 3.1 using Python 3.5.0 and Bash 4.4.12(1)-release
):The Fuck 3.32-8 using Python 3.12.3 and Bash 5.2.26(1)-release (note that thefuck --version throws:
Your system (Debian 7, ArchLinux, Windows, etc.):
EndeavourOS 6.8.7-arch1-2
How to reproduce the bug:
open an terminal and thats all
The output of The Fuck with
THEFUCK_DEBUG=true
exported (typically executeexport THEFUCK_DEBUG=true
in your shell before The Fuck):Still failed
Cheers,