amitibo / pydirect

Other
1 stars 0 forks source link

test_direct.py failing: "data type must provide an itemsize" #1

Open mukherjees opened 6 years ago

mukherjees commented 6 years ago

After changing the print statements in test_direct.py to function calls in accordance with Python 3.x, calling

python test_direct.py

returns the following error:

$ python test_direct.py
DIRECT Version 2.0.4
 Problem Dimension n                    :      4
 Eps value                              :   0.1000E-03
 Epsilon is constant.
 Maximum number of f-evaluations (maxf) :  20000
 Maximum number of iterations (MaxT)    :   6000
 Value of f_global                      :  -0.1000+101
 Global percentage wanted               :   0.1000E-01
 Volume percentage wanted               :  -0.1000E+01
 Measure percentage wanted              :  -0.1000E+01
 Jones original DIRECT algorithm is used.
Bounds on variable x 1    :    -10.00000 <= xi <=     10.00000
Bounds on variable x 2    :    -10.00000 <= xi <=     10.00000
Bounds on variable x 3    :    -10.00000 <= xi <=     10.00000
Bounds on variable x 4    :    -10.00000 <= xi <=     10.00000
---------------------------------------------------------------------------
Call-back cb_fcn_in_direct__user__routines failed.
Traceback (most recent call last):
  File "test_direct.py", line 19, in <module>
    u
  File "/home/ubuntu/anaconda3/envs/tensorflow_p36/lib/python3.6/site-packages/DIRECT-1.0.1-py3.6-linux-x86_64.egg/DIRECT/__init__.py", line 202, in solve
ValueError: data type must provide an itemsize

The conda environment has the following packages:

