Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot install on Ubuntu 24.04 LTS Noble Numbat #1457

Open
shalak opened this issue Aug 15, 2024 · 14 comments
Open

Cannot install on Ubuntu 24.04 LTS Noble Numbat #1457

shalak opened this issue Aug 15, 2024 · 14 comments

Comments

@shalak
Copy link

shalak commented Aug 15, 2024

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
Copy link

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
Copy link

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
Copy link

mortael commented Aug 28, 2024

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
Copy link
Author

shalak commented Aug 29, 2024

$ 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
Copy link

PVTejas commented Aug 30, 2024

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

@jalopez-arkeero
Copy link

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
Copy link

PVTejas commented Aug 30, 2024 via email

@Firesphere
Copy link

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
Copy link
Author

shalak commented Aug 31, 2024

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
Copy link

PVTejas commented Sep 2, 2024 via email

@depoulo
Copy link

depoulo commented Sep 2, 2024

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
Copy link

sid2364 commented Oct 8, 2024

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
Copy link

PVTejas commented Oct 8, 2024

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

  • thefuck doesn't overwrite an existing system package
  • requirements.txt specifies a version for only one package: setup-tools, and it is a >= type so it is likely fine in py3.12

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

@sean-abbott
Copy link

Uninstalling for now (my install via pipx was complaining about no distutils, and when I tried to install distutils in the virtuealenv it complained), but will return if it's fixed. :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants