mahaloz / DAILA

A decompiler-agnostic plugin for interacting with AI in your decompiler. GPT-4, Claude, and local models supported!
557 stars 51 forks source link

ImportError: cannot import name 'QObject' from 'PyQt5.Qt #55

Open ShahriyarB opened 2 months ago

ShahriyarB commented 2 months ago

No matter which version of Python or IDA Pro I use I get this error when I launch IDA Pro with daila plugin Tested on IDA Pro 7.5, 7.7 and 9.0 Tested with Python 3.9, 3.10, 3.11 and 3.12

C:\Program Files (x86)\IDA Pro 7.5 SP2\plugins\daila_plugin.py: Traceback (most recent call last): File "C:/Program Files (x86)/IDA Pro 7.5 SP2/plugins/daila_plugin.py", line 66, in PLUGIN_ENTRY return create_plugin(*args, **kwargs) File "C:/Program Files (x86)/IDA Pro 7.5 SP2/plugins/daila_plugin.py", line 11, in create_plugin return _create_plugin(*args, **kwargs) File "C:\Users\shahr\AppData\Local\Programs\Python\Python39\lib\site-packages\dailalib\__init__.py", line 50, in create_plugin deci = DecompilerInterface.discover( File "C:\Users\shahr\AppData\Local\Programs\Python\Python39\lib\site-packages\libbs\api\decompiler_interface.py", line 934, in discover from libbs.decompilers.ida.interface import IDAInterface File "C:\Users\shahr\AppData\Local\Programs\Python\Python39\lib\site-packages\libbs\decompilers\ida\interface.py", line 17, in <module> from . import compat File "C:\Users\shahr\AppData\Local\Programs\Python\Python39\lib\site-packages\libbs\decompilers\ida\compat.py", line 28, in <module> from PyQt5.Qt import QObject ImportError: cannot import name 'QObject' from 'PyQt5.Qt' (C:\Program Files (x86)\IDA Pro 7.5 SP2\python\3\PyQt5\Qt.pyd)

mahaloz commented 2 months ago

@ShahriyarB it looks like your IDA install may be corrupted in some way. To verify it is, try and go into the IDA terminal and write from PyQt5.Qt import QObject. This should never fail since QT5 is bundled with IDA.

BeErikk commented 2 months ago

First: Thanks for the plugin!

I have the error in 8.3 as well. Testing from PyQt5.Qt import QObject works OK AFAICS.

Error: C:\dev\devapps\IDA\IDA.8.3\plugins\daila_plugin.py: Traceback (most recent call last): File "C:/dev/devapps/IDA/IDA.8.3/plugins/daila_plugin.py", line 73, in PLUGIN_ENTRY return create_plugin(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:/dev/devapps/IDA/IDA.8.3/plugins/daila_plugin.py", line 11, in create_plugin return _create_plugin(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\dev\devapps\scripts\Python3\Lib\site-packages\dailalib\__init__.py", line 51, in create_plugin deci = DecompilerInterface.discover( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\dev\devapps\scripts\Python3\Lib\site-packages\libbs\api\decompiler_interface.py", line 934, in discover from libbs.decompilers.ida.interface import IDAInterface File "C:\dev\devapps\scripts\Python3\Lib\site-packages\libbs\decompilers\ida\interface.py", line 17, in <module> from . import compat File "C:\dev\devapps\scripts\Python3\Lib\site-packages\libbs\decompilers\ida\compat.py", line 28, in <module> from PyQt5.Qt import QObject ImportError: cannot import name 'QObject' from 'PyQt5.Qt' (C:\dev\devapps\IDA\IDA.8.3\python\3\PyQt5\Qt.pyd)

mahaloz commented 2 months ago

@BeErikk hmmm ok. Since this is twice now, and you are both on Windows, I'll investigate some. Considering the import works in the terminal, this must be some timing-based error of when we can load the UI.

mahaloz commented 2 months ago

59 fixed it on my machine. Updating to version 3.8.1 hopefully fixes it. Please reopen if it does not.

BeErikk commented 1 month ago

Thanks for your effort, but the error persist for me. I exchanged the plugin/daila_plugin.py with the latest version. Is there a good way to reinstall the plugin?

mahaloz commented 1 month ago

@BeErikk to update you need to do py -m pip install -U dailalib. The daila_plugin.py is just a stub for the Python backend.

BeErikk commented 1 month ago

Thanks (I know nothing about Python). There are still errors but with different messages. I think this error has been up before with a possible solution to upgrade Python. However, I don't think an upgrade will solve anything in my case:

python --version
Python 3.12.2

New error message:

C:\dev\devapps\IDA\IDA.8.3\plugins\daila_plugin.py: Traceback (most recent call last):
  File "C:/dev/devapps/IDA/IDA.8.3/plugins/daila_plugin.py", line 73, in PLUGIN_ENTRY
    return create_plugin(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:/dev/devapps/IDA/IDA.8.3/plugins/daila_plugin.py", line 11, in create_plugin
    return _create_plugin(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\dev\devapps\scripts\Python3\Lib\site-packages\dailalib\__init__.py", line 27, in create_plugin
    gui_ctx_menu_actions["DAILA/LLM/chat"] = ("Open LLM Chat...", get_llm_chat_creator(litellm_api))
                                                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\dev\devapps\scripts\Python3\Lib\site-packages\dailalib\llm_chat\__init__.py", line 16, in get_llm_chat_creator
    from dailalib.llm_chat.ida import add_llm_chat_to_ui
  File "C:\dev\devapps\scripts\Python3\Lib\site-packages\dailalib\llm_chat\ida.py", line 3, in <module>
    from PyQt5 import sip
ImportError: DLL load failed while importing sip: Det går inte att hitta den angivna modulen.
mahaloz commented 1 month ago

@BeErikk can you try these two possible things:

  1. Switch python version, I have not tested on 3.12, and others have reported some crashing
  2. pip install sip
m-kozlowski commented 1 week ago

There should be idapyswitch.exe bundled with IDA. Run it and select correct version of your python installation, it should replace .pyd files with correct ones.

mahaloz commented 1 week ago

Wow, it's unexpected that this is another idapyswitch problem. Ha.