KxSystems / pyq

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

No module named 'pyq' in macOs Catalina 10.15.4 #131

Closed xiangpeng2008 closed 4 years ago

xiangpeng2008 commented 4 years ago

Questions

Steps to reproduce the issue

/Users/xiangpeng/venv37/q q)p)1

Expected result

1

Actual result

Traceback (most recent call last): File "", line 1, in ModuleNotFoundError: No module named 'pyq' 'python

Screenshot 2020-05-12 at 8 48 24 PM Screenshot 2020-05-12 at 8 50 33 PM

Workaround

In the same time, "pyq" works perfectly.

Screenshot 2020-05-12 at 9 05 35 PM

If you know workaround, please provide it here. With help of @sashkab in https://github.com/KxSystems/pyq/issues/132#issuecomment-628620923, there's an issue lying python3.7, the workaround to downgrade python3.6 works perfectly.

brew install sashkab/python/python@3.6
/usr/local/opt/python@3.6/bin/python3.6 -mpip install -U virtualenv==16.7.9
/usr/local/opt/python@3.6/bin/python3.6 -mvirtualenv pyq
source pyq/bin/activate
python3.6 -mpip install -U pip setuptools wheel
unzip Downloads/m64.zip -d $VIRTUAL_ENV/q
cp q64/kc.lic $VIRTUAL_ENV/q/
python3.6 -mpip install pyq
QHOME=$VIRTUAL_ENV/q $VIRTUAL_ENV/q/m64/q
xiangpeng2008 commented 4 years ago

It would be great if someone knows how to use pyq to run a script containing both python and q code, separated by q(). This solves my problem as well.

sashkab commented 4 years ago

Unable to reproduce. Works as expected for me.

$ QHOME=$VIRTUAL_ENV/q $VIRTUAL_ENV/q/m64/q
q)p)print(1)
1

How did you get Python 3.7.6 onto you macOS? It is not standard on macOS 10.13.

Also, please provide output of the ls -la $VIRTUAL_ENV/q and python3 -mpip list | grep pyq.

xiangpeng2008 commented 4 years ago

@sashkab thanks a lot for your quick reply ! I don't remember exactly how I installed it, probably by brew, which python version do you use ? I just updated the outputs of the 2 commands, here's the screenshot.

Screenshot 2020-05-12 at 9 32 23 PM
sashkab commented 4 years ago

Try running same command I did:

QHOME=$VIRTUAL_ENV/q $VIRTUAL_ENV/q/m64/q

And let me know if that works. Otherwise, I'd suggest to:

  1. Run brew upgrade.

  2. Re-create new virtual env:

    cd ~
    python3.7 -mvenv pyq
    source pyq/bin/activate
    mkdir $VIRTUAL_ENV/q
    unzip path/to/kdb.zip -d $VIRTUAL_ENV/q
    python3.7 -mpip install pyq
  3. Re-run your commands:

    pyq --versions
    QHOME=$VIRTUAL_ENV/q $VIRTUAL_ENV/q/m64/q
xiangpeng2008 commented 4 years ago

Hi @sashkab , QHOME=$VIRTUAL_ENV/q $VIRTUAL_ENV/q/m64/q doesn't work. But the brew upgrade and re-create virtual env solves the problem perfectly ! Thanks a lot !