kxsystems / embedpy Goto Github PK
View Code? Open in Web Editor NEWAllows the kdb+ interpreter to call Python functions
Home Page: https://code.kx.com/q/interfaces
License: Apache License 2.0
Allows the kdb+ interpreter to call Python functions
Home Page: https://code.kx.com/q/interfaces
License: Apache License 2.0
1.3.3
(now revoked) added a bug raised in issue #86py.c
and p.q
is as followspy.c
EXP K3(init){ZI i=0,tr=1;I f,g;S l,h;K n,v;P a,b,pyhome;P(i,0)l=zs(x),h=zs(y);f=pyl(l);free(l);
P(!f,krr("libpython"))((tr==z->i)?Py_SetPythonHome:Py_SetProgramName)(Py_DecodeLocale(h,0))
p.q
c:"-c \"",pr[$[.z.o like"w*";sc["/python";`BINDIR`VERSION],"+'.dll'";sc["/";`LIBDIR`INSTSONAME]]],pr[$[.z.o like"m*";sc["/";`PYTHONFRAMEWORKPREFIX`INSTSONAME];.z.o like"l*";sc["/libpython";`LIBDIR`LDVERSION],"+'.so'";"''"]],pr["__import__('sys').prefix"],pr["__import__('sys').base_prefix"],"\"2>",$[.z.o like"w*";"nul <nul";"/dev/null"];
`L`M`H`B set'@[system"python3 ",;c;{system"python ",c}];if[count M;if[k~key k:`$":",M;L::M]];C:H~B;
.p:(`:./p 2:(`init;3))[L;H;C]]
Appears to be an issue with with the collection of PyDecodeLocale(h,0)
when associated with Py_SetPythonHome
/Py_SetProgramName
under certain circumstances the origin of which is still unknown.
Prior testing indicated full operational behaviour in pyenv/venv/conda however given a number of users have raised an issue internally and on github (namely #85) this indicate that all cases aren't covered. Hence revoke of release 1.3.3 and upload of release 1.3.4 which reverts behaviour and updates CI tests for newer versions of python libraries and pip.
Will attempt to replicate locally and fix as appropriate
Having issues iterating over a python generator.
Python function is mapped to a q, function returns a python generator "", and this object is inaccessible in native q;
q)qfunc[`:returnPyGenerator;<];
q)qvar:qfunc[pargs];
q)qvar
foreign
qvar` errors with rank
no success in wrapping with .p.wrap
no success trying with .p.closure
I see documentation on creating a generator in q, and then passing it to python, and iterating in the python space, but is there anyway to do the same natively
Thanks
This issue is a companion to KxSystems/pyq#30, an issue to start distributing embedPy to PyQ users.
While we are striving to make simple pip install pyq
to work for most users who have both python and kdb+ installed on both systems, we recommend that users dedicate a virtual environment to pyq and install a copy of kdb+ in $VIRTUAL_ENV/q
.
[TODO] (See KxSystems/pyq#30)
-Werror
on gcc
and clang
as well as VS 2007 and VS 2017 on Windows.cc: @ilanschnell
I'm working on the embedPy recipe right now, and it was my desire to have conda build run the tests. I've run into the following problem. I have an environment with the current build of kdb and embedpy. When running the curve_fit
test I'm getting a library loading error; see below. I'm continuing to investigate, but if the embedPy authors have seen this before, let me know.
From the command line:
conda create -n kx -c kx kdb embedpy scipy
conda activate kx
q
From the q prompt:
\l p.q
cf:.p.import[`scipy.optimize;`:curve_fit;<]
The error:
'import: dlopen(/Users/mgrant/miniconda3/envs/kx/lib/python3.6/site-packages/scipy/optimize/minpack2.cpython-36m-darwin.so, 2): Symbol not found: _main
Referenced from: /Users/mgrant/miniconda3/envs/kx/lib/python3.6/site-packages/scipy/optimize/minpack2.cpython-36m-darwin.so
Expected in: flat namespace
in /Users/mgrant/miniconda3/envs/kx/lib/python3.6/site-packages/scipy/optimize/minpack2.cpython-36m-darwin.so
[1] /Users/mgrant/miniconda3/envs/kx/q/p.q:36: .p.wfunc:{[f;x]r:wrap f x 0;$[count x:1_x;.[;x];]r}
What is the correct way to convert a large generic kdb table to a pandas dataframe? Could you share something similar to pyq's conversion function,
def to_pandas(tbl):
"""
Converts a kdb+ table to Pandas DataFrame
"""
df = pd.DataFrame()
for c in tbl.cols:
if (str(q('meta', tbl)[c]['t']) == 's') and getattr(tbl, c).inspect(b't') >= 20:
d = list(q('sym',numpy.asarray(tbl[c].data)))
elif str(q('meta', tbl)[c]['t']) == 'C':
d = [str(x) for x in tbl[c]]
else:
d = numpy.asarray(tbl[c])
df[c] = d
return df
For example the function .ml.df2tab offered by Kx/ml is very slow:
i.pandasDF:.p.import[`pandas]`:DataFrame
// @kind function
// @category utilities
// @desc Convert q table to Pandas dataframe
// @param tab {table} A q table
// @return {<} a Pandas dataframe
.ml.tab2df:{[tab]
updTab:@[flip 0!tab;i.findCols[tab;"c"];enlist each];
transformTab:@[updTab;i.findCols[tab]"pmdznuvt";i.q2npDate];
pandasDF:i.pandasDF[transformTab][@;cols tab];
$[count keyTab:keys tab;
pandasDF[`:set_index]keyTab;
pandasDF
]
}
N:10000000
dat:([]date:2001.01.01; sym:`A; qty:N?100f)
\t .ml.tab2df dat
55440
If the evaluation errors when running over IPC, the error message is always the same
q)server ".p.eval \"[1,2,3][10]\""
'p.c:68 runs pyerr
[0] server ".p.eval \"[1,2,3][10]\""
^
q)server ".p.eval \"1 + myUndefinedVar\""
'p.c:68 runs pyerr
[0] server ".p.eval \"1 + myUndefinedVar\""
^
q)server ".p.eval \"[1,2,3)\""
'p.c:68 runs pyerr
[0] server ".p.eval \"[1,2,3)\""
These messages are printed in the server process, but aren't accessible from the client process
IndexError: list index out of range
NameError: name 'myUndefinedVar' is not defined
SyntaxError: unexpected EOF while parsing
I'm getting messages like this when running the test script on Windows:
(kxtest) C:\Users\mcg\Desktop\embedPy\tt>q test.q
KDB+ 3.6 2018.05.16 Copyright (C) 1993-2018 Kx Systems
w64/ 1()core 6143MB mcg desktop-cb8h04d 172.16.247.170 EXPIRE 2019.05.15 [email protected] KOD #5000002
(kxtest) C:\Users\mcg\Desktop\embedPy\tt>ERROR:
test:
import resource
message:
e: No module named 'resource'
[13] C:\Users\mcg\Miniconda3\envs\kxtest\q\p.q:11: .p.e:{$["def"~3#x;$[x[3]in"<*>";ei 3;eo];"class"~5#x;$[x[5]in"*>";ei 5;eo];eo]x}
^
file:
tests/memory.t
ERROR:
test:
initmem:pmem[];
message:
eval: name 'resource' is not defined
[10] .t.pmem:{$[.z.o~`m64;0;$[R;.p.qeval"resource.getrusage(resource.RUSAGE_SELF).ru_maxrss";0]]}
Clearly this is because resource
is unix-specific. Its use will need to be bypassed on Windows.
q)\l p.q
'libpython
[3] M:\q\p.q:9:
L
MH
B set'@[system"python3 ",;c;{system"python ",c}];if[count M;if[k~key k:$":",M;L::M]];C:H~B; .p:(
:./p 2:(`init;3))[L;H;C]]
^
When I do at this point : key each hsym each$
L`M#.p I will get:
L| `:C:\Users\serge\AppData\Local\Programs\Python\Python38-32/python38.dll
M| q
Qh
jo
P`p
PS: Hint: I only used the downloaded code in that link under "embedPy" --> no conda installation
q)\l p.q
ImportError: numpy.core.multiarray failed to import
k){0N!x y}
'p.c:90 init numpy
Numpy is installed and working:
python -c 'import numpy as np;print(np.__version__)'
1.13.3
Looking at the generated makefile, I see that PH is set to the parent python location, while numpy is installed in a virtual environment.
Manually setting PH to a string returned by
python -c "import sys; print('%s:%s' % (sys.prefix,sys.exec_prefix))"
fixed the problem. I'll submit a PR with a patch for configure.q.
Hi - this repo appears to be missing the q.so file formally in a folder l64.
The installation instructions still appear to reference the file.
Also the instructions reference running q test.q before installing embedPy.
Regards,
Simon
Trying to follow the step in the installation guide for Windows. Extracted the embedPy zip and ran
pip install -r tests/requirements.txt
then got an error when running q test.q
C:\Users\xxxx\Downloads\embedPy_windows-1.3.6>q test.q
KDB+ 3.6 2019.09.19 Copyright (C) 1993-2019 Kx Systems
w64/ 8(16)core 16275MB xxxx xxxx 192.168.0.14 EXPIRE 2021.03.16 [email protected] KOD #4169673
'The specified module could not be found.
[4] C:\Users\xxxx\Downloads\embedPy_windows-1.3.6\p.q:12:
`L`M`H set'@[system"python3 ",;c;{system"python ",c}];if[count M;if[k~key k:`$":",M;L::M]];
.p:(`:./p 2:(`init;2))[L;H]]
^
[0] (<load>)
)
)key each hsym each`$`L`M#.p
'each
[5] key each hsym each`$`L`M#.p
^
)
) )'2020.07.26T09:57:04.146 .Q.dbg
Hi, I followed the instructions and tried to run test.q
on Windows 10 but ran into issue, here is the output I get
KDB+ 4.0 2020.05.04 Copyright (C) 1993-2020 Kx Systems
w64/ 12(16)core 16111MB George desktop-ri3u9lo 10.0.0.197 EXPIRE 2021.10.14 [email protected] KOD #4173422
'[
[5] C:\q\p.q:13:
if[count M;if[k~key k:`$":",M;L::M]];
.p:(`:./p 2:(`init;2))[L;H]
^
q.p))
Not sure what is wrong here... Thank you.
UPDATE: it's actually something with \l p.q
, the error is as below
The specified module could not be found.
[4] .p:(`:./p 2:(`init;2))[L;H]
NVM, it somehow worked now...
There appears to be no conversion from a q guid to Python when using .p.set. It would be useful if guids were received as strings so that Python libraries could still be used with tables containing guids, and without first cleansing q tables from having guids.
.p.set[`foo; 0ng]
'set: bad argument type for built-in operation
[1] /Users/tim/q/p.q:44: {[f;x;y]f[x]unwrap y;}
in PR "Use ja to null-terminate code strings. #11"
- ..x=K(",[;10h$0]",r1(x));..
+..C z=0;r1(y);x=ja(&y,&z);x==y?--xn:r0(y);..
reviewing api docs at http://code.kx.com/q/interfaces/capiref/#joins, x==y
is always true after x=ja(&y,&z)
a solution
+Z K2(runs){P(xt!=-KJ||y->t!=KC,E(type))r1(y);ja(&y,""),--y->n;PyErr_Clear();O o=PyRun_String(xG,xj?Py_eval_input:Py_file_input,d,d);r0(y);R ko(o)?:PE;}
I have followed the instructions on README but can't manage to install embedPy
. I keep getting the following error:
'dlsym(0x7fad1a602570, init): symbol not found
[4] /Users/path/to/my/project/embedPy/p.q:6:
`L`M`H set'@[system"python3 ",;c;{system"python ",c}];if[count M;if[k~key k:`$":",M;L::M]];
.p:(`:./p 2:(`init;2))[L;H]]
^
[0] (<load>)
I have tried both with in my Miniconda environment and a using virtualenv (based on the sashkab/python/python36
brew package). I have also tried setting DYLD_LIBRARY_PATH
as mentioned in the README and not setting it at all. I keep getting the same error every time (and since I am no Q expert, I don't really understand what's going on).
I am using the on-demand version of Q (64-bit).
I found that it isn't possible to plot the date axis using embedPy, because it is not sending the datetime as python datetime object when embedPy convert the Q object to python object. You can run this under JupyterQ:
\l p.q
\d .matplotlib
isroutine:.p.import[`inspect;`:isroutine];
getmembers:.p.import[`inspect;`:getmembers];
wrapm:{[x]
names:getmembers[x;isroutine]`;
res:``_pyobj!((::);x);
res,:(`$names[;0])!{.p.wrap x 1}each names;
res}
pyplot:{wrapm .p.import`matplotlib.pyplot}
plt:.matplotlib.pyplot[];
x:.z.T+til 10;
y:til 10;
plt.plot[x;y];
plt.show[];
The x axis is expected to be a time, but it is render as a number
Using with system Python works fine:
$ echo 'p)print(2+2)' | q
4
However, if I try to do the same in an empty virtual environment I get an error:
python3.6 -m venv env
source env/bin/activate
(env) $ echo 'p)print(2+2)' | q
Fatal Python error: Py_Initialize: Unable to get the locale encoding
ModuleNotFoundError: No module named 'encodings'
Current thread 0x00007f887ee51000 (most recent call first):
Aborted
A similar issue was reported here: https://bugs.python.org/issue22213
The conclusion was this workaround which uses Py_SetPythonHome for virtualenv and Py_SetProgramName for venv:
Input file test.p
:
s = '''
multiline triple-quoted string
'''
Output from running q test.p
:
'e: EOF while scanning triple-quoted string literal (, line 2)
[2] /IVY/instances/1268/delta-bin/software/KDBPlus_3_6_0/p.q:13: .p.e:{$["def"~3#x;$[x[3]in"<*>";ei 3;eo];"class"
~5#x;$[x[5]in"*>";ei 5;eo];eo]x}
^
This works in python
>>> eval("len(\"\277\")")
1
but from q I get this
q).p.eval("len(\"\277\")")
File "<string>", line 1
SyntaxError: (unicode error) 'utf-8' codec can't decode byte 0xbf in position 0: invalid start byte
'p.c:71 runs pyerr
[1] /home/tepu/embedPy-master/p.q:21: .p.wfunc:{[f;x]r:wrap f x 0;$[count x:1_x;.[;x];]r}
$ ./configure
KDB+ 3.5 2017.06.19 Copyright (C) 1993-2017 Kx Systems
m32/ 20()core 65536MB a a-imacpro.ny0.nln 10.166.1.30 NONEXPIRE
Traceback (most recent call last):
File "<string>", line 1, in <module>
TypeError: sequence item 0: expected str instance, int found
'os
[3] /Users/a/Work/KxSystems/embedPy/configure.q:4: py:{system string[$[count w;pp first w;e`python]]," -c \"",x,"\""}
^
q))
I am using Python 3.6:
$ python -V
Python 3.6.4
Here is so more information. The failing python command is
q))-1 string[$[count w;pp first w;e`python]]," -c \"",x,"\""
python3 -c "import sysconfig as c,os,sys;v=c.get_config_var;first=lambda x:len(x) and x[0];d=v('LDLIBRARY');P,p=sys.exec_prefix,sys.prefix;w=lambda x:first([a[0] for a in os.walk(x) if d in a[2]]);L=w(P+'/lib')or w(v('LIBDIR'));I=c.get_path('include');print('\n'.join([L,d,P,p,I]))"
Running it with inspect mode in python gives
$ python3 -i -c "import sysconfig as c,os,sys;v=c.get_config_var;first=lambda x:len(x) and x[0];d=v('LDLIBRARY');P,p=sys.exec_prefix,sys.prefix;w=lambda x:first([a[0] for a in os.walk(x) if d in a[2]]);L=w(P+'/lib')or w(v('LIBDIR'));I=c.get_path('include');print('\n'.join([L,d,P,p,I]))"
Traceback (most recent call last):
File "<string>", line 1, in <module>
TypeError: sequence item 0: expected str instance, int found
>>> import pdb; pdb.pm()
[0] > <string>(1)<module>()
(Pdb++) L
0
So the culprit is the "walk" function:
(Pdb++) P
'/Users/a/.virtualenvs/3/bin/..'
(Pdb++) v('LIBDIR')
'/usr/local/opt/python36/Frameworks/Python.framework/Versions/3.6/lib'
(Pdb++) w(P+'/lib')
0
(Pdb++) w(v('LIBDIR'))
0
Python dynamic library can be found in the following directory on my system:
$ ls /usr/local/opt/python36/Frameworks/Python.framework/Versions/3.6/lib/python3.6/config-3.6m-darwin/libpython*
/usr/local/opt/python36/Frameworks/Python.framework/Versions/3.6/lib/python3.6/config-3.6m-darwin/libpython3.6.a
/usr/local/opt/python36/Frameworks/Python.framework/Versions/3.6/lib/python3.6/config-3.6m-darwin/libpython3.6.dylib
/usr/local/opt/python36/Frameworks/Python.framework/Versions/3.6/lib/python3.6/config-3.6m-darwin/libpython3.6m.a
/usr/local/opt/python36/Frameworks/Python.framework/Versions/3.6/lib/python3.6/config-3.6m-darwin/libpython3.6m.dylib
This directory is correctly reported by python-config
:
$ python-config --ldflags
-L/usr/local/opt/python36/Frameworks/Python.framework/Versions/3.6/lib/python3.6/config-3.6m-darwin -lpython3.6m -ldl -framework CoreFoundation
Error being thrown:
'embedPy requires python 3.6 or higher on windows
Issue is test case:
q)`3.6>`3.10
1b
If you run an expression in Python, it prints the result
>>> 1+2
3
but in embedpy, the result of an expression won't be printed unless you use print
q)p)1+2
q)p)print(1+2)
3
To have embedPy work with conda python on Linux, we have to set LD_LIBRARY_PATH
.
This looks like a temporary work around and may cause several issue when we using other softwares.
Why this setting is needed? Which part of embedPy request it?
I'm asking this question because I want to help solve it. embedPy may not be good enough to be used in production with this issue.
I'm installing embedPy from a windows release.
According to the instructions, I need to run the tests in the unzipped directory. However I cannot pass the test with the following error log.
...\embedPy-1.4.1> q test.q
KDB+ 4.0 2021.07.12 Copyright (C) 1993-2021 Kx Systems
w64/ 16(16)core 32620MB ...
'The specified module could not be found.
[5] C:\Users\ma-pi\Downloads\embedPy-1.4.1\embedPy-1.4.1\p.q:12:
L
MH
PB set'@[system"python3 ",;c;{system"python ",c}];if[count M;if[k~key k:
$":",M;L::M]];.P.env:not H~P;
.p:(:./p 2:(
init;3))[L;H;B]]
^
q.p))
My python version 3.8.8, KDB version 4.0, OS Win10.
It seems I missed some packages. Could anyone tell me what package or module I missed?
Thank you.
Fatal Python error: initfsencoding: unable to load the file system codec
ModuleNotFoundError: No module named 'encodings'
Current thread 0x00003a70 (most recent call first):
I was playing with some advanced IPython widget usage that requires passing in lists whose first element is a Python object. Unfortunately, while bare Python objects are automatically unwrapped on the way back to Python, that's not true of Python objects in a list. I did discover that you can force them to be unwrapped, but it seems better if the embedPy functionality would do this recursively on lists and other composite objects.
p)class MyObject:
pass
p)def bar():
return MyObject()
p)def foo(x):
if isinstance(x, list):
print('[' + (', '.join(repr(y) for y in x)) + ']')
else:
print(repr(x))
foo:.p.get[`foo]
bar:.p.get[`bar]
foo(bar[])
foo((bar[];1))
foo((bar[]`.;1))
foo("a";1)
Output:
<__main__.MyObject object at 0x1196b2f98>
[<built-in method q) of PyCapsule object at 0x1155632d0>, 1]
[<__main__.MyObject object at 0x1196b2f98>, 1]
['a', 1]
What seems sensible is that the to have to use that back-tick notation, so that the second line behaves the way the third one does.
RHEL6 is still widely used in the banking world, would be nice if you had pre-built binaries for that version too.
q)p)x=2
will work as expected, but run
q).p.eval "x=2"
and you'll get the error
File "<string>", line 1
x=2
^
SyntaxError: invalid syntax
'p.c:68 runs pyerr
[0] .p.eval "x=2"
^
The same error is thrown when running an expression that defines a function
q).p.eval "def square(x): return x * x"
File "<string>", line 1
def square(x): return x * x
^
SyntaxError: invalid syntax
'p.c:68 runs pyerr
[0] .p.eval "def square(x): return x * x"
^
could you tell me work with pure python and pip environment
q)p)import sys;print(sys.argv)
'e: module 'sys' has no attribute 'argv'
[0] .../p.q:11: .p.e:{$["def"~3#x;$[x[3]in"<*>";ei 3;eo];"class"~5#x;$[x[5]in"*>";ei 5;eo];eo]x}
It would be nice to set sys.argv in p.q to a list derived from .z.X.
See https://docs.python.org/3.6/library/sys.html#sys.argv for details.
'The specified module could not be found.
[4] C:\q\p.q:9:
L
MH
B set'@[system"python",;c;{system"python ",c}];if[count M;if[k~key k:$":",M;L::M]];C:H~B; .p:(
:./p 2:(`init;3))[L;H;C]]
I seem to be running into an issue that was reported here in July 2018 and closed - but am still getting the same symptoms working with the latest embedPy (release 1.3.2).
Below is the relevant excerpt:
(base) D:\temp\embedPy>conda install --file tests/requirements.txt
Collecting package metadata: done
Solving environment: done
All requested packages already installed.
(base) D:\temp\embedPy>q test.q
KDB+ 3.6 2019.04.02 Copyright (C) 1993-2019 Kx Systems
w64/ 4(16)core 8109MB Tahsin Alam hunter 10.0.75.1 EXPIRE 2020.04.13 [email protected] KOD #4164452
WARN: can't import: resource, remainder of tests/memory.t skipped, error was:
import: No module named 'resource'
WARNING:tensorflow:From d:\bin\Anaconda3\lib\site-packages\tensorflow\python\framework\op_def_library.py:263: colocate_with (from tensorflow.python.framework.ops) is deprecated and will be removed in a future version.
Instructions for updating:
Colocations handled automatically by placer.
2019-04-28 17:38:26.237259: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX AVX2
2019-04-28 17:38:26.248395: I tensorflow/core/common_runtime/process_util.cc:71] Creating new thread pool with default inter op setting: 4. Tune using inter_op_parallelism_threads for best performance.
These modules required for tests couldn't be imported:
resource
try running
pip install -r tests/requirements.txt
or with conda
conda install --file tests/requirements.txt
failed:0, errored:0, skipped:16, total:273
(base) D:\temp\embedPy>q
KDB+ 3.6 2019.04.02 Copyright (C) 1993-2019 Kx Systems
w64/ 4(16)core 8109MB Tahsin Alam hunter 10.0.75.1 EXPIRE 2020.04.13 [email protected] KOD #4164452
q)\
(base) D:\temp\embedPy>python --version
Python 3.6.8 :: Anaconda custom (64-bit)
I am getting the below error
ERROR:
test:
1 3raze"j"$10*fit[x;y]raze"j"$10*fit[x;y]
message:
call: module 'tensorflow' has no attribute 'random_uniform'
[11] 1 3
^
file:
tests/tensorflow.t
failed:0, errored:4, skipped:16, total:273
With the release of Python 3.8 support for the mechanism by which embedPy collects the python shared object libpython.so/libpython.dll
appears to have been deprecated, as outlined here.
This limitation was first noticed with the attempted release of python 3.8 support for embedPy on anaconda #93 which resulted in a failure to adequately provide libpython.dll
on windows release.
in python 3.7 and numpy 1.15.2, q version 3.6 64bit
the numpy array cannot be converted to q data.
all the testcases return 0
t[12]~np[:arange][*][12.]
t[12]~np[:arange;*][12.]
t[12]~np[:arange][*;12.]
t[12]~np[:arange;*;12.]
t[12]~np[:arange][12.]
t[12]~np[:arange;12.]
t[12]~np[:arange][<]12. t[12]~np[
:arange;<]12.
t[12]~np[:arange][<;12.] t[12]~np[
:arange;<;12.]
t[12].p.py2q np[.p.py2q np[:arange][>]12. t[12]~.p.py2q np[
:arange;>]12.
t[12]:arange][>;12.] t[12]~.p.py2q np[
:arange;>;12.]
Currently embedPy does not operate within Python 3.9 anaconda build environments
q p.q
KDB+ 4.0 2020.05.04 Copyright (C) 1993-2020 Kx Systems
'libpython
[2] /usr/local/anaconda3/envs/qenv/q/p.q:12:
`L`M`H`P`B set'@[system"python3 ",;c;{system"python ",c}];if[count M;if[k~key k:`$":",M;L::M]];.P.env:not H~P;
.p:(`:./p 2:(`init;3))[L;H;B]]
^
q.p))\
As indicated here for Python 3.8 https://docs.python.org/3/whatsnew/3.8.html#debug-build-uses-the-same-abi-as-release-build the issue is likely due to libpython not being shipped with conda.
Hi,
I followed the installation steps here (using embedPy release 1.1 for linux) but when I load p.q
I get an error
{"'",x,"'.join([__import__('sysconfig').get_config_var(v)for v in",ssr[.j.j y;"\"";"'"],"])"}
'.j.j
I am using anaconda 4.5.0, have copied p.q and p.k into $QHOME/ and p.so into $QHOME/l64/ and set the environment variable LD_LIBRARY_PATH
(to /home/hoeflm/anaconda3/lib
)
The following q session log suggests that .p.eval"42"
leaks 16 bytes per invocation.
q)\l p.q
q)first system"w"
169952
q)\ts:100000 .p.eval"42"
1524 1600896
q)first system"w"
1769952
q)1769952-169952
1600000
Hello,
When installing on windows, I run into this issue when running the tests or launching p.q:
'libpython
[4] C:\Users\Mehdi Tomas\Downloads\embedPy_windows-1.3.1\p.q:8:
`L`M`H set'@[system"python3 ",;c;{system"python ",c}];if[count M;if[k~key k:`$":",M;L::M]];
.p:(`:./p 2:(`init;2))[L;H]]
^
[0] (<load>)
I get the same error if I try installing from a release or with Anaconda.
Sorry if I missed a step. I suspect this might have to do with my Python installation in Anaconda but I'm unsure. Thanks a lot for the help.
Specs:
Hi. I am unable to return a numpy array as anything but foreign. Am I missing some syntax to force the conversion? I've downloaded the latest embedPy files and running a recent version of kdb and python.
user@box ~ % q
KDB+ 4.0 2021.07.12 Copyright (C) 1993-2021 Kx Systems
m64/ 8(16)core 65536MB user box 127.0.0.1 EXPIRE 2022.10.04 [email protected] KOD #5005939
q)\l p.q
q)sys:.p.importsys;sys[
:version] "3.10.1 (v3.10.1:2cd268a3a9, Dec 6 2021, 14:28:59) [Clang 13.0.0 (clang-1300.. q).p.set[
x;3];.p.get[x]
3
q)np:.p.importnumpy;arange:np
:arange;arange[12]`
foreign
I am using a universal Python build from
$ brew install sashkab/python/python36 --universal
and configuration fails with the following diagnostic
$ q configure.q
KDB+ 3.4 2016.06.14 Copyright (C) 1993-2016 Kx Systems
m32/ 8()core 16384MB a a-mbp.local 172.20.10.2 NONEXPIRE
Traceback (most recent call last):
File "<string>", line 1, in <module>
TypeError: sequence item 0: expected str instance, int found
{system string[$[count w;pp first w;e`python]]," -c \"",x,"\""}
'os
@
.,["\\"]
"python3 -c \"import sysconfig as c,os,sys;v=c.get_config_var;first=lambda x:..
Hi team,
We recently tried to use embedPy in projects. However, we need to use in Python virtual environment. Tested with latest release 1.3.8, not working.
Looks like a recent commit in May 2021 added this support. Is there an official release then?
Thanks and regards,
Shawn
KDB+ 3.5 2017.08.22 Copyright (C) 1993-2017 Kx Systems
l64/ 16()core 122525MB ben labs1.firstderivatives.com 10.139.127.17 EXPIRE 2018.03.16 firstderivatives.com INTERNAL #49564
q)\l p.q
q)p)def string_length(x): return len(x)
q)stringLength: .p.callable .p.pyeval "string_length"
q)stringLength "Hello World"
11
q)stringLength "Hello\351World"
Sorry, this application or an associated library has encountered a fatal error and will exit.
If known, please email the steps to reproduce this error to [email protected]
with a copy of the kdb+ startup banner.
Thank you.
q() [0x473a11]
/usr/lib64/libpthread.so.0(+0xf100) [0x7f3fcee38100]
/usr/local/lib/libpython3.5m.so.1.0(+0x15c0a1) [0x7f3fc81460a1]
/usr/local/lib/libpython3.5m.so.1.0(PyEval_EvalCodeEx+0x48) [0x7f3fc81469d8]
/usr/local/lib/libpython3.5m.so.1.0(+0x9e723) [0x7f3fc8088723]
/usr/local/lib/libpython3.5m.so.1.0(PyObject_Call+0x6a) [0x7f3fc8057a2a]
/IVY/instances/1264/delta-bin/software/KDBPlus_3_5_0/l64/./p.so(+0x2bd0) [0x7f3fc850fbd0]
q() [0x472c59]
q() [0x43c2e6]
q() [0x43c2c5]
q() [0x43e55a]
q() [0x43c13e]
q() [0x43c2c5]
q() [0x43c715]
q() [0x41d350]
rlwrap: warning: q crashed, killed by SIGSEGV (core dumped).
rlwrap itself has not crashed, but for transparency,
it will now kill itself with the same signal
warnings can be silenced by the --no-warnings (-n) option
Segmentation fault (core dumped)
Hi, @sv @abalkin @sashkab @simongarland @jimdigriz
I met this error when run.
kerb:stitcher mun$
kerb:stitcher mun$ python3 alignImagesRansac.py ./images ./images/3.png ./images/
Traceback (most recent call last):
File "alignImagesRansac.py", line 360, in
AlignImagesRansac(sys.argv[1:])
TypeError: init() missing 2 required positional arguments: 'key_frame' and 'output_dir'
kerb:stitcher mun$
What's wrong with me?
from @bemoregt.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.