KxSystems / pyq

PyQ — Python for kdb+
http://code.kx.com/q/interfaces
Apache License 2.0
191 stars 49 forks source link

Cannot run pyq with 64bit kdb+ #49

Closed gtataranni closed 6 years ago

gtataranni commented 6 years ago

Hi, I am trying to install pyq in a python virtualenv, following the instructions here, with a licensed copy of kdb (64bit). Installation goes fine, but when I try to run pyq I get the following error:

(krypton_env_64) giovanni@mymachine ~$ pyq
qbinpath = /home/giovanni/workspace/krypton_env_64/q/l64/q
qbinpath = /home/giovanni/workspace/krypton_env_64/q/l64/q
qbinpath = /home/giovanni/workspace/krypton_env_64/q/l64/q
qbinpath = /home/giovanni/q/l64/q
No such file or directory

Although, as you can see, the q binary is there:

(krypton_env_64) giovanni@mymachine ~$ ls -R /home/giovanni/workspace/krypton_env_64/q/
/home/giovanni/workspace/krypton_env_64/q/:
k4.lic  l64  p.k  pyq-config.q  pyq-operators.q  python.q  q.k

/home/giovanni/workspace/krypton_env_64/q/l64:
p.so  q

Could you please advise on how to handle this issue? I’m using Python 3.6.1 |Continuum Analytics, Inc.| (default, May 11 2017, 13:09:58) [GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux

sashkab commented 6 years ago

Which version of pyq do you have?

pip list | grep pyq

What do you see when you run following command?

QHOME=$VIRTUAL_ENV/q $VIRTUAL_ENV/q/l64/q

Thanks.

abalkin commented 6 years ago

Please see my comment on issue #32. You can also look at the build logs for the installation of PyQ with Miniconda2.

gtataranni commented 6 years ago

I'm using pyq (4.1.2). By running QHOME=$VIRTUAL_ENV/q $VIRTUAL_ENV/q/l64/q I received a Permission denied error, which made me realise that the q binary had no execute permission. After setting it, I was able to run pyq. Yet, I am not able to import pyq in python:

(krypton_env_64) giovanni@mymachine ~$ python
Python 3.6.1 |Continuum Analytics, Inc.| (default, May 11 2017, 13:09:58)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyq
Traceback (most recent call last):
  File "/home/giovanni/workspace/krypton_env_64/lib/python3.6/site-packages/pyq/__init__.py", line 22, in <module>
    from ._k import K as _K, error as kerr, Q_VERSION, Q_DATE, Q_OS
ImportError: /home/giovanni/workspace/krypton_env_64/lib/python3.6/site-packages/pyq/_k.cpython-36m-x86_64-linux-gnu.so: undefined symbol: k

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/giovanni/workspace/krypton_env_64/lib/python3.6/site-packages/pyq/__init__.py", line 31, in <module>
    raise ImportError(message)
ImportError: Importing pyq from stock python is not supported. Use pyq executable.
>>>

Is this an intended behaviour? If not, could you suggest a solution?

sashkab commented 6 years ago

@gtataranni Unfortunately you excluding commands you running. This makes troubleshooting hard. How did you start Python? Did you use python or pyq command?

gtataranni commented 6 years ago

I used python (updated previous comment).

sashkab commented 6 years ago

Than the error message you received is expected. You should use pyq instead of python to start Python interpreter for use with PyQ.

gtataranni commented 6 years ago

Ok. Is this expected for the interpreter only or also when running a script (no interactivity)?

sashkab commented 6 years ago

You always need to use pyq when you import pyq in your script.

abalkin commented 6 years ago

Starting with release, 4.1.4 use

conda install -c kx -c enlnt pyq

to install both kdb+ and PyQ.

RemKamal commented 4 years ago

Hello all,

if I start python interpreter using pyq, I do not see python prompt shown here [1], when the first code example starts with import (from pyq import q). What am I missing? Here is what I do:

bash-4.2$ echo ${QHOME} /home/nynfs01/remkamal/q/ bash-4.2$ pyq '2019.11.12T17:30:53.816 cores bash-4.2$

[1] https://code.kx.com/v2/interfaces/pyq/user-guide/

RemKamal commented 4 years ago

please let me know if I should post it to a different thread, but the point is the same, running jupyter I get the same "nothing happens" action:

bash-4.2$ pyq -m notebook '2019.11.12T18:53:33.332 cores

sashkab commented 4 years ago

Following message suggests that you have more cores on system than in your license.

bash-4.2$ pyq
'2019.11.12T17:30:53.816 cores

Generally, you should always open new issue for a new problem. But in this case -- it's not PyQ's issue.

RemKamal commented 4 years ago

Following message suggests that you have more cores on system than in your license.

bash-4.2$ pyq
'2019.11.12T17:30:53.816 cores

Generally, you should always open new issue for a new problem. But in this case -- it's not PyQ's issue.

thanks, sashkab, I have indeed only 1 core for 64-bit version. But I still should be able to run PyQ, right? How to force it work and not just get the date timestamp with a message about cores?

sashkab commented 4 years ago

Try following:

CPUS=0 pyq
RemKamal commented 4 years ago

thanks a lot, sashkab!