Search code examples
macoscommand-linecpu-architecturekdbpyq

How to force the right architecture for pyq?


I've downloaded 32-bit version of kdb+ and installed q as instructed:

unzip macosx.zip -d ~/

And I've installed pyq in the following way:

pip3 install --upgrade -i https://pypi.enlnt.com pyq

However the error when running pyq which I've got is:

$ pyq
Welcome to kdb+ 32bit edition
For support please see http://groups.google.com/d/forum/personal-kdbplus
Tutorials can be found at http://code.kx.com/wiki/Tutorials
To exit, type \\
To remove this startup msg, edit q.q
'2015.06.06T15:29:01.334 dlopen(/Users/user/q/m32/py.cpython-34m.so, 2): no suitable image found.  Did find:
    /Users/user/q/m32/py.cpython-34m.so: mach-o, but wrong architecture
@
"q"
"py:PYSO 2:(`py;3)"
$ lipo -info `which pyq`
Non-fat file: /usr/local/bin/pyq is architecture: x86_64
$ lipo -info ~/q/m32/py.cpython-34m.so
Non-fat file: ~/q/m32/py.cpython-34m.so is architecture: x86_64

So basically py.cpython-34m.so has x86_64 architecture (which is fine), but it seems to fail when running under kdb+ 32bit edition. I could install kdb+ 64bit, however only 32bit edition is free.

I've tried to run it as:

$ arch -i386 pyq

to force 32-bit architecture (the same with arch -x86_64 pyq), but different error appears:

arch: posix_spawnp: pyq: Bad CPU type in executable

My architecture is x86_64 as per:

$ uname -a
Darwin MacBook-Pro-2.local 13.4.0 Darwin Kernel Version 13.4.0: Wed Mar 18 16:20:14 PDT 2015; root:xnu-2422.115.14~1/RELEASE_X86_64 x86_64 i386 MacBookPro11,3 Darwin

How do I install compatible version of pyq or force it to run under the right architecture?


Solution

  • We recommend using universal libraries on Mac OSX. In our testing, PyQ works well with the pre-installed system Python

    $ lipo -info /usr/bin/python
    Architectures in the fat file: /usr/bin/python are: x86_64 i386
    

    and Python installed by "brew" using the --universal option.