aider icon indicating copy to clipboard operation
aider copied to clipboard

Uncaught NameError in __init__.py line 533

Open erik-balfe opened this issue 1 year ago • 1 comments

Aider version: 0.58.1 Python version: 3.12.3 Platform: Linux-6.10.8-201.fsync.fc40.x86_64-x86_64-with-glibc2.39 Python implementation: CPython Virtual environment: Yes OS: Linux 6.10.8-201.fsync.fc40.x86_64 (64bit) Git version: git version 2.43.0

An uncaught exception occurred when i launched aider without args, then asked a question via /help command:

Traceback (most recent call last):
  File "aider", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "main.py", line 727, in main
    coder.run()
  File "base_coder.py", line 730, in run
    self.run_one(user_message, preproc)
  File "base_coder.py", line 767, in run_one
    message = self.preproc_user_input(user_message)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "base_coder.py", line 756, in preproc_user_input
    return self.commands.run(inp)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "commands.py", line 231, in run
    return self.do_run(matching_commands[0][1:], rest_inp)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "commands.py", line 206, in do_run
    return cmd_method(args)
           ^^^^^^^^^^^^^^^^
  File "commands.py", line 941, in cmd_help
    res = install_help_extra(self.io)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "help.py", line 24, in install_help_extra
    res = utils.check_pip_install_extra(
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "utils.py", line 330, in check_pip_install_extra
    __import__(module)
  File "__init__.py", line 1, in <module>
    from llama_index.embeddings.huggingface.base import (
  File "base.py", line 28, in <module>
    from sentence_transformers import SentenceTransformer
  File "__init__.py", line 9, in <module>
    from sentence_transformers.cross_encoder.CrossEncoder import CrossEncoder
  File "__init__.py", line 3, in <module>
    from .CrossEncoder import CrossEncoder
  File "CrossEncoder.py", line 9, in <module>
    import torch
  File "__init__.py", line 533, in <module>
    for name in dir(_C):
                    ^^
NameError: name '_C' is not defined

erik-balfe avatar Oct 03 '24 14:10 erik-balfe

Thank you for filing this issue.

Can you please try to install or reinstall aider in a separate Python environment? Either with venv or pipx?

Please remove the existing environment/aider installation first, e.g. with pipx:

$ pipx uninstall aider-chat
uninstalled aider-chat! ✨ 🌟 ✨
$ pipx install aider-chat
  installed package aider-chat 0.58.1, installed using Python 3.12.6
  These apps are now globally available
    - aider
done! ✨ 🌟 ✨

This document may be helpful -> https://aider.chat/docs/troubleshooting/imports.html

fry69 avatar Oct 03 '24 14:10 fry69

I'm closing this issue for now.

If any new related concerns arise, please feel free to comment, and I'll reopen the issue.

fry69 avatar Oct 05 '24 12:10 fry69