thefuck
thefuck copied to clipboard
ImportError: No module named 'thefuck.entrypoints'
Getting the following error message as soon as .bashrc is evaluated (while opening a Bash shell):
Traceback (most recent call last):
File "/usr/local/bin/thefuck", line 7, in <module>
from thefuck.entrypoints.main import main
ImportError: No module named 'thefuck.entrypoints'
Package was installed on a Ubuntu 16.04 system via "sudo pip3 install thefuck" and .bashrc contains the line "eval $(thefuck --alias)".
Some more details (in case these help):
$ sudo ls -Ahl /usr/local/lib/python3.5/dist-packages/thefuck/ | grep entrypoints
drwxr-s--- 3 root staff 4.0K Oct 21 11:54 entrypoints
$ sudo ls -Ahl /usr/local/lib/python3.5/dist-packages/thefuck/entrypoints
total 24K
-rw-r----- 1 root staff 683 Oct 21 11:47 alias.py
-rw-r----- 1 root staff 1.6K Oct 21 11:47 fix_command.py
-rw-r----- 1 root staff 0 Oct 21 11:47 __init__.py
-rw-r----- 1 root staff 986 Oct 21 11:47 main.py
-rw-r----- 1 root staff 3.3K Oct 21 11:47 not_configured.py
drwxr-s--- 2 root staff 4.0K Oct 21 11:47 __pycache__
-rw-r----- 1 root staff 1.6K Oct 21 11:47 shell_logger.py
And contents of main.py:
# Initialize output before importing any module, that can use colorama.
from ..system import init_output
init_output()
import os # noqa: E402
import sys # noqa: E402
from .. import logs # noqa: E402
from ..argument_parser import Parser # noqa: E402
from ..utils import get_installation_info # noqa: E402
from .alias import print_alias # noqa: E402
from .fix_command import fix_command # noqa: E402
from .shell_logger import shell_logger # noqa: E402
def main():
parser = Parser()
known_args = parser.parse(sys.argv)
if known_args.help:
parser.print_help()
elif known_args.version:
logs.version(get_installation_info().version,
sys.version.split()[0])
elif known_args.command or 'TF_HISTORY' in os.environ:
fix_command(known_args)
elif known_args.alias:
print_alias(known_args)
elif known_args.shell_logger:
shell_logger(known_args.shell_logger)
else:
parser.print_usage()
Try to run sudo pip3 install -U thefuck
Same situation as @rigved, running in WSL.
I had the same issue on Arch Linux. What solved it for me was to look at where thefuck was imported from:
>>> import thefuck
>>> help(thefuck)
[…]
FILE
/home/max/.local/lib/python3.6/site-packages/thefuck/__init__.py
[…]
I don't remember installing it using pip --user
, but it ended up there somehow. Getting rid of this copy solved it for me.
Maybe this helps @LuckierDodge or @rigved
Tried your test file, got this as output:
Help on package thefuck:
NAME
thefuck
PACKAGE CONTENTS
argument_parser
conf
const
corrector
exceptions
logs
main
not_configured
types
ui
utils
FILE
(built-in)
@nvbn that also did not help. In fact, in the Bash shell itself, I am getting this error message:
$ thefuck --alias
Traceback (most recent call last):
File "/usr/local/bin/thefuck", line 7, in <module>
from thefuck.entrypoints.main import main
ImportError: No module named 'thefuck.entrypoints'
@jmtoball this is what I got:
Help on package thefuck:
NAME
thefuck
PACKAGE CONTENTS
argument_parser
conf
const
corrector
entrypoints (package)
exceptions
logs
main
not_configured
output_readers (package)
rules (package)
shells (package)
specific (package)
system (package)
types
ui
utils
FILE
/usr/local/lib/python3.5/dist-packages/thefuck/__init__.py
Some more details:
$ python3
Python 3.5.2 (default, Nov 23 2017, 16:37:01)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from thefuck.entrypoints.main import main
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named 'thefuck.entrypoints'
>>>
$ sudo python3
Python 3.5.2 (default, Nov 23 2017, 16:37:01)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from thefuck.entrypoints.main import main
>>>
What could this mean? I checked access permissions in the "/usr/local/lib/python3.5/dist-packages/" folder and the "thefuck" folder had the same permissions as other folders. I am not sure what else to check. If it makes any difference, this is happening only on non-GUI systems (on servers). On my personal machine, I'm not facing this issue.
running sudo pip install thefuck
again fixed it for me
Ubuntu Bionic (18.04): installing with pip3 (official guide) didn't fix the issue, but good old apt-get install thefuck
fixed!
I had the same issue on Ubuntu 16.04. The following steps solved it for me.
Firstly locate where "thefuck" module is installed. For me, it is /usr/local/lib/python3.5/dist-packages/
Then change the permission of "thefuck" folder:
cd /usr/local/lib/python3.5/dist-packages
sudo chmod -R 755 thefuck
https://github.com/nvbn/thefuck/issues/716#issuecomment-339402369 Running Manjaro (Arch Linux) and it worked for me. Thank you!
I had the error at issue after doing an in-place upgrade of Mint 19/3 to Mint 20. I tried sudo pip3 install -U thefuck
, opened a new terminal, and gave a fuck
. My computer rebooted! Fuck indeed! Or rather perhaps: bloomin' Python. (Edited to fix a formatting mistake and to say, admittedly unhelpfully, the following. TheFuck works now, though I don't know what caused it to start working.)
I had the same problem.
My problem was that I am using anaconda, so there are many versions of python (and thus potentially thefuck) which can be installed. And when I start a terminal, it is the non-conda version of python which is used to start thefuck before conda is started.
So to solve the problem I needed to do:
conda deactivate
pip install -U thefuck
and then again redo pip install in any conda env I want to use it in.