Comments (17)
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.
from thefuck.
Found in a #1434
pip uninstall thefuck
pip install https://github.com/nvbn/thefuck/archive/master.zip
from thefuck.
It seems thefuck can`t work on python 3.12. The last release was build in 2022. May need someone update it.
from thefuck.
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"
from thefuck.
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!!).
from thefuck.
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 😁
from thefuck.
I found this topic on Stack Overflow: it seems should be
importlib
instead ofimp
with Python 3.12.
As mentioned ^^^:
#1449 (comment)
from thefuck.
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
from thefuck.
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! 😝
from thefuck.
@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!
from thefuck.
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.
from thefuck.
I found this topic on Stack Overflow: it seems should be importlib
instead of imp
with Python 3.12.
from thefuck.
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?
from thefuck.
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.
from thefuck.
@nvbn Коллега, пожалуйста, если есть возможность, исправьте установку под Убунту 22.04.
Уж больно много плясок с бубном приходиться делать что бы в ато режиме раскатать софт...
Благодарствую!
from thefuck.
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')
from thefuck.
Really wish Python stuff was easier to use without all these gymnastics 😁
@unikitty37 there is pipx. I applied the changes made in 0420442 and https://github.com/nvbn/thefuck/pull/1404/files to the pipx installed version, located in ~/.local/share/pipx/venvs/thefuck/lib/python3.12/site-packages/thefuck/
.
from thefuck.
Related Issues (20)
- /.zshrc:1: command not found: thefuck HOT 3
- Shell slow to start with `eval "$(thefuck --alias)"`, workaround is a lazy loading trick HOT 1
- Fuck command does not work on Alacritty (Mint) HOT 1
- When using Windows Terminal to ssh to a remote server with Zsh/OMZ/powerlevel10k, and instant mode in ~/.zshrc, sometimes crash on start up. HOT 1
- Help for installing on windows HOT 4
- ModuleNotFoundError: No module named 'imp' when running 'fuck' HOT 20
- Error in building development container
- Feature Request: Instant-Interactive Mode + Zoxide with FZF HOT 1
- Compatibility with pytest 8
- apt command completion error
- Alternative Exit sequence? HOT 1
- Doesn't work in nushell (sees it as generic shell) HOT 1
- [Suggestion]
- ModuleNotFoundError: No module named 'distutils' related to #1434 HOT 6
- "imp" module removed in python 3.12 HOT 1
- Thefuck with Python 3.12.x HOT 3
- Thefuck 3.32 issue on Fedora 40
- Python 3.11 and 3.12 complains about `imp` which cannot be installed in those environments. HOT 5
- [Suggestion]
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from thefuck.