# LoadError:PyCall.PyError

**URL:** <https://discourse.julialang.org/t/loaderror-pycall-pyerror/28665>\
**Category:** General Usage\
**Tags:** question\
**Created:** [September 11, 2019, 8:48pm UTC](https://discourse.julialang.org/t/loaderror-pycall-pyerror/28665 "2019-09-11T20:48:01Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![OmkarGadgil](https://avatars.discourse-cdn.com/v4/letter/o/4491bb/32.png) [@OmkarGadgil](https://discourse.julialang.org/u/OmkarGadgil)\
**Post date:** [September 11, 2019, 8:48pm UTC](https://discourse.julialang.org/t/loaderror-pycall-pyerror/28665/1 "2019-09-11T20:48:01Z")

</div>

I am getting the following Error for PyCall and am on Julia v 1.2.0 Following is the Python setup and the Conda setup in build file

```julia
ENV["PYTHON"] = " " 
Pkg.build("PyCall")

using PyCall, Conda
pyexec = pyimport("sys").executable

```

```julia
ERROR: LoadError: PyCall.PyError("\$(Expr(:escape, :(ccall(#= /home/omkar/.julia/packages/PyCall/ttONZ/src/pyfncall.jl:44 =# @pysym(:PyObject_Call), PyPtr, (PyPtr, PyPtr, PyPtr), o, pyargsptr, kw))))", PyCall.PyObject(Ptr{PyCall.PyObject_struct} @0x00007f9ea56a2520), PyCall.PyObject(Ptr{PyCall.PyObject_struct} @0x00007f9db65dcca8), PyCall.PyObject(Ptr{PyCall.PyObject_struct} @0x00007f9d004f9f08))
Stacktrace:
 [1] pyerr_check at /home/omkar/.julia/packages/PyCall/ttONZ/src/exception.jl:60 [inlined]
 [2] pyerr_check at /home/omkar/.julia/packages/PyCall/ttONZ/src/exception.jl:64 [inlined]
 [3] macro expansion at /home/omkar/.julia/packages/PyCall/ttONZ/src/exception.jl:84 [inlined]
 [4] __pycall!(::PyCall.PyObject, ::Ptr{PyCall.PyObject_struct}, ::PyCall.PyObject, ::Ptr{Nothing}) at /home/omkar/.julia/packages/PyCall/ttONZ/src/pyfncall.jl:44
 [5] _pycall!(::PyCall.PyObject, ::PyCall.PyObject, ::Tuple{String,String,String,String,String,Float64,String,Float64}, ::Int64, ::Ptr{Nothing}) at /home/omkar/.julia/packages/PyCall/ttONZ/src/pyfncall.jl:29
 [6] _pycall!(::PyCall.PyObject, ::PyCall.PyObject, ::Tuple{String,String,String,String,String,Float64,String,Float64}, ::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at /home/omkar/.julia/packages/PyCall/ttONZ/src/pyfncall.jl:11
 [7] #call#111(::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::PyCall.PyObject, ::String, ::Vararg{Any,N} where N) at /home/omkar/.julia/packages/PyCall/ttONZ/src/pyfncall.jl:89
 [8] (::PyCall.PyObject)(::String, ::Vararg{Any,N} where N) at /home/omkar/.julia/packages/PyCall/ttONZ/src/pyfncall.jl:89

```

---

<div class="post-metadata">

**Author:** ![rdeits](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rdeits/32/286_2.png) [@rdeits](https://discourse.julialang.org/u/rdeits)\
**Post date:** [September 11, 2019, 9:53pm UTC](https://discourse.julialang.org/t/loaderror-pycall-pyerror/28665/2 "2019-09-11T21:53:09Z")

</div>

I’m not sure if it matters, but I believe the recommendation is to set `ENV["PYTHON"]` to `""` (an empty string), while you are setting it to `" "` (a string containing a single space). Does changing that have any effect?

---

<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:** [September 12, 2019, 3:45am UTC](https://discourse.julialang.org/t/loaderror-pycall-pyerror/28665/3 "2019-09-12T03:45:15Z")

</div>

Is it the full stacktrace? Also, you’d probably want to evaluate `pysys = pyimport("sys")` and `pysys.executable` separately to see when it fails.

---

<div class="post-metadata">

**Author:** ![OmkarGadgil](https://avatars.discourse-cdn.com/v4/letter/o/4491bb/32.png) [@OmkarGadgil](https://discourse.julialang.org/u/OmkarGadgil)\
**Post date:** [September 12, 2019, 1:28pm UTC](https://discourse.julialang.org/t/loaderror-pycall-pyerror/28665/4 "2019-09-12T13:28:19Z")

</div>

It is set to an empty string in the build.It does not solve the Error.

---

<div class="post-metadata">

**Author:** ![OmkarGadgil](https://avatars.discourse-cdn.com/v4/letter/o/4491bb/32.png) [@OmkarGadgil](https://discourse.julialang.org/u/OmkarGadgil)\
**Post date:** [September 12, 2019, 1:32pm UTC](https://discourse.julialang.org/t/loaderror-pycall-pyerror/28665/5 "2019-09-12T13:32:23Z")

</div>

There are two more lines which have the confidential code file names. But those just mention the type of data structure in that function call.

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [September 12, 2019, 1:50pm UTC](https://discourse.julialang.org/t/loaderror-pycall-pyerror/28665/6 "2019-09-12T13:50:34Z")

</div>

I can’t reproduce your problem. What operating system are you using? Is your PyCall installation up-to-date? (e.g. you haven’t pinned anything at old versions if you run `st` at the `pkg>` prompt?)

Note that you need to start a new Julia session when you re-run `Pkg.build("PyCall")` (which you normally only do once).

---

<div class="post-metadata">

**Author:** ![Kihong\_Kim](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kihong_kim/32/13632_2.png) [@Kihong\_Kim](https://discourse.julialang.org/u/Kihong_Kim)\
**Post date:** [March 26, 2020, 2:11am UTC](https://discourse.julialang.org/t/loaderror-pycall-pyerror/28665/7 "2020-03-26T02:11:17Z")

</div>

I have the same problem and my advisor told me that I need the xlrd package of Python. How can I get the package into Julia?

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [March 27, 2020, 5:52pm UTC](https://discourse.julialang.org/t/loaderror-pycall-pyerror/28665/8 "2020-03-27T17:52:57Z")

</div>

The “same problem” as in the same error message? Or an unrelated error message, e.g. because you didn’t install `xlrd`. (`pyimport("xlrd")` should work fine if `xlrd` is installed in the Python Julia is using, e.g. via `using Conda; Conda.add("xlrd")`.)

In general, please don’t resurrect old threads with vaguely related questions… open a new thread if needed.

Note that Julia has several packages for reading Excel documents already, which are probably more friendly than calling Python: [How to read excel into Julia? - Stack Overflow](https://stackoverflow.com/questions/48240434/how-to-read-excel-into-julia)
