Open pblanton opened 1 month ago
It seems thefuck can`t work on python 3.12. The last release was build in 2022. May need someone update it.
The apt package doesn't work Using pip just gives struggles But Snap did the trick.
https://snapcraft.io/install/thefuck/ubuntu#install
It's not the most recent version but it's still useful
quick fix for pip installed version at least:
open ~/.local/lib/python3.12/site-packages/thefuck/conf.py
replace line;
from imp import load_source
with;
import importlib.machinery
and lines;
settings = load_source(
'settings', text_type(self.user_dir.joinpath('settings.py')))
with;
settings = importlib.machinery.SourceFileLoader('settings', text_type(self.user_dir.joinpath('settings.py'))).load_module()
then open ~/.local/lib/python3.12/site-packages/thefuck/types.py
replace import statement as above;
from imp import load_source
with;
import importlib.machinery
and line;
rule_module = load_source(name, str(path))
with;
rule_module = importlib.machinery.SourceFileLoader(name, str(path)).load_module()
This worked for me on Fedora 40 using fish shell in tilix terminal emulator, can't say for any other combination.
The workaround proposed by @Darkextratoasty worked on my machine:
DISTRIB_ID=Ubuntu DISTRIB_RELEASE=24.04 DISTRIB_CODENAME=noble DISTRIB_DESCRIPTION="Ubuntu 24.04 LTS"
It is just sad when a great OSS is left abandoned. Maybe it is time for someone to create a fork with proper updates (there are more than 80 PRs in this repo!!).
Found in a #1434
pip uninstall thefuck
pip install https://github.com/nvbn/thefuck/archive/master.zip
If you're not a Python dev who already has a virtualenv setup, you'll need to add one as per these instructions:
python3 -m venv ~/.local --system-site-packages
and make sure ~/.local/bin is in $PATH.
Really wish Python stuff was easier to use without all these gymnastics 😁
If you're doing it in dev for testing, then you could always use the pip argument of --break-system-packages but it's not recommended for production environments. I have absolutely NOT done that on my live systems without any problems so-far! 😝
@Darkextratoasty A .patch
file would have been nice, but I can't complain, for what I paid I'm very happy. Thank you so much!
I also met this problem under my
Linux Sandman-PC 5.15.153.1-microsoft-standard-WSL2 #1 SMP Fri Mar 29 23:14:13 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
.
And I found that maybe the python-dev
package was already stop support any more. However, use python3-dev
or python-dev-is-python3
from the prompt need to change the code.
I found this topic on Stack Overflow: it seems should be importlib
instead of imp
with Python 3.12.
I found this topic on Stack Overflow: it seems should be
importlib
instead ofimp
with Python 3.12.
As mentioned ^^^: https://github.com/nvbn/thefuck/issues/1449#issuecomment-2137634221
quick fix for pip installed version at least:
open
~/.local/lib/python3.12/site-packages/thefuck/conf.py
replace line;from imp import load_source
with;
import importlib.machinery
and lines;
settings = load_source( 'settings', text_type(self.user_dir.joinpath('settings.py')))
with;
settings = importlib.machinery.SourceFileLoader('settings', text_type(self.user_dir.joinpath('settings.py'))).load_module()
then open
~/.local/lib/python3.12/site-packages/thefuck/types.py
replace import statement as above;from imp import load_source
with;
import importlib.machinery
and line;
rule_module = load_source(name, str(path))
with;
rule_module = importlib.machinery.SourceFileLoader(name, str(path)).load_module()
This worked for me on Fedora 40 using fish shell in tilix terminal emulator, can't say for any other combination.
please can you make a pull request with this fix?
please can you make a pull request with this fix?
No, because this is a hacky work-around and it's not clear if it has other, unwanted effects. If someone with more knowledge than myself and a decent set of unit tests can verify that it's a clean fix, then a pull request could be added. Also I know basically nothing of git, so I don't even know how to go about doing a pull request.
@nvbn Коллега, пожалуйста, если есть возможность, исправьте установку под Убунту 22.04. Уж больно много плясок с бубном приходиться делать что бы в ато режиме раскатать софт... Благодарствую!
The proposed workaround somewhat works on:
Distributor ID: Ubuntu
Description: Ubuntu 24.04 LTS
Release: 24.04
Codename: noble
but when invoking <command> | fuck
it yields:
zsh: command not found: lla
ll [enter/↑/↓/ctrl+c]Traceback (most recent call last):
File "/usr/bin/thefuck", line 13, in <module>
sys.exit(main())
^^^^^^
File "/usr/share/thefuck/thefuck/entrypoints/main.py", line 26, in main
fix_command(known_args)
File "/usr/share/thefuck/thefuck/entrypoints/fix_command.py", line 42, in fix_command
selected_command = select_command(corrected_commands)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/share/thefuck/thefuck/ui.py", line 83, in select_command
for action in read_actions():
File "/usr/share/thefuck/thefuck/ui.py", line 14, in read_actions
key = get_key()
^^^^^^^^^
File "/usr/share/thefuck/thefuck/system/unix.py", line 23, in get_key
ch = getch()
^^^^^^^
File "/usr/share/thefuck/thefuck/system/unix.py", line 14, in getch
old = termios.tcgetattr(fd)
^^^^^^^^^^^^^^^^^^^^^
termios.error: (25, 'Inappropriate ioctl for device')
The output of
thefuck --version
(something likeThe Fuck 3.1 using Python 3.5.0 and Bash 4.4.12(1)-release
):Your system (Debian 7, ArchLinux, Windows, etc.):
How to reproduce the bug:
install on Ubuntu 24.04 and try to run
thefuck --version
The output of The Fuck with
THEFUCK_DEBUG=true
exported (typically executeexport THEFUCK_DEBUG=true
in your shell before The Fuck):