sdc
sdc copied to clipboard
calc pi example fails
#calc_pi.py import hpat import numpy as np import time
@hpat.jit def calc_pi(n):
t1 = time.time()
x = 2 * np.random.ranf(n) - 1
y = 2 * np.random.ranf(n) - 1
pi = 4 * np.sum(x**2 + y**2 < 1) / n
print("Execution time:", time.time()-t1, "\nresult:", pi)
return pi
calc_pi(2 * 10**8)
python calc_pi.py
Traceback (most recent call last):
File "calc_pi.py", line 15, in
Could you try Python 3.6?
this is python 3.6. - clean install from conda to replicate conda install -n py36 python=3.6 conda install -f requirements.txt python setup.py install
source activate py36
(py36)
python calc_pi.py
Traceback (most recent call last):
File "calc_pi.py", line 1, in
und: _ZNK5boost16re_detail_10640031cpp_regex_traits_implementationIcE17transform_primaryEPKcS4
Referenced from: /anaconda3/envs/py36/lib/python3.6/site-packages/hpat-0.22-py3.6-macosx-10.7-x86_64.egg/hstr_ext.cpython-36m-darwin.so
Expected in: /usr/local/lib/libboost_regex.dylib
in /anaconda3/envs/py36/lib/python3.6/site-packages/hpat-0.22-py3.6-macosx-10.7-x86_64.egg/hstr_ext.cpython-36m-darwin.so
could you paste the output of conda list
?
(py36) conda list
packages in environment at /anaconda3/envs/py36:
Name Version Build Channel
ca-certificates 2018.4.16 0 conda-forge
certifi 2018.4.16 py36_0 conda-forge
hpat 0.22
libcxxabi 4.0.1 hebd6815_0
libedit 3.1.20170329 hb402a30_2
libffi 3.2.1 h475c297_4
libgfortran 3.0.0 0 conda-forge
llvmlite 0.23.2
numba 0.38.1
python 3.6.6 hc167b69_0
python-dateutil 2.7.3
scipy 1.1.0
six 1.11.0
tk 8.6.7 h35a86e2_3
wheel 0.31.1 py36_0
xz 5.2.4 h1de35cc_4
zlib 1.2.11 hf3cbc9b_2
boost
is missing and Numba is also old (0.39
is needed). Why are you not using our conda install command?
conda create -n HPAT -c ehsantn -c numba -c anaconda -c conda-forge hpat
ok requirements file has line numba >=0.38
boost i had installed with brew
brew install boost
Warning: boost 1.67.0_1 is already installed and up-to-date
To reinstall 1.67.0_1, run brew reinstall boost
i am able to run examples when create new py36 virtual env. i follow your instructions for using custom channels. i am still curious though why my libboost did not work with clean python 3.6 and brew installed libboost. i can see that hpat extension also installs libboost of its own and contains relative reference to its own instlalled version.
hpat 0.22 in the channel is built with default Anaconda's Boost, which is 1.65 and is built with GCC 7.2. Anything other than this can fail. If you want to use another boost version, you have to build every package that depends on boost from source (HPAT, pyarrow, etc.). Going out of Conda environment can cause a lot of issues...