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

Help for installing on windows #1433

Open
Cooperzilla opened this issue Feb 3, 2024 · 4 comments
Open

Help for installing on windows #1433

Cooperzilla opened this issue Feb 3, 2024 · 4 comments

Comments

@Cooperzilla
Copy link

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

Causes Error below

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

Windowns 11
And my shell is powershell

How to reproduce the bug:

pip install thefuck

and added `iex "$(thefuck --alias)"` to my powershell profile

The error msg:

Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "C:\Users\user\AppData\Local\Programs\Python\Python312-32\Scripts\thefuck.exe\__main__.py", line 4, in <module>
  File "C:\Users\user\AppData\Local\Programs\Python\Python312-32\Lib\site-packages\thefuck\entrypoints\main.py", line 8, in <module>
    from .. import logs  # noqa: E402
    ^^^^^^^^^^^^^^^^^^^
  File "C:\Users\user\AppData\Local\Programs\Python\Python312-32\Lib\site-packages\thefuck\logs.py", line 8, in <module>
    from .conf import settings
  File "C:\Users\user\AppData\Local\Programs\Python\Python312-32\Lib\site-packages\thefuck\conf.py", line 1, in <module>
    from imp import load_source
ModuleNotFoundError: No module named 'imp'
Invoke-Expression : Cannot bind argument to parameter 'Command' because it is an empty string.
@Theblackcat98
Copy link

Theblackcat98 commented Feb 6, 2024

+1 On this error.
Getting the same exact error output on my windows install.

(Although it seems this issue is not System-Specific I'll fill out an issue template aswell.)


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

File "", line 198, in _run_module_as_main
File "", line 88, in run_code
File "C:\Python312\Scripts\thefuck.exe_main
.py", line 4, in
File "C:\Python312\Lib\site-packages\thefuck\entrypoints\main.py", line 8, in
from .. import logs # noqa: E402
^^^^^^^^^^^^^^^^^^^
File "C:\Python312\Lib\site-packages\thefuck\logs.py", line 8, in
from .conf import settings
File "C:\Python312\Lib\site-packages\thefuck\conf.py", line 1, in
from imp import load_source
ModuleNotFoundError: No module named 'imp'

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

Windows 11, using Powershell

  • How to reproduce the bug:

pip install thefuck

fuck

  • The error msg:

Same as above

@Theblackcat98
Copy link

Fixed this issue, caused my deprecated package "imp" in Python 12
Check 904693a

@webbertakken
Copy link

Still getting the same issue on thefuck 3.32 and PowerShell 7.4.1.

image

Looking at mentioned commit, the page gives a warning

This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Comparing it to the current main branch, it looks like imp is still in place (red is main, green is suggested fix).

from six import text_type
from . import const
from .system import Path

+ import importlib.util
+ import importlib.machinery
+ 
+ 
+ def load_source(modname, filename):
+     loader = importlib.machinery.SourceFileLoader(modname, filename)
+     spec = importlib.util.spec_from_file_location(modname, filename, loader=loader)
+     module = importlib.util.module_from_spec(spec)
+     # The module is always executed and not cached in sys.modules.
+     # Uncomment the following line to cache the module.
+     # sys.modules[module.__name__] = module
+     loader.exec_module(module)
+     return module
- try:
-     import importlib.util
- 
-     def load_source(name, pathname, _file=None):
-         module_spec = importlib.util.spec_from_file_location(name, pathname)
-         module = importlib.util.module_from_spec(module_spec)
-         module_spec.loader.exec_module(module)
-         return module
- except ImportError:
-     from imp import load_source

@Theblackcat98 did you suggest this change in a PR that you could reference?

Did the fix magically disappear? :)

@webbertakken
Copy link

related: #1434

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

3 participants