# PyCall inconsistent across machines

**URL:** https://discourse.julialang.org/t/pycall-inconsistent-across-machines/24225
**Category:** New to Julia
**Tags:** question
**Created:** [May 15, 2019, 1:05am UTC](https://discourse.julialang.org/t/pycall-inconsistent-across-machines/24225 "2019-05-15T01:05:05Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Adriel](https://avatars.discourse-cdn.com/v4/letter/a/f07891/32.png) [@Adriel](https://discourse.julialang.org/u/Adriel)
#### Post date: [May 15, 2019, 1:05am UTC](https://discourse.julialang.org/t/pycall-inconsistent-across-machines/24225/1 "2019-05-15T01:05:05Z")

</div>

I have the following code intended to access sympy’s logic functionality (not implemented in SymPy.jl)

```julia
    using PyCall
    pyimport_conda("sympy.logic", "sympy")
    py"""
    from sympy.logic import POSform
    from sympy import symbols

    def kmap_py(symstr, minterms):
        syms = symbols(symstr)
        return POSform(syms, minterms)

```

which I use like

```julia-repl
julia> py"kmap_py"("b1 b2", PyVector([0,1,3]))

```

This works fine on one PC (running Windows 10) and gives the error below on another (Win 7). Both PCs have the same directory structure, and both are using the built in conda version (`ENV["PYTHON"] == ""`). Any idea what the difference could be? Here is the error

```julia
ERROR: PyError ($(Expr(:escape, :(ccall(#= C:\julia-depot\packages\PyCall\ttONZ\src\pyfncall.jl:44 =# @pysym(:PyObject_Call), PyPtr, (PyPtr, PyPtr, PyPtr), o, pyargsptr, kw))))) <c
lass 'TypeError'>
TypeError("'int' object is not iterable",)
  File "C:\julia-depot\packages\PyCall\ttONZ\src\pyeval.jl", line 6, in kmap_py
  File "C:\julia-depot\conda\3\lib\site-packages\sympy\logic\boolalg.py", line 1898, in POSform
    minterms = [list(i) for i in minterms]
  File "C:\julia-depot\conda\3\lib\site-packages\sympy\logic\boolalg.py", line 1898, in <listcomp>
    minterms = [list(i) for i in minterms]

```

---

<div class="post-metadata">

### Author: ![tkf](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tkf/32/17635_2.png) [@tkf](https://discourse.julialang.org/u/tkf)
#### Post date: [May 15, 2019, 1:51am UTC](https://discourse.julialang.org/t/pycall-inconsistent-across-machines/24225/2 "2019-05-15T01:51:01Z")

</div>

Did you check that two machines have the same version of the libraries? For example, `pyimport("sympy"). __version__ ` and PyCall version printed by `Pkg.status()` may be useful.

---

<div class="post-metadata">

### Author: ![Adriel](https://avatars.discourse-cdn.com/v4/letter/a/f07891/32.png) [@Adriel](https://discourse.julialang.org/u/Adriel)
#### Post date: [May 15, 2019, 2:22am UTC](https://discourse.julialang.org/t/pycall-inconsistent-across-machines/24225/3 "2019-05-15T02:22:47Z")

</div>

Thanks! I was running sympy 1.4 (working) vs 1.3 (not working, different input syntax).

I upgraded using `Conda.update()`. Is there a way to specify a minimum conda package version and maybe upgrade just that automatically through `pyimport_conda` or similar? Thank you.

---

<div class="post-metadata">

### Author: ![tkf](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tkf/32/17635_2.png) [@tkf](https://discourse.julialang.org/u/tkf)
#### Post date: [May 15, 2019, 2:55am UTC](https://discourse.julialang.org/t/pycall-inconsistent-across-machines/24225/4 "2019-05-15T02:55:04Z")

</div>

`pyimport_conda` installs Python packages if there is an error during imports. So, it’s not very useful for constraining versions. I think you need to check package versions yourself (by looking at ` __version__ ` or using `pkg_resources`) and then invoke `Conda.add("sympy>=1.4")` (say) if you need to upgrade sympy.

If you are writing Julia packages, I think it’s better to install packages at build time. I’m proposing to add such API and deprecate `pyimport_conda` (although it’s stalled ATM): [https://github.com/JuliaPy/PyCall.jl/pull/613](https://github.com/JuliaPy/PyCall.jl/pull/613)

---

<div class="post-metadata">

### Author: ![Adriel](https://avatars.discourse-cdn.com/v4/letter/a/f07891/32.png) [@Adriel](https://discourse.julialang.org/u/Adriel)
#### Post date: [May 15, 2019, 3:28am UTC](https://discourse.julialang.org/t/pycall-inconsistent-across-machines/24225/5 "2019-05-15T03:28:36Z")

</div>

OK thanks for your help, and efforts overall.

---

<div class="post-metadata">

### Author: ![j\_verzani](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/j_verzani/32/8551_2.png) [@j\_verzani](https://discourse.julialang.org/u/j_verzani)
#### Post date: [May 15, 2019, 11:14am UTC](https://discourse.julialang.org/t/pycall-inconsistent-across-machines/24225/6 "2019-05-15T11:14:13Z")

</div>

You might also just do: `sympy.POSform(symbols("b1 b2"), [0,1,3])` if you want to use SymPy.jl
