-
Notifications
You must be signed in to change notification settings - Fork 20
Description
Describe the bug
kx.q.til(10)I got AttributeError: 'EmbeddedQ' object has no attribute 'ctx' error when running this line from the tutorial.
To Reproduce
I'm on an ARM Mac with 2 q installations, 1 installed by manually downloading the binary from kx.com, 1 installed by from conda with conda install -c kx jupyterq. First one is located at /Users/tsca/q/m64/q, the 2nd is at /Users/tsca/mamba/envs/fin/bin/q, and the 2nd is before the 1st one in $PATH. Both binaries run and have the exact same banner message (please see the bottom).
I was following the tutorial by setting these env vars:
export QHOME=$HOME/q
export QLIC=$HOME/q
export PYKX_UNLICENSED='true'
# if on mac
export PYKX_Q_EXECUTABLE=$QHOME/m64/qAnd then I ran this simple test_pykx.py file:
#!/usr/bin/env python3
import pykx as kx
kx.q.til(10)And I got:
Traceback (most recent call last):
File "/Users/tsca/testdir/q/test_pykx.py", line 5, in <module>
kx.q.til(10)
└ <module 'pykx' from '/Users/tsca/mamba/envs/fin/lib/python3.11/site-packages/pykx/__init__.py'>
File "/Users/tsca/mamba/envs/fin/lib/python3.11/site-packages/pykx/__init__.py", line 140, in __getattr__
ctx = self.__getattribute__('ctx')
│ └ pykx.q
└ <module 'pykx.ctx' from '/Users/tsca/mamba/envs/fin/lib/python3.11/site-packages/pykx/ctx.py'>
AttributeError: 'EmbeddedQ' object has no attribute 'ctx'
I tried Googling the error message but wasn't able to find similar error reported by other users, except this one (https://learninghub.kx.com/forums/topic/pykxexception-valid-kdb-q-license/), which wasn't helpful.
debug_environment() output:
>>> import pykx as kx
>>> kx.util.debug_environment()
**** PyKX information ****
pykx.args: ()
pykx.qhome: /Users/tsca/q
pykx.qlic: /Users/tsca/q
pykx.licensed: False
pykx.__version__: 2.3.0
pykx.file: /Users/tsca/mamba/envs/fin/lib/python3.11/site-packages/pykx/util.py
**** Python information ****
sys.version: 3.11.0 | packaged by conda-forge | (main, Jan 14 2023, 12:26:40) [Clang 14.0.6 ]
pandas: 2.2.3
numpy: 1.26.4
pytz: 2025.1
which python: /Users/tsca/mamba/envs/fin/bin/python
which python3: /Users/tsca/mamba/envs/fin/bin/python3
**** Platform information ****
platform.platform: macOS-15.3.1-arm64-arm-64bit
**** PyKX Environment Variables ****
PYKX_IGNORE_QHOME:
PYKX_KEEP_LOCAL_TIMES:
PYKX_ALLOCATOR:
PYKX_GC:
PYKX_LOAD_PYARROW_UNSAFE:
PYKX_MAX_ERROR_LENGTH:
PYKX_NOQCE:
PYKX_Q_LIB_LOCATION:
PYKX_RELEASE_GIL:
PYKX_Q_LOCK:
PYKX_DEFAULT_CONVERSION:
PYKX_SKIP_UNDERQ:
PYKX_UNSET_GLOBALS:
PYKX_DEBUG_INSIGHTS_LIBRARIES:
PYKX_EXECUTABLE: /Users/tsca/mamba/envs/fin/bin/python3
PYKX_PYTHON_LIB_PATH:
PYKX_PYTHON_BASE_PATH:
PYKX_PYTHON_HOME_PATH:
PYKX_DIR: /Users/tsca/mamba/envs/fin/lib/python3.11/site-packages/pykx
PYKX_UNLICENSED: true
PYKX_LICENSED:
PYKX_BETA_FEATURES:
PYKX_NO_SIGNAL:
**** PyKX Deprecated Environment Variables ****
SKIP_UNDERQ:
UNSET_PYKX_GLOBALS:
KEEP_LOCAL_TIMES:
IGNORE_QHOME:
UNDER_PYTHON:
PYKX_NO_SIGINT:
**** q Environment Variables ****
QARGS:
QHOME: /Users/tsca/q
QLIC: /Users/tsca/q
QINIT:
**** License information ****
pykx.qlic directory: True
pykx.qhome writable: True
pykx.qhome lics: ['kc.lic']
pykx.qlic lics: ['kc.lic']
**** q information ****
which q: /Users/tsca/mamba/envs/fin/bin/q
q info:
(`m64;4.1;2025.02.18)
""
q is correctly set up and can run without issue.
Desktop (please complete the following information):
- OS: macOS 15.3.1 24D70 arm64
- KDB+ banner information
KDB+ 4.1 2025.02.18 Copyright (C) 1993-2025 Kx Systems m64/ 8(24)core 16384MB tsca tsca 127.0.0.1 EXPIRE 2026.03.15 KDB PLUS PERSONAL
>>> kx.__version__
'2.3.0'