# How to select architecture using idalib?

**URL:** <https://community.hex-rays.com/t/how-to-select-architecture-using-idalib/174>\
**Category:** C++ SDK & IDAPython\
**Tags:** idapython\
**Created:** [February 19, 2025, 7:16am UTC](https://community.hex-rays.com/t/how-to-select-architecture-using-idalib/174 "2025-02-19T07:16:00Z")\
**Posts on this page:** 6\
**Page:** 2

<div class="post-metadata">

**Author:** ![Mas0n](https://sea2.discourse-cdn.com/flex002/user_avatar/community.hex-rays.com/mas0n/32/32_2.png) [@Mas0n](https://community.hex-rays.com/u/Mas0n)\
**Post date:** [September 11, 2025, 3:05am UTC](https://community.hex-rays.com/t/how-to-select-architecture-using-idalib/174/21 "2025-09-11T03:05:19Z")

</div>

after test, it’s seems ida 9.2 must use python 3.13.5

it’s works when I use 3.13.5

```auto
$ pyenv install 3.13.5
$ pyenv local 3.13.5
$ python -m venv .venv
$ source .venv/bin/activate
$ python test.py

```

and I have another question

how to disable GUI plugins?

```auto
/Users/mason/.idapro/plugins/screenshot.py: Can't import PySide6. Are you trying to use Qt without GUI?
Traceback (most recent call last):
  File "/Applications/IDA Professional 9.2.app/Contents/MacOS/python/ida_idaapi.py", line 502, in IDAPython_ExecScript
    exec(code, g)
    ~~~~ ^^^^^^^^^
  File "/Users/mason/.idapro/plugins/screenshot.py", line 4, in <module>
    from PyQt5.QtCore import QPoint, QRect, QSize
  File "/Applications/IDA Professional 9.2.app/Contents/MacOS/python/PyQt5/ __init__.py", line 6, in <module>
    utils.confirm_decision()
    ~~~~~~~~~~~~~~~~~~~~~~ ^^
  File "/Applications/IDA Professional 9.2.app/Contents/MacOS/python/PyQt5/utils.py", line 118, in confirm_decision
    raise NotImplementedError(
        "Can't import PySide6. Are you trying to use Qt without GUI?")
NotImplementedError: Can't import PySide6. Are you trying to use Qt without GUI?

```

---

<div class="post-metadata">

**Author:** ![igor](https://sea2.discourse-cdn.com/flex002/user_avatar/community.hex-rays.com/igor/32/35_2.png) [@igor](https://community.hex-rays.com/u/igor)\
**Post date:** [September 11, 2025, 9:36am UTC](https://community.hex-rays.com/t/how-to-select-architecture-using-idalib/174/22 "2025-09-11T09:36:01Z")

</div>

We’re working on a generic solution for GUI plugins, but in the meantime you need to modify them to import Qt libs only when running under GUI (`ida_kernwin.is_idaq()`).

---

<div class="post-metadata">

**Author:** ![igor](https://sea2.discourse-cdn.com/flex002/user_avatar/community.hex-rays.com/igor/32/35_2.png) [@igor](https://community.hex-rays.com/u/igor)\
**Post date:** [September 11, 2025, 12:29pm UTC](https://community.hex-rays.com/t/how-to-select-architecture-using-idalib/174/23 "2025-09-11T12:29:32Z")

</div>

> [@Mas0n](#):
>
> `_bitcountr_zero`

This symbol is new in 9.2 and is exported by `libida.dylib`.It seems that somehow a wrong `libida.dylib`is loaded in your case (from 9.1?). Please try to figure out why. Maybe check `$HOME/.idapro/ida-config.json`(although normally it should not matter if you set `IDADIR`).

---

<div class="post-metadata">

**Author:** ![Mas0n](https://sea2.discourse-cdn.com/flex002/user_avatar/community.hex-rays.com/mas0n/32/32_2.png) [@Mas0n](https://community.hex-rays.com/u/Mas0n)\
**Post date:** [September 12, 2025, 1:31am UTC](https://community.hex-rays.com/t/how-to-select-architecture-using-idalib/174/24 "2025-09-12T01:31:26Z")

</div>

No, I has been set env manually and before import: `os.environ[‘IDADIR’] = ‘/Applications/IDA Professional 9.2.app/Contents/MacOS’`

but it’s seems must match python version 3.13.5, meaning it cannot be work with others. I try 3.13.4 and 3.12.9 all problems points to `_bitcountr_zero`. I guess compiled binary in `python/lib-dynload` depends with fixed python version?

---

<div class="post-metadata">

**Author:** ![williballenthin](https://sea2.discourse-cdn.com/flex002/user_avatar/community.hex-rays.com/williballenthin/32/122_2.png) [@williballenthin](https://community.hex-rays.com/u/williballenthin)\
**Post date:** [September 12, 2025, 12:11pm UTC](https://community.hex-rays.com/t/how-to-select-architecture-using-idalib/174/25 "2025-09-12T12:11:20Z")

</div>

I haven’t been able to reconstruct your environment completely (at least given the hints above), but I am able to use Python 3.13.0 with idalib on macOS:

 ![image](https://us1.discourse-cdn.com/flex002/uploads/rays_hex/original/1X/7628828d7c22ddd6163f93e98c270d37cce79091.png)

I see that you’re manipulating the `IDADIR` environment variable and search path (`sys.path`) within your script. Would you please try relying strictly on the `idapro` module to handle the setup of the search paths? That is, please try:

1. removing the `os.environ…` line and the `sys.path...` lines, and then
2. ensuring you have the current IDA installation activated for idalib: `python /Applications/IDA\ Professional\ 9.2.app/Contents/MacOS/idalib/python/py-activate-idalib.py`
3. ensure you don’t have any IDA environment variables set in your shell (`IDAUSR`, `IDADIR`, etc.)

The script should look something like this:

 ![image](https://us1.discourse-cdn.com/flex002/uploads/rays_hex/original/1X/f761e8cc6a5b4bd38fbbffd3b397e0c60302b644.png)

Then try `python test.py` again. I’m wondering if maybe the manual tweaks to the load paths/variables are interfering with the way the `idapro` module is setting up the environment.

–

note: I don’t _think_ that idapyswitch has to be set to the same Python version as is running within your idalib environment, but it doesn’t hurt to ensure they’re the same, at least until you get this working again.

---

<div class="post-metadata">

**Author:** ![Mas0n](https://sea2.discourse-cdn.com/flex002/user_avatar/community.hex-rays.com/mas0n/32/32_2.png) [@Mas0n](https://community.hex-rays.com/u/Mas0n)\
**Post date:** [September 16, 2025, 3:03am UTC](https://community.hex-rays.com/t/how-to-select-architecture-using-idalib/174/26 "2025-09-16T03:03:16Z")

</div>

Thx, I test it on my PC, it’s works will on Python 3.12.

So, I think it’s my fault, I will check my configure and environment.

[Previous page](https://community.hex-rays.com/t/how-to-select-architecture-using-idalib/174.md?page=1)
