IDAEnvOrchestrator
Smart IDA Python environment activator with seamless virtualenv/Conda detection, auto-path patching, and developer-friendly prompts.
Install / Use
/learn @quippy-dev/IDAEnvOrchestratorREADME
IDAEnvOrchestrator
Environment activation helpers for IDA Pro that automatically pick the right Python runtime (virtualenv or Conda/Mamba), patch search paths safely, and keep your IDA toolchain aligned with the packages you install.
Why This Exists
Willi Ballenthin’s March 25, 2025 write-up, "Using a virtualenv for IDAPython", documents the pain of trying to use a pure virtualenv with IDAPython: the interpreter DLL/libpython binary that idapyswitch expects is usually not sufficient, so IDA cannot fully transition to the isolated environment and crashes on startup. IDAEnvOrchestrator codifies a workflow that pairs IDA with environments that do ship the necessary runtime (Conda, micromamba, classic virtualenv seeded from a full interpreter) and automates the activation logic inside envs.py.
Features
- Detects already-active
VIRTUAL_ENV/CONDA_PREFIXso IDA respects your terminal session when launched from the shell. - Shared activation helpers for virtualenv and Conda/Mamba with consistent path normalization (
pathlib), retries, and detailed logging. - Seamless prompting through
idaapi.ask_str/askstrwhen you prefer to select an environment at startup. - Works from both ad-hoc console sessions and direct launching of IDA via
idapythonrc.py, avoiding the need to start IDA from an already-activated shell. - Defensive fallbacks that leave IDA running even when activation fails, rather than breaking your session.
Installation
- Determine your IDA user directory (inside IDA run
print(idaapi.get_user_idadir()); typically~/.idaproor%APPDATA%\Hex-Rays\IDA Pro). - Copy
envs.pyinto that directory. - Edit
idapythonrc.pyas described below. - Restart IDA so the new helpers are imported.
# macOS/Linux example: install straight from GitHub
curl -fLo "$HOME/.idapro/envs.py" https://raw.githubusercontent.com/quippy-dev/IDAEnvOrchestrator/main/envs.py
Proven Environment Setup (micromamba + idapyswitch)
The lightweight uv install ... --default workflow highlighted in the article still lacks an adequate libpython for IDA. Conda-family distributions ship everything IDA needs, and micromamba gives you that in three quick steps:
"${SHELL}" <(curl -L micro.mamba.pm/install.sh)
micromamba create --use-uv --platform osx-arm64 python==3.10.11 --prefix ~/.idapro/venv
idapyswitch -s "$HOME/micromamba/lib/libpython3.10.dylib"
Replace the shared library path with the one produced by your micromamba install (or Windows .dll / Linux .so), and always adjust the idapyswitch path.
Required: Always run
idapyswitch -s /full/path/to/libpython3.x.{dylib|so|dll}so IDA links against the same runtime that seeded your environment packages. Minimal interpreter stubs (includinguvinstallations) will crash IDA.
Configuring idapythonrc.py
Once envs.py is in place, add the contents of the repo’s idapythonrc.py to $IDAUSR/idapythonrc.py and enable whichever call pattern suits your setup:
from envs import detect_env, activate_conda_env, activate_virtualenv_env
# Option 1: auto-detect via env vars, retrying when needed
if not detect_env():
print("IDAEnvOrchestrator: no environment activated; using stock interpreter.")
# Option 2: enforce a virtualenv relative to $IDAUSR
# detect_env(".venv")
# Option 3: Conda/Mamba helpers
envs_path = "venv" # directory under $IDAUSR (or pass base=/absolute/prefix)
try:
env_path = activate_conda_env(env=envs_path, interactive=False)
print(f"IDAEnvOrchestrator: using Conda prefix at {env_path}")
except ValueError as exc:
print(f"IDAEnvOrchestrator: conda activation fallback triggered: {exc}")
# activate_conda_env(env=None) # prompt each startup
# Option 4: Virtualenv helpers
# activate_virtualenv_env(virtualenv="virtualenv")
# activate_virtualenv_env(virtualenv=None) # prompt each startup
You can still trigger activation manually from the IDA Python console:
from envs import detect_env
if not detect_env():
print("No environment detected; check log output.")
Usage Notes
- Match interpreter versions: if your virtualenv/Conda env targets 3.10, ensure IDA is currently configured via
idapyswitchfor the corresponding Python 3.10libpython. - When using micromamba or Conda, the helper adds both
<env>/binand<env>/Scripts(Windows) toPATHand pushes newsite-packagesentries to the top ofsys.pathwithout losing the previous ordering. detect_env()retries with default parameters after a failed explicit attempt, so you can provide preferred names without breaking auto-discovery.
Troubleshooting
- “No conda env detected in …” – Confirm the prefix contains a
conda-meta/subdirectory and that IDA points to the matchinglibpython3.xviaidapyswitch -s. - Missing
activate_this.py– Recreate the environment withpython -m virtualenv <path>; the barevenvmodule omits the activator file that IDA requires. - IDA crashes on start – Usually indicates IDA is still bound to a different/insufficient
libpythonthan the one that built your packages. Re-runidapyswitch -s /path/to/libpythonto re-sync.
Credits
- Willi Ballenthin — Using a virtualenv for IDAPython.
- @Kerrigan29a — idapython_virtualenv.
- @gaasedelen for his fork of the above.
- ESET Research — IPyIDA virtualenv instructions.
These resources shaped the workflow that IDAEnvOrchestrator refines and automates.
Related Skills
node-connect
346.4kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
107.2kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
346.4kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
346.4kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
