3

I would like to use regular python packages in my IDAPython scripts, but I can't figure out how to install them into IDA's Python environment. I don't even know where this python environment is, or even where IDA's python.exe is, because sys.executable just prints the ida.exe file path. I can make it work with some packages, like yara and FIDL by installing them with pip, and copying the module's folder from my own python environment's site-packages folder over to <IDA Install Path>\python\3\, but this method doesn't work with more complex modules that have dependencies to other modules, or native DLLs (for example pywin32).

Is there an easier way to install python packages into IDA so i can just simply import them into my IDAPython scripts?

1 Answer 1

3

Found the solution. Basically, IDAPython doesn't use my default system Python installation (in C:\Python10), instead it uses the one in %localappdata%\Programs\Python\Python310\. So all I had to do was to make sure that I'm calling pip in this python installation directory and not the default one, and now I can import pip packages into IDA.

1
  • 2
    Actually IDAPython uses whatever you tell it to. Inside HKEY_CURRENT_USER\Software\Hex-Rays\IDA find (or create) an REG_SZ value named Python3TargetDLL and point it at whichever Python version you please, e.g. C:\Program Files\Python310\python3.dll. Normally you can use whichever pythonXX.dll you like, but I have issues with python310.dll vs. python3.dll in Wine. On Windows you can use py (Python launcher) to launch the default Python instance or select an alternative one. Don't recall where Python stores which is the default, but the installers offer the option.
    – 0xC0000022L
    Commented Mar 11, 2022 at 11:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.