$ conda list
# packages in environment at /home/ubuntu/anaconda3/envs/tensorflow_p36:
#
_nb_ext_conf              0.4.0                    py36_1
anaconda-client           1.6.5            py36h19c0dcd_0
asn1crypto                0.22.0           py36h265ca7c_1
autograd                  1.2                       <pip>
autovizwidget             0.12.5                    <pip>
autovizwidget             0.12.1                   py36_0
blas                      1.1                    openblas    conda-forge
bleach                    1.5.0                     <pip>
bleach                    2.0.0            py36h688b259_0
bokeh                     0.12.10          py36hbb0e44a_0
boto3                     1.4.7                     <pip>
botocore                  1.7.43                    <pip>
bzip2                     1.0.6                         1    conda-forge
ca-certificates           2017.08.26           h1d4fec5_0
cairo                     1.14.6                        5    conda-forge
certifi                   2017.7.27.1      py36h8b7b77e_0
certifi                   2017.11.5                 <pip>
cffi                      1.10.0           py36had8d393_1
chardet                   3.0.4            py36h0f667ec_1
clyent                    1.2.2            py36h7e57e65_1
cma                       2.3.1                     <pip>
cryptography              2.0.3            py36ha225213_1
cycler                    0.10.0                    <pip>
Cython                    0.27.3                    <pip>
dbus                      1.10.22                       0    conda-forge
decorator                 4.1.2            py36hd076ac8_0
docutils                  0.14                      <pip>
emcee                     2.2.1                     <pip>
entrypoints               0.2.3            py36h1aec115_2
enum34                    1.1.6                     <pip>
environment-kernels       1.1                       <pip>
expat                     2.2.5                he0dffb1_0
ffmpeg                    3.2.4                         2    conda-forge
fontconfig                2.12.1                        5    conda-forge
freetype                  2.7                           2    conda-forge
future                    0.16.0                    <pip>
george                    0.2.1                     <pip>
gettext                   0.19.7                        1    conda-forge
giflib                    5.1.4                         0    conda-forge
glib                      2.51.4                        0    conda-forge
gmp                       6.1.2                hb3b607b_0
graphviz                  2.38.0                        6    conda-forge
gst-plugins-base          1.8.0                         0    conda-forge
gstreamer                 1.8.0                         2    conda-forge
h5py                      2.7.1                    py36_2    conda-forge
harfbuzz                  1.3.4                         2    conda-forge
hdf5                      1.10.1                        1    conda-forge
hdijupyterutils           0.12.5                    <pip>
hdijupyterutils           0.12.1                   py36_0
hpolib2                   0.0.1                     <pip>
html5lib                  0.999999999      py36h2cfc398_0
html5lib                  0.9999999                 <pip>
icu                       58.2                 h211956c_0
idna                      2.6              py36h82fb2a8_1
intel-openmp              2018.0.0             h15fc484_7
ipykernel                 4.6.1            py36hbf841aa_0
ipython                   6.2.1                     <pip>
ipython                   6.1.0            py36hc72a948_1
ipython_genutils          0.2.0            py36hb52b0d5_0
ipywidgets                7.0.4                     <pip>
ipywidgets                7.0.0            py36h7b55c3a_0
jasper                    1.900.1                       4    conda-forge
jedi                      0.10.2           py36h552def0_0
jedi                      0.11.0                    <pip>
jinja2                    2.9.6            py36h489bce4_1
Jinja2                    2.10                      <pip>
jmespath                  0.9.3                     <pip>
jpeg                      9b                   h024ee3a_2
jsonschema                2.6.0            py36h006f8b5_0
jupyter                   1.0.0                     <pip>
jupyter-console           5.2.0                     <pip>
jupyter-core              4.4.0                     <pip>
jupyter_client            5.1.0            py36h614e9ea_0
jupyter_core              4.3.0            py36h357a921_0
Keras                     2.1.0                     <pip>
krb5                      1.14.2               h56d4222_4
Lasagne                   0.1                       <pip>
libedit                   3.1                  heed3624_0
libffi                    3.2.1                hd88cf55_4
libgcc-ng                 7.2.0                h7cc24e2_2
libgfortran               3.0.0                         1
libgfortran-ng            7.2.0                h9f7466a_2
libiconv                  1.15                 h63c8f33_5
libpng                    1.6.28                        2    conda-forge
libprotobuf               3.4.0                         0
libsodium                 1.0.13               h31c71d8_2
libstdcxx-ng              7.2.0                h7a57d05_2
libtiff                   4.0.7                         1    conda-forge
libtool                   2.4.6                h544aabb_3
libwebp                   0.5.2                         7    conda-forge
libxcb                    1.12                          1    conda-forge
libxml2                   2.9.4                h6b072ca_5
Markdown                  2.6.9                     <pip>
markupsafe                1.0              py36hd9260cd_1
matplotlib                2.1.0                     <pip>
mistune                   0.8.1            py36h3d5977c_0
mkl                       2018.0.0             hb491cac_4
mock                      2.0.0                     <pip>
nb_anacondacloud          1.4.0                    py36_0
nb_conda                  2.2.1            py36h8118bb2_0
nb_conda_kernels          2.1.0                    py36_0
nbconvert                 5.3.1            py36hb41ffb7_0
nbformat                  4.4.0            py36h31c9010_0
nbpresent                 3.0.2            py36h5f95a39_1
ncurses                   6.0                  h9df7e31_2
nose                      1.3.7                     <pip>
notebook                  5.2.1            py36h690a4eb_0
numpy                     1.13.3          py36_blas_openblas_201  [blas_openblas]  conda-forge
openblas                  0.2.20                        4    conda-forge
opencv                    3.3.0           py36_blas_openblas_202  [blas_openblas]  conda-forge
openssl                   1.0.2m               h8cfc7e7_0
pandas                    0.21.0           py36h78bd809_1
pandoc                    1.19.2.1             hea2e7c5_1
pandocfilters             1.4.2            py36ha6701b7_1
pango                     1.40.3                        3    conda-forge
parso                     0.1.0                     <pip>
pbr                       3.1.1                     <pip>
pcre                      8.41                 hc71a17e_0
pexpect                   4.2.1            py36h3b9d41b_0
pexpect                   4.3.0                     <pip>
pickleshare               0.7.4            py36h63277f8_0
pip                       9.0.1            py36h6c6f9ce_4
pixman                    0.34.0                        0    conda-forge
plotly                    2.1.0            py36h56a57e5_0
plotly                    2.2.1                     <pip>
prompt_toolkit            1.0.15           py36h17d85b1_0
protobuf                  3.4.0                    py36_0
psycopg2                  2.7.3.2                   <pip>
ptyprocess                0.5.2            py36h69acd42_0
py4j                      0.10.4                    <pip>
pycparser                 2.18             py36hf9f622e_1
pygal                     2.4.0                     <pip>
pygments                  2.2.0            py36h0d3125c_0
pykerberos                1.1.14           py36h84109d8_2
pyopenssl                 17.2.0           py36h5cc804b_0
pyparsing                 2.2.0                     <pip>
pyrfr                     0.7.0                     <pip>
pysocks                   1.6.7            py36hd97a5b1_1
pyspark                   2.2.0                     <pip>
python                    3.6.3                h1284df2_4
python-dateutil           2.6.1            py36h88d3b88_1
pytz                      2017.2           py36hc2ccc2a_1
pytz                      2017.3                    <pip>
pyyaml                    3.12             py36hafb9ca4_1
pyzmq                     16.0.3                    <pip>
pyzmq                     16.0.2           py36h3b0cf96_2
qt                        5.6.2                         3    conda-forge
qtconsole                 4.3.1                     <pip>
readline                  7.0                  ha6073c6_4
requests                  2.18.4           py36he2e5f8d_1
requests-kerberos         0.11.0           py36h333c0e5_1
s3transfer                0.1.11                    <pip>
scipy                     1.0.0                     <pip>
scipy                     1.0.0           py36_blas_openblas_201  [blas_openblas]  conda-forge
setuptools                36.7.2                    <pip>
setuptools                36.5.0           py36he42e2e1_0
sgmcmc                    0.0.1                     <pip>
simplegeneric             0.8.1            py36h2cb9092_0
six                       1.11.0           py36h372c433_1
sparkmagic                0.12.5                    <pip>
sparkmagic                0.12.1                   py36_0
SQLAlchemy                1.1.15                    <pip>
sqlite                    3.20.1               hb898158_2
tensorflow-gpu            1.4.0                     <pip>
tensorflow-tensorboard    0.4.0rc2                  <pip>
terminado                 0.6              py36ha25a19f_0
testpath                  0.3.1            py36h8cadb63_0
Theano                    1.0.0                     <pip>
tk                        8.6.7                hc745277_3
tornado                   4.5.2            py36h1283b2a_0
traitlets                 4.3.2            py36h674d592_0
urllib3                   1.22             py36hbe7ace6_0
wcwidth                   0.1.7            py36hdf4376a_0
webencodings              0.5.1            py36h800622e_1
Werkzeug                  0.12.2                    <pip>
wheel                     0.30.0                    <pip>
wheel                     0.29.0           py36he7f4e38_1
widgetsnbextension        3.0.7                     <pip>
widgetsnbextension        3.0.2            py36hd01bb71_1
x264                      20131217                      3    conda-forge
xorg-libxau               1.0.8                         3    conda-forge
xorg-libxdmcp             1.1.2                         3    conda-forge
xz                        5.2.3                h55aa19d_2
yaml                      0.1.7                h014fa73_2
zeromq                    4.2.2                hbedb6e5_2
zlib                      1.2.11               ha838bed_2
amitibo commented 6 years ago

Hi,

Till now I used DIRECT with python 2.7. Following your report I checked it with python 3.5 and got the same error. I am not sure but it might have to do with the numpy version as mentioned in: https://github.com/automl/RoBO/issues/77 . Currently I am too busy to debug this. If somebody is willing to check it, I will update the code accordingly.

Thanks, Amit

tinutjoy commented 6 years ago

Hi There,

I have tried with python 3.6 (latest numpy version), and it has worked!

Cheers, Tinu