Skip to content

Commit 6428797

Browse files
committed
updates to docker image
osx-arm64 packages revert broken embedpy under python commit compiler warnings remove tensorflow tests restrict to python 3.9 and 3.10 retry numpy import on osx due to warnings generated in more recent versions of numpy RuntimeError: Polyfit sanity test emitted a warning, most likely due to using a buggy Accelerate backend. If you compiled yourself, more information is available at: https://numpy.org/doc/stable/user/building.html#accelerated-blas-lapack-libraries Otherwise report this to the vendor that provided NumPy.
1 parent 06d3039 commit 6428797

File tree

11 files changed

+49
-111
lines changed

11 files changed

+49
-111
lines changed

.travis.yml

Lines changed: 14 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
stage: standalone
22
language: c
3+
dist:
4+
- focal
5+
osx_image: xcode12.5
36
os:
47
- linux
58
- osx
@@ -15,7 +18,7 @@ before_install:
1518
wget https://repo.continuum.io/miniconda/Miniconda3-latest-MacOSX-x86_64.sh -O miniconda.sh;
1619
fi
1720
- bash miniconda.sh -b -p $HOME/miniconda
18-
- export PATH="$HOME/miniconda/bin:$PATH"
21+
- source "$HOME/miniconda/etc/profile.d/conda.sh"
1922
- hash -r
2023
- conda config --set always_yes yes --set changeps1 no
2124
- conda update -q conda
@@ -25,40 +28,19 @@ before_script:
2528
- perl -p -i -e 's/EMBEDPYVERSION/`\$\"'${IMPLEMENTATION}'\"/g' p.q
2629

2730
script:
28-
- if [ $TRAVIS_OS_NAME = osx ]; then pyenv init - > pyenv.init && source pyenv.init ; fi
29-
- if [ $TRAVIS_OS_NAME = linux ]; then QLIBDIR=l64;OD=$L64; elif [ $TRAVIS_OS_NAME = osx ]; then QLIBDIR=m64;OD=$M64; else echo "unknown OS ('$TRAVIS_OS_NAME')" >&2; exit 1; fi; export QLIBDIR
30-
- mkdir q && export QHOME=$(pwd)/q && export PATH=$QHOME/$QLIBDIR:$PATH
31-
- if [[ "x$OD" != "x" ]]; then
32-
curl -u $NEXUS_USER:$NEXUS_PASS -o ${QHOME}/q.zip -L $OD;
33-
unzip -d q q/q.zip;
34-
else
35-
echo No kdb+;
36-
fi
37-
31+
- if [ $TRAVIS_OS_NAME = linux ]; then QLIBDIR=l64; elif [ $TRAVIS_OS_NAME = osx ]; then QLIBDIR=m64; else echo "unknown OS ('$TRAVIS_OS_NAME')" >&2; exit 1; fi; export QLIBDIR
32+
- conda create -n bld -c kx/label/dev kdb ;
33+
- conda activate bld
3834
- make p.so
39-
- cp [ml]64/p.so q/$QLIBDIR;
35+
- cp [ml]64/p.so $QHOME/$QLIBDIR;
4036
- tar czf embedPy_$TRAVIS_OS_NAME-$TRAVIS_BRANCH.tgz p.q p.k test.q tests [ml]64/p.so LICENSE README.md
4137
- if [[ "x$QLIC_KC" != "x" ]]; then
42-
echo -n $QLIC_KC |base64 --decode > q/kc.lic;
43-
pip install --upgrade pip;
44-
pip install --upgrade setuptools;
45-
pip -q install -r tests/requirements.txt;
46-
q test.q -s 4 -q;
47-
else
48-
echo No kdb+, no tests;
49-
fi
50-
51-
## virtualenv
52-
- pip install virtualenv;
53-
- virtualenv travisEnv;
54-
- source travisEnv/bin/activate
55-
- echo $(which python)
56-
- if [[ "x$QLIC_KC" != "x" ]]; then
57-
echo -n $QLIC_KC |base64 --decode > q/kc.lic;
38+
echo -n $QLIC_KC |base64 --decode > $QHOME/kc.lic;
39+
export QLIC_KC=;
5840
pip install --upgrade pip;
59-
pip install --upgrade setuptools;
6041
pip -q install -r tests/requirements.txt;
6142
q test.q -s 4 -q;
43+
echo DONE TEST;
6244
else
6345
echo No kdb+, no tests;
6446
fi
@@ -115,8 +97,9 @@ jobs:
11597
- if [ $TRAVIS_OS_NAME = linux ]; then QLIBDIR=l64; elif [ $TRAVIS_OS_NAME = osx ]; then QLIBDIR=m64; fi; export QLIBDIR
11698
- if [[ "x$QLIC_KC" != "x" ]]; then mkdir -p q; echo -n $QLIC_KC |base64 --decode > q/kc.lic; export QLIC=$($PREFIX)/q; fi
11799
- export EMBEDPY_VERSION=$TRAVIS_BRANCH
118-
- conda build conda-recipe --output -c kx > packagenames.txt
119-
- conda build -c kx conda-recipe --no-long-test-prefix
100+
- conda build conda-recipe --output -c kx/label/dev > packagenames.txt
101+
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then export CHANS="-c conda-forge"; fi
102+
- conda build -c kx/label/dev $CHANS conda-recipe --no-long-test-prefix
120103
deploy:
121104
provider: script
122105
script:

appveyor.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ image:
33
- Visual Studio 2017
44
artifacts:
55
- path: embedPy_windows-$(appveyor_repo_tag_name).zip
6+
init:
7+
- ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
8+
69
skip_non_tags: false
710
platform: x64
811
build_script:

conda-recipe/conda_build_config.yaml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1+
CONDA_BUILD_SYSROOT:
2+
- /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk # [osx]
3+
target_platform: # [osx]
4+
- osx-64 # [osx]
5+
- osx-arm64 # [osx]
16
python:
2-
- 3.5 [unix]
3-
- 3.6
4-
- 3.7
5-
- 3.8
67
- 3.9
8+
- 3.10

conda-recipe/run_test.sh

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
#!/bin/bash
2-
if [ -e ${QLIC}/kc.lic ]
2+
if [[ $SUBDIR == $build_platform ]]
33
then
4-
q conda-recipe/prep_requirements.q -q
5-
conda install -y -q --file tests/requirements_filtered.txt
6-
q test.q -s 4 -q;
4+
if [ -e ${QLIC}/kc.lic ]
5+
then
6+
q conda-recipe/prep_requirements.q -q
7+
conda install -y -q --file tests/requirements_filtered.txt
8+
q test.q -s 4 -q;
9+
else
10+
echo No kdb+, no tests;
11+
fi
712
else
8-
echo No kdb+, no tests;
13+
echo cross compile, no tests
914
fi
15+

docker/Dockerfile

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -56,34 +56,26 @@ RUN apt-get -yy --option=Dpkg::options::=--force-unsafe-io --no-install-recommen
5656

5757
RUN passwd -d root
5858
RUN useradd -s /bin/bash -U -m kx
59-
60-
ENV QHOME=/opt/kx/q
61-
ENV LD_LIBRARY_PATH=${LD_LIBRARY_PATH:+$LD_LIBRARY_PATH:}/opt/conda/lib
62-
63-
RUN mkdir -p /opt/kx
59+
ENV KX_IN_DOCKER=Y
6460

6561
COPY --from=anaconda /opt/conda /opt/conda
6662

6763
RUN . /opt/conda/etc/profile.d/conda.sh \
6864
&& conda update -n base conda \
69-
&& conda clean -y --all \
70-
&& conda install -y numpy==1.20.3 \
71-
&& conda install -c kx kdb
65+
&& conda clean -y --all
7266

73-
RUN mv /opt/conda/q /opt/kx
74-
COPY docker/q.wrapper /usr/local/bin/q
75-
COPY docker/kc.lic.py /opt/kx/
76-
77-
COPY --from=embedpy /opt/kx/embedPy /opt/kx/embedPy
78-
RUN ln -s -t $QHOME/l64 /opt/kx/embedPy/l64/p.so \
79-
&& ln -s -t $QHOME /opt/kx/embedPy/p.q /opt/kx/embedPy/p.k
8067

8168
COPY docker/profile.sh /etc/profile.d/kx.sh
69+
COPY --from=embedpy /opt/kx/embedPy /opt/kx/embedPy
8270

8371
USER kx
8472

8573
RUN . /opt/conda/etc/profile.d/conda.sh \
86-
&& conda create -y -n kx python=3.9 --no-default-packages
74+
&& conda create -y -n kx python --no-default-packages \
75+
&& conda activate kx \
76+
&& conda install -c kx kdb \
77+
&& ln -s -t $QHOME/l64 /opt/kx/embedPy/l64/p.so \
78+
&& ln -s -t $QHOME /opt/kx/embedPy/p.q /opt/kx/embedPy/p.k
8779

8880
USER root
8981

docker/init

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
set -eu
44

55
if ! test -x "$1"; then
6-
SH=$(which "$1")
6+
SH=$(which "$1") || SH=$1
77
shift
88
set -- $SH "$@"
99
fi
@@ -19,6 +19,5 @@ HOME=/home/kx
1919
cd $HOME
2020

2121
export QLIC=$HOME
22-
chpst -u kx /bin/sh -l -c 'exec python /opt/kx/kc.lic.py'
2322

2423
exec chpst -u kx "$@"

p.q

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ version:@[{EMBEDPYVERSION};0;`development];
44

55
o:first string .z.o;
66
$[o="w";if[3.6>.z.K;'`$"kdb+ version must be 3.6+"];if[3.5>.z.K;'`$"kdb+ version must be 3.5+"]];
7-
if[(o="w")&count getenv[`UNDER_PYTHON];'"embedPy running within a Python process not supported for Windows"];
87
if[not .P.loaded:-1h=type@[`.p@;`numpy;`];
98
sc:{"'",x,"'.join([__import__('sysconfig').get_config_var(v)for v in",ssr[.j.j y;"\"";"'"],"])"};pr:{"print(",x,");"};
109
c:"-c \"",pr["'.'.join([str(getattr(__import__('sys').version_info,x))for x in ['major','minor']])"],"\"2>",$[o="w";"nul <nul";"/dev/null"];
@@ -119,10 +118,3 @@ if[not loaded;if[not count .p.import[`sys][`:argv]`;.p.import[`sys][:;`:argv;enl
119118

120119
/ VirtualEnv warning for windows users
121120
if[.P.env&.z.o like"w*";-2"Warning:\n\tVirtual Environments not supported for embedPy on Windows.\n\tUsing the 'BASE' version of Python, not the virtual environment Python";]
122-
123-
/ Add warning for unsupported numpy 1.22
124-
{np:@[.p.import;`numpy;{(::)}];if[np~(::);:np];
125-
if[any 1 21<"J"$-1_vs["."]np[`:__version__]`;
126-
-2"Warning:\n\tDue to a bug in the numpy C api, conversions between q and numpy objects for 'numpy>=1.22'\n\tare unsupported at this time. Please downgrade your numpy version.";]
127-
}`
128-

py.c

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,17 +49,13 @@ Z K3(call){P a,k,p;I g;P(!pq(x)||!pq(z)&&z->t!=XD,ktrr())g=g1();a=pq(y)?p1(pg(y)
4949
Z K1(setconv){P(xt<100||xt>111,ktrr())r0(cf);cf=r1(x);R 0;}Z K1(getconv){R r1(cf);}Z K1(isp){R kb(pq(x));}
5050
Z K1(setpyerr){P(xt!=-KJ,ktrr())P(!errfmt,krr("traceback.format_exception"))pyerr=xj;R 0;}Z K1(getpyerr){R kj(pyerr);}
5151

52-
ZV*t;EXP K3(init){ZI i=0;I f,g;S l,h,hh;K n,v;P a,b,pyhome;P(i,0)l=zs(x),h=zs(y),hh=zs(z);f=pyl(l);free(l);
53-
P(!f,krr("libpython"))
54-
if(!Py_IsInitialized()){
55-
Py_SetPythonHome(Py_DecodeLocale(h,0));Py_SetProgramName(Py_DecodeLocale(hh,0));Py_InitializeEx(0);
56-
if(PyEval_ThreadsInitialized()&&!PyGILState_Check())t0(PyGILState_GetThisThreadState());PyEval_InitThreads();
57-
}
52+
ZV*t;EXP K3(init){ZI i=0;I f;S l,h,hh;K n,v;P a,b,c=0;P(i,0)l=zs(x),h=zs(y),hh=zs(z);f=pyl(l);free(l);P(!f,krr("libpython"))
53+
Py_SetPythonHome(Py_DecodeLocale(h,0));Py_SetProgramName(Py_DecodeLocale(hh,0));free(hh);free(h);Py_InitializeEx(0);if(PyEval_ThreadsInitialized()&&!PyGILState_Check())t0(PyGILState_GetThisThreadState());PyEval_InitThreads();
5854
M=PyModule_GetDict(PyImport_AddModule("__main__"));cf=k(0,"::",0);n=ktn(KS,0);v=ktn(0,0);
59-
if(a=PyImport_ImportModule("numpy.core.multiarray")){N=PyCapsule_GetPointer(b=PyObject_GetAttrString(a,"_ARRAY_API"),0);if(!N||!pyn(N))N=0;p0(b);p0(a);}PyErr_Clear();
55+
if((a=PyImport_ImportModule("numpy.core.multiarray"))||(PyErr_Print(),c=PyImport_ImportModule("numpy.core.multiarray"))){N=PyCapsule_GetPointer(b=PyObject_GetAttrString(a?a:c,"_ARRAY_API"),0);if(!N||!pyn(N))N=0;p0(b);p0(a);p0(c);}PyErr_Clear();
6056
if(a=PyImport_ImportModule("traceback")){errfmt=PyObject_GetAttrString(a,"format_exception");p0(a);}PyErr_Clear();
6157
#define F(f,i) js(&n,ss(#f));jk(&v,dl(f,i));
6258
F(setpyerr,1)F(getpyerr,1)F(eval,1)F(e,1)F(py2q,1)F(q2py,1)F(get,1)F(set,2)F(import,1)F(getattr,2)F(call,3)F(isp,1)F(setconv,1)F(getconv,1)js(&n,ss("numpy"));
63-
jk(&v,kb(!!N));i=1;R xD(n,v);}
59+
jk(&v,kb(!!N));t=t1();i=1;R xD(n,v);}
6460
// a kludge for python modules which try to resolve main e.g. scipy.optimize
6561
int main(){}

py.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ typedef struct _p _p,*P;struct _p{L r;P t;L n;union{P*p;P v[1];};};typedef struc
2626
X(V,Py_DecRef,(P))\
2727
X(V,Py_IncRef,(P))\
2828
X(V,PyErr_Clear,())\
29+
X(V,PyErr_Print,())\
2930
X(V,PyErr_Fetch,(P*,P*,P*))\
3031
X(V,PyErr_NormalizeException,(P*,P*,P*))\
3132
X(P,PyErr_BadArgument,())\
@@ -86,7 +87,6 @@ typedef struct _p _p,*P;struct _p{L r;P t;L n;union{P*p;P v[1];};};typedef struc
8687
X(P,PyDict_Values,(P))\
8788
X(P,PyObject_CallFunctionObjArgs,(P,...))\
8889
X(P,PyImport_Import,(P))\
89-
X(I,Py_IsInitialized,())\
9090

9191
//https://docs.scipy.org/doc/numpy/reference/c-api.html https://github.com/numpy/numpy/blob/master/numpy/core/code_generators/numpy_api.py
9292
#undef PyCFunction_New
@@ -111,7 +111,7 @@ ZI pyl(S l){
111111
HMODULE d=LoadLibrary(l);
112112
#define X(r,n,a) U(n=(T##n(*)a)GetProcAddress(d,#n))
113113
#else
114-
V*d=dlopen(getenv("UNDER_PYTHON")?NULL:l,RTLD_NOW|RTLD_GLOBAL);
114+
V*d=dlopen(l,RTLD_NOW|RTLD_GLOBAL);
115115
#define X(r,n,a) U(n=dlsym(d,#n))
116116
#endif
117117
P(!d,0)PF

tests/requirements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
numpy
22
beautifulsoup4
33
pandas
4-
tensorflow
54
scipy
65
matplotlib

tests/tensorflow.t

Lines changed: 0 additions & 34 deletions
This file was deleted.

0 commit comments

Comments
 (0)