pyq: q can't find python package in virtual env
Questions
-
Which operating system are you using (if Linux, please provide flavour of it, i.e RedHat, CentOS or Ubuntu), is it 32-bit, or 64-bit?
macOS Catalina 10.15.4 -
Which version of PyQ are you running? Please provide output of
pyq --versions, if PyQ isn’t operational, please provide Python interpreter version and PyQ versionpython -V; python3 -V; pip list | grep pyq:4.2.1 -
Which version of kdb+ are you using, is it 32-bit or 64-bit?
3.6 64-bit- If on 64-bit, is your
QLICset? Please provide outputenv | grep QLICon linux/macOS, orset|grep QLICon Windows.
- If on 64-bit, is your
```No, but my license file is under `$VIRTUAL_EVN/q````
-
Did you use virtual environment to install PyQ? If not, why?
- yes
-
Where is your
QHOME? Please provide outputenv | grep QHOMEon linux/macOS, orset|grep QHOMEon Windows.QHOME=/Users/xiangpeng/venv37/q -
Do you use Conda? If so, what version?
No
Steps to reproduce the issue
source venv37/bin/activate
export QHOME=$VIRTUAL_ENV/q
$VIRTUAL_ENV/q/m64/q
q)p)import numpy as np
Expected result
Actual result
KDB+ 3.6 2018.06.14 Copyright (C) 1993-2018 Kx Systems
m64/ 4(16)core 24576MB xiangpeng imac 192.168.1.11 EXPIRE 2021.02.22 zhangxiangpeng2008@gmail.com KOD #4169312
q)p)import numpy as np
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/local/Cellar/python/3.7.7/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pyq/__init__.py", line 841, in __import__
m = _imp(name, globals, locals, fromlist, level)
ModuleNotFoundError: No module named 'numpy'
'python
q)\\
Workaround
I just updated my python3.7 and re-created virtual env following: https://github.com/KxSystems/pyq/issues/131#issuecomment-627361984
It looks like python tries to look for package from system instead of inside virtual env.
Meanwhile, pyq has no problem to import package from virtual env.

If you know workaround, please provide it here.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 20 (10 by maintainers)
This has been resolved in PyQ 5.0. Please update to it using
pip install -U pyq.I’m going to keep this issue open until it is resolved for Python 3.7+.
No. Only workaround I can provide to you is to use python 3.6 and older version of the virutalenv to create venv.
I was able to reproduce this, and opened internal issue 1068. No ETA on this.