Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

numpy array returns as foreign #111

Open
estradajke opened this issue Jan 24, 2022 · 5 comments
Open

numpy array returns as foreign #111

estradajke opened this issue Jan 24, 2022 · 5 comments

Comments

@estradajke
Copy link

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 user@google.com 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

@estradajke
Copy link
Author

Just noticed the formatting was unclear.

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

@cmccarthy1
Copy link
Contributor

Hi,

It looks to be an issue with either the use of Python 3.10 or an update to numpy.

Can you provide the version of numpy that you're using please and we'll aim to take a look.

Conor

@estradajke
Copy link
Author

Thanks for the quick reply Conor. It's 1.22.1. I'm happy to move to another recent version if that helps.

q)np:.p.import[numpy];np[:version]`
"1.22.1"

@cmccarthy1
Copy link
Contributor

I've confirmed it's the numpy version that is the issue, it looks like the underlying representation at the C level has changed somewhat which we'll need to investigate. If you downgrade numpy to <1.22 the behaviour should resolve itself, at the present time there isn't an explicit workaround

@estradajke
Copy link
Author

Rolled back to 1.21.

q)arange[12]`
0 1 2 3 4 5 6 7 8 9 10 11

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants