forked from adsabs/reference_service
-
Notifications
You must be signed in to change notification settings - Fork 0
/
upgrade_pystruct
executable file
·21 lines (20 loc) · 1.19 KB
/
upgrade_pystruct
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/bin/env bash
pip install --install-option=--no-cython-compile cython
mkdir pystruct
cd pystruct
git clone https://github.com/pystruct/pystruct
pip download pystruct==0.3.2
tar xzvf pystruct-0.3.2.tar.gz
mv pystruct-0.3.2/src/utils.c pystruct-0.3.2/src/utils.save
cp pystruct/src/utils.pyx pystruct-0.3.2/src/
cython -3 pystruct-0.3.2/src/utils.pyx
sed -i 's/tstate->exc_type/tstate->exc_state.exc_type/' pystruct-0.3.2/src/utils.c
sed -i 's/tstate->exc_value/tstate->exc_state.exc_value/' pystruct-0.3.2/src/utils.c
sed -i 's/tstate->exc_traceback/tstate->exc_state.exc_traceback/' pystruct-0.3.2/src/utils.c
sed -i 's/from sklearn.externals.joblib import Parallel, delayed/from joblib import Parallel, delayed/g' pystruct-0.3.2/pystruct/utils/*.py
sed -i 's/from sklearn.externals.joblib import Parallel, delayed/from joblib import Parallel, delayed/g' pystruct-0.3.2/pystruct/learners/*.py
sed -i 's/from sklearn.externals.joblib import Parallel, delayed, cpu_count/from joblib import Parallel, delayed, cpu_count/g' pystruct-0.3.2/pystruct/learners/*.py
cd pystruct-0.3.2 && python3 ./setup.py install
cd .. && cp -rf pystruct-0.3.2 $LD_LIBRARY_PATH/python3.8/site-packages/pystruct
cd ..
rm -rf pystruct