# Call Python skopt package from Julia

**URL:** <https://discourse.julialang.org/t/call-python-skopt-package-from-julia/90816>\
**Category:** General Usage\
**Tags:** question\
**Created:** [November 25, 2022, 4:42pm UTC](https://discourse.julialang.org/t/call-python-skopt-package-from-julia/90816 "2022-11-25T16:42:54Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![xspeng](https://avatars.discourse-cdn.com/v4/letter/x/90ced4/32.png) [@xspeng](https://discourse.julialang.org/u/xspeng)\
**Post date:** [November 25, 2022, 4:42pm UTC](https://discourse.julialang.org/t/call-python-skopt-package-from-julia/90816/1 "2022-11-25T16:42:55Z")

</div>

When I try to call python skopt from Julia, I find a weird problem, here is a simple example that can reflect my question, if I define all variable range with `Real`, it will cause error in `res = opt.tell(suggested, y)` however, once I have one variable range defined with` Integer`, then it works well, where is the problem?

```julia
function blackbox(para)
    return (para[1]^2 - para[2])^2 + 2
end

using PyCall
skopt = pyimport("skopt")
py"""
from skopt.space import Real,Integer
space =[Real(-10, 10),
        Integer(-10, 10)] # if use `Real(-10,10)`, it will cause error in `res = opt.tell(suggested, y)`
                                        # but if I use Integer(-10, 10), it will run successfully, why?
"""

opt = skopt.Optimizer(py"space", n_initial_points=4, acq_func="EI", acq_optimizer="sampling")
suggested = opt.ask()
display(suggested)
y = blackbox(suggested)
display(y)
res = opt.tell(suggested, y)

```
