nvbn / thefuck

Magnificent app which corrects your previous console command.
MIT License
85.23k stars 3.44k forks source link

Cannot install on Ubuntu 24.04 LTS Noble Numbat #1457

Open shalak opened 2 months ago

shalak commented 2 months ago

The output of thefuck --version (something like The Fuck 3.1 using Python 3.5.0 and Bash 4.4.12(1)-release):

Cannot check

Your system (Debian 7, ArchLinux, Windows, etc.):

Distributor ID: Ubuntu Description: Ubuntu 24.04 LTS Release: 24.04 Codename: noble

How to reproduce the bug:

~$ thefuck --version
Traceback (most recent call last):
  File "/usr/bin/thefuck", line 9, in <module>
    from thefuck.entrypoints.main import main
  File "/usr/share/thefuck/thefuck/entrypoints/main.py", line 8, in <module>
    from .. import logs  # noqa: E402
    ^^^^^^^^^^^^^^^^^^^
  File "/usr/share/thefuck/thefuck/logs.py", line 8, in <module>
    from .conf import settings
  File "/usr/share/thefuck/thefuck/conf.py", line 1, in <module>
    from imp import load_source
ModuleNotFoundError: No module named 'imp'
~$ pip3 install thefuck --user
error: externally-managed-environment

× This environment is externally managed
╰─> To install Python packages system-wide, try apt install
    python3-xyz, where xyz is the package you are trying to
    install.

    If you wish to install a non-Debian-packaged Python package,
    create a virtual environment using python3 -m venv path/to/venv.
    Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
    sure you have python3-full installed.

    If you wish to install a non-Debian packaged Python application,
    it may be easiest to use pipx install xyz, which will manage a
    virtual environment for you. Make sure you have pipx installed.

    See /usr/share/doc/python3.12/README.venv for more information.

note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
hint: See PEP 668 for the detailed specification.

The output of The Fuck with THEFUCK_DEBUG=true exported (typically execute export THEFUCK_DEBUG=true in your shell before The Fuck):

ModuleNotFoundError: No module named 'imp'

Anything else you think is relevant:

I updated from Ubuntu 22 to 24 and now thefuck doesn't work due to missing imp in python3.12.3

Stanton-e commented 2 months ago

systems: Ubuntu Budgie on a desktop, Ubuntu 24.04 on a laptop Distributor ID: Ubuntu Description: Ubuntu 24.04 LTS Release: 24.04 Codename: noble

any command to do with thefuck or fuck triggers this

$ thefuck --version
Traceback (most recent call last):
  File "/home/stan/.local/bin/thefuck", line 5, in <module>
    from thefuck.entrypoints.main import main
  File "/home/stan/.local/lib/python3.12/site-packages/thefuck/entrypoints/main.py", line 8, in <module>
    from .. import logs  # noqa: E402
    ^^^^^^^^^^^^^^^^^^^
  File "/home/stan/.local/lib/python3.12/site-packages/thefuck/logs.py", line 8, in <module>
    from .conf import settings
  File "/home/stan/.local/lib/python3.12/site-packages/thefuck/conf.py", line 1, in <module>
    from imp import load_source
ModuleNotFoundError: No module named 'imp'

same issue as og post

PaleFlyer commented 2 months ago

Clean install of Nobel does the same. I can't get PIP3 to install thefuck.

Says the same error as the bottom half of the OP post.

mortael commented 2 months ago

Install it with pip directly from this repo: pip install git+https://github.com/nvbn/thefuck

As you can see is https://github.com/nvbn/thefuck/blob/master/thefuck/conf.py updated using importlib

shalak commented 2 months ago
$ pip install git+https://github.com/nvbn/thefuck
error: externally-managed-environment

× This environment is externally managed
╰─> To install Python packages system-wide, try apt install
    python3-xyz, where xyz is the package you are trying to
    install.

Would need to put it in virtualenv :/

PVTejas commented 2 months ago

I managed to install it by passing the --break-system-packages flag, but then it throws another error no module named 'imp'

jalopez-arkeero commented 2 months ago

I encountered the same issue when running the command:

thefuck --version

I received the following traceback:

Traceback (most recent call last):
  File "/home/tekylo/.local/bin/thefuck", line 5, in <module>
    from thefuck.entrypoints.main import main
ModuleNotFoundError: No module named 'thefuck'

It seems like the module is not being found. Any insights on how to resolve this?

PVTejas commented 2 months ago

I had the same error. I had installed on Ubuntu 22.04 with py3.10. When I upgraded to 24.04, python also got upgraded to 3.12 and that environment did not have thefuck installed. On Friday, 30 August 2024 at 12:52, José Antonio López Molina @.***> wrote:

I encountered the same issue when running the command:

thefuck --version

I received the following traceback:

Traceback (most recent call last): File "/home/tekylo/.local/bin/thefuck", line 5, in from thefuck.entrypoints.main import main ModuleNotFoundError: No module named 'thefuck'

It seems like the module is not being found. Any insights on how to resolve this?

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

Firesphere commented 2 months ago

Install it with pip directly from this repo: pip install git+https://github.com/nvbn/thefuck

As you can see is https://github.com/nvbn/thefuck/blob/master/thefuck/conf.py updated using importlib

This method, but using pip3 install --user git+https://github.com/nvbn/thefuck fixed it for me, for now.

shalak commented 2 months ago

I tried like this, no luck:

$ pipx install thefuck --force --include-deps 
Installing to existing venv 'thefuck'
⚠️  Note: thefuck was already on your PATH at /usr/bin/thefuck
  installed package thefuck 3.32, installed using Python 3.12.3
  These apps are now globally available
    - fuck
    - thefuck
done! ✨ 🌟 ✨
$ fuck
Traceback (most recent call last):
  File "/home/shalak/.local/bin/fuck", line 5, in <module>
    from thefuck.entrypoints.not_configured import main
  File "/home/shalak/.local/share/pipx/venvs/thefuck/lib/python3.12/site-packages/thefuck/entrypoints/not_configured.py", line 2, in <module>
    from ..system import init_output
  File "/home/shalak/.local/share/pipx/venvs/thefuck/lib/python3.12/site-packages/thefuck/system/__init__.py", line 7, in <module>
    from .unix import *  # noqa: F401,F403
    ^^^^^^^^^^^^^^^^^^^
  File "/home/shalak/.local/share/pipx/venvs/thefuck/lib/python3.12/site-packages/thefuck/system/unix.py", line 6, in <module>
    from distutils.spawn import find_executable
ModuleNotFoundError: No module named 'distutils'
$ pipx install distutils
Fatal error from pip prevented installation. Full pip output in file:
    /home/shalak/.local/state/pipx/log/cmd_2024-08-31_09.00.46_pip_errors.log

Some possibly relevant errors from pip install:
    ERROR: Could not find a version that satisfies the requirement distutils (from versions: none)
    ERROR: No matching distribution found for distutils

Error installing distutils.
$ pipx install setuptools

No apps associated with package setuptools or its dependencies. If you are attempting to install a library, pipx should not be used. Consider using pip or a similar tool instead.
PVTejas commented 1 month ago

pip3 uninstall thefuck​ pip3 install --user git+https://github.com/nvbn/thefuck --break-system-packages

Worked for me On Saturday, 31 August 2024 at 12:33, Mirek @.***> wrote:

I tried like this, no luck:

$ pipx install thefuck --force --include-deps Installing to existing venv 'thefuck' ⚠️ Note: thefuck was already on your PATH at /usr/bin/thefuck installed package thefuck 3.32, installed using Python 3.12.3 These apps are now globally available

  • fuck
  • thefuck done! ✨ 🌟 ✨ $ fuck Traceback (most recent call last): File "/home/shalak/.local/bin/fuck", line 5, in from thefuck.entrypoints.not_configured import main File "/home/shalak/.local/share/pipx/venvs/thefuck/lib/python3.12/site-packages/thefuck/entrypoints/not_configured.py", line 2, in from ..system import init_output File "/home/shalak/.local/share/pipx/venvs/thefuck/lib/python3.12/site-packages/thefuck/system/init.py", line 7, in from .unix import * # noqa: F401,F403 ^^^^^^^^^^^^^^^^^^^ File "/home/shalak/.local/share/pipx/venvs/thefuck/lib/python3.12/site-packages/thefuck/system/unix.py", line 6, in from distutils.spawn import find_executable ModuleNotFoundError: No module named 'distutils' $ pipx install distutils Fatal error from pip prevented installation. Full pip output in file: /home/shalak/.local/state/pipx/log/cmd_2024-08-31_09.00.46_pip_errors.log

Some possibly relevant errors from pip install: ERROR: Could not find a version that satisfies the requirement distutils (from versions: none) ERROR: No matching distribution found for distutils

Error installing distutils. $ pipx install setuptools

No apps associated with package setuptools or its dependencies. If you are attempting to install a library, pipx should not be used. Consider using pip or a similar tool instead.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

depoulo commented 1 month ago

pip3 uninstall thefuck​ pip3 install --user git+nvbn/thefuck --break-system-packages Worked for me

worked for me too, here without the linkifier:

pip3 install --user git+https://github.com/nvbn/thefuck --break-system-packages
sid2364 commented 3 weeks ago

Should we really be using --break-system-packages? The whole point of it to not mess with the system installation of Python. It's clearly not recommended as an installation method. This seems unnecessarily dangerous...

Thoughts?

PVTejas commented 3 weeks ago

You're right. we need to be VERY careful using that option. In my opinion, it's fine in this case because:

Still, it's good to be clear about these reasons, so thanks for bringing it up.