# Error building "pycall"

**URL:** <https://discourse.julialang.org/t/error-building-pycall/16270>\
**Category:** General Usage\
**Tags:** package\
**Created:** [October 13, 2018, 9:10am UTC](https://discourse.julialang.org/t/error-building-pycall/16270 "2018-10-13T09:10:02Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![lannisite110](https://avatars.discourse-cdn.com/v4/letter/l/df705f/32.png) [@lannisite110](https://discourse.julialang.org/u/lannisite110)\
**Post date:** [October 13, 2018, 9:10am UTC](https://discourse.julialang.org/t/error-building-pycall/16270/1 "2018-10-13T09:10:02Z")

</div>

Error: Error building `PyCall`:  
│ ERROR: LoadError: UndefVarError: v not defined  
│ Stacktrace:  
│ [1] find\_libpython(::String) at /home/users/xdlan/.julia/packages/PyCall/0jMpb/deps/build.jl:101  
│ [2] top-level scope at logging.jl:313  
│ [3] top-level scope at /home/users/xdlan/.julia/packages/PyCall/0jMpb/deps/build.jl:170  
│ [4] include at ./boot.jl:317 [inlined]  
│ [5] include\_relative(::Module, ::String) at ./loading.jl:1038  
│ [6] include(::Module, ::String) at ./sysimg.jl:29  
│ [7] include(::String) at ./client.jl:388  
│ [8] top-level scope at none:0  
│ in expression starting at /home/users/xdlan/.julia/packages/PyCall/0jMpb/deps/build.jl:144

---

<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:** [October 13, 2018, 9:41am UTC](https://discourse.julialang.org/t/error-building-pycall/16270/2 "2018-10-13T09:41:37Z")

</div>

What is the output of this?

```julia
ENV["PYCALL_DEBUG_BUILD"] = "yes"
using Pkg
Pkg.build("PyCall")
print(read(joinpath(dirname(dirname(Base.find_package("PyCall"))), "deps", "build.log"), String))

```

---

<div class="post-metadata">

**Author:** ![chobbes](https://avatars.discourse-cdn.com/v4/letter/c/848f3c/32.png) [@chobbes](https://discourse.julialang.org/u/chobbes)\
**Post date:** [October 13, 2018, 10:59am UTC](https://discourse.julialang.org/t/error-building-pycall/16270/3 "2018-10-13T10:59:51Z")

</div>

> [@lannisite110](#):
>
> Error: Error building `PyCall` :  
> │ ERROR: LoadError: UndefVarError: v not defined  
> │ Stacktrace:  
> │ [1] find\_libpython(::String) at /home/users/xdlan/.julia/packages/PyCall/0jMpb/deps/build.jl:101  
> │ [2] top-level scope at logging.jl:313  
> │ [3] top-level scope at /home/users/xdlan/.julia/packages/PyCall/0jMpb/deps/build.jl:170  
> │ [4] include at ./boot.jl:317 [inlined]  
> │ [5] include\_relative(::Module, ::String) at ./loading.jl:1038  
> │ [6] include(::Module, ::String) at ./sysimg.jl:29  
> │ [7] include(::String) at ./client.jl:388  
> │ [8] top-level scope at none:0  
> │ in expression starting at /home/users/xdlan/.julia/packages/PyCall/0jMpb/deps/build.jl:144

Came across pretty much the same issue. Try rebuild. If doesn’t work, `rm` and `gc` before re-add the package.

---

<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:** [October 13, 2018, 12:35pm UTC](https://discourse.julialang.org/t/error-building-pycall/16270/4 "2018-10-13T12:35:43Z")

</div>

There was a bug in the exception message ([https://github.com/JuliaPy/PyCall.jl/commit/8c43f1badc3711839812b10bd5113345a8032e3e](https://github.com/JuliaPy/PyCall.jl/commit/8c43f1badc3711839812b10bd5113345a8032e3e)). However, the underlying problem (once you checkout PyCall master) will still be that it is failing to find `libpython`. The `PYCALL_DEBUG_BUILD` that @tkf suggested should output more information.

What is `versioninfo(verbose=true)`?

---

<div class="post-metadata">

**Author:** ![rdauria](https://avatars.discourse-cdn.com/v4/letter/r/a87d85/32.png) [@rdauria](https://discourse.julialang.org/u/rdauria)\
**Post date:** [October 19, 2018, 6:32pm UTC](https://discourse.julialang.org/t/error-building-pycall/16270/5 "2018-10-19T18:32:32Z")

</div>

Hello, I am having similar issues I am trying to use a version of python installed in a non default location on a linux system via setting of ENV(“PYTHON”).

`versioninfo(verbose=true)`  
julia\> versioninfo(verbose=true)  
Julia Version 1.0.1  
Commit 0d713926f8 (2018-09-29 19:05 UTC)  
Platform Info:  
OS: Linux (x86\_64-pc-linux-gnu)  
“CentOS release 6.9 (Final)”  
uname: Linux 2.6.32-696.18.7.el6.x86\_64 #1 SMP Thu Jan 4 17:31:22 UTC 2018 x86\_64 x86\_64  
CPU: Intel(R) Xeon(R) CPU E5-2695 v4 @ 2.10GHz:  
speed user nice sys idle irq  
#1-12 2095 MHz 829817485 s 214563 s 571353562 s 16079146005 s 133339 s

Memory: 23.593402862548828 GB (371.125 MB free)  
Uptime: 1.4761053e7 sec  
Load Avg: 52.77099609375 53.01025390625 53.16259765625  
WORD\_SIZE: 64  
LIBM: libopenlibm  
LLVM: libLLVM-6.0.0 (ORCJIT, sandybridge)  
Environment:  
JULIA\_BINDIR = /u/local/apps/julia/1.0.1/bin  
JULIA\_INC = /u/local/apps/julia/1.0.1/include  
JULIA\_LIB = /u/local/apps/julia/1.0.1/lib  
JULIA\_DIR = /u/local/apps/julia/1.0.1  
MANPATH = /u/local/apps/python/2.7.13/share/man:/u/local/apps/xz/5.2.3/share/man:/u/local/apps/julia/1.0.1/share/man:/u/local/compilers/gcc/4.9.3/share/man:/u/local/compilers/intel-cs/2013.0.028/mpi/man:/u/local/compilers/intel-cs/2013.0.028/itac/man:/u/local/compilers/intel-cs/2013.0.028/composer\_xe/man/en\_US:/u/systems/UGE8.0.1vm/man:/u/local/Modules/3.2.6/man:/usr/local/share/man:/usr/share/man/overrides:/usr/share/man/en:/usr/share/man:/usr/local/man:/u/local/man:/u/local/compilers/intel-cs/2013.0.028/inspector\_xe/man:/u/local/compilers/intel-cs/2013.0.028/vtune\_amplifier\_xe/man:/u/local/compilers/intel-cs/2013.0.028/advisor\_xe/man  
TERM = xterm-256color  
LIBRARY\_PATH = /u/local/apps/python/2.7.13/lib:/u/local/compilers/gcc/4.9.3/lib:/u/local/compilers/gcc/4.9.3/lib64:/u/local/compilers/intel-cs/2013.0.028/composer\_xe/compiler/lib/intel64:/u/local/compilers/intel-cs/2013.0.028/composer\_xe/ipp/lib/intel64:/u/local/compilers/intel-cs/2013.0.028/composer\_xe/mkl/lib/intel64:/u/local/compilers/intel-cs/2013.0.028/composer\_xe/tbb/lib/intel64  
MIC\_LD\_LIBRARY\_PATH = /u/local/compilers/intel-cs/2013.0.028/composer\_xe/compiler/lib/mic:/opt/intel/mic/coi/device-linux-release/lib:/opt/intel/mic/myo/lib:/u/local/compilers/intel-cs/2013.0.028/composer\_xe/mkl/lib/mic:/u/local/compilers/intel-cs/2013.0.028/composer\_xe/tbb/lib/mic  
LD\_LIBRARY\_PATH = /u/local/apps/python/2.7.13/lib:/u/local/compilers/intel/17.0.1/compilers\_and\_libraries\_2017.1.132/linux/mkl/lib/intel64:/u/local/apps/xz/5.2.3/lib:/u/local/apps/hdf5/1.8.18/gcc-4.4.7-shared/lib:/u/local/apps/julia/1.0.1/lib:/u/local/compilers/gcc/4.9.3/lib:/u/local/compilers/gcc/4.9.3/lib64:/u/local/compilers/intel-cs/2013.0.028/mpi/intel64/lib:/u/local/compilers/intel-cs/2013.0.028/itac/intel64/itac/slib\_impi4:/u/local/compilers/intel-cs/2013.0.028/composer\_xe/compiler/lib/intel64:/opt/intel/mic/coi/host-linux-release/lib:/opt/intel/mic/myo/lib:/u/local/compilers/intel-cs/2013.0.028/composer\_xe/mpirt/bin/intel64:/u/local/compilers/intel-cs/2013.0.028/composer\_xe/ipp/lib/intel64:/u/local/compilers/intel-cs/2013.0.028/composer\_xe/mkl/lib/intel64:/u/local/compilers/intel-cs/2013.0.028/composer\_xe/tbb/lib/intel64  
CPATH = /u/local/compilers/intel-cs/2013.0.028/composer\_xe/mkl/include:/u/local/compilers/intel-cs/2013.0.028/composer\_xe/tbb/include  
NLSPATH = /u/local/compilers/intel-cs/2013.0.028/composer\_xe/compiler/lib/intel64/locale/en\_US:/u/local/compilers/intel-cs/2013.0.028/composer\_xe/ipp/lib/intel64/locale/en\_US:/u/local/compilers/intel-cs/2013.0.028/composer\_xe/mkl/lib/intel64/locale/en\_US:/u/local/compilers/intel-cs/2013.0.028/composer\_xe/debugger/intel64/locale/en\_US  
PATH = /u/local/apps/python/2.7.13/bin:/u/local/apps/xz/5.2.3/bin:/u/local/apps/hdf5/1.8.18/gcc-4.4.7-shared/bin:/u/local/apps/julia/1.0.1/bin:/u/local/compilers/gcc/4.9.3/bin:/u/local/compilers/intel-cs/2013.0.028/bin:/u/local/compilers/intel-cs/2013.0.028/advisor\_xe/bin64:/u/local/compilers/intel-cs/2013.0.028/vtune\_amplifier\_xe/bin64:/u/local/compilers/intel-cs/2013.0.028/inspector\_xe/bin64:/u/local/compilers/intel-cs/2013.0.028/mpi/intel64/bin:/u/local/compilers/intel-cs/2013.0.028/itac/intel64/bin:/u/local/compilers/intel-cs/2013.0.028/composer\_xe/bin/intel64:/u/local/compilers/intel-cs/2013.0.028/composer\_xe/mpirt/bin/intel64:/u/local/compilers/intel-cs/2013.0.028/composer\_xe/bin/intel64\_mic:/u/local/compilers/intel-cs/2013.0.028/composer\_xe/debugger/gui/intel64:/u/systems/UGE8.0.1vm/bin/lx-amd64:/u/local/bin:/u/local/sbin:/usr/lib64/qt-3.3/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/u/home/systems/systest/bin  
IDB\_HOME = /u/local/compilers/intel-cs/2013.0.028/composer\_xe/bin/intel64  
MODULEPATH = /u/local/apps/python/2.7.13/modulefiles:/u/local/gcc/4.9.3/modulefiles:/u/local/Modules/modulefiles:  
HOME = /u/home/systems/systest  
CLASSPATH = /u/local/compilers/intel-cs/2013.0.028/itac/intel64/itac/lib\_impi4  
MODULESHOME = /u/local/Modules/3.2.6  
INFOPATH = /u/local/compilers/gcc/4.9.3/share/info

This is what I get when running: `PYCALL_DEBUG_BUILD`  
julia\> print(read(joinpath(dirname(dirname(Base.find\_package(“PyCall”))), “deps”, “build.log”), String))  
DEBUG is\_windows = False  
DEBUG is\_apple = False  
DEBUG Candidate: /u/home/systems/systest/.julia/packages/PyCall/0jMpb/deps/python  
DEBUG Not found.  
DEBUG Candidate: /u/local/apps/python/2.7.13/lib/python2.7/config/libpython2.7.a  
DEBUG Found: /u/local/apps/python/2.7.13/lib/python2.7/config/libpython2.7.a  
DEBUG Candidate: /u/local/apps/python/2.7.13/lib/python2.7/config/libpython2.7.so  
DEBUG Not found.  
DEBUG Candidate: /u/local/apps/python/2.7.13/lib/python2.7/config/libpython2.so  
DEBUG Not found.  
DEBUG Candidate: /u/local/apps/python/2.7.13/lib/python2.7/config/libpython.so  
DEBUG Not found.  
DEBUG Candidate: …/libpython2.7.a  
DEBUG Not found.  
DEBUG Candidate: …/libpython2.7.so  
DEBUG Not found.  
DEBUG Candidate: …/libpython2.so  
DEBUG Not found.  
DEBUG Candidate: …/libpython.so  
DEBUG Not found.  
DEBUG Candidate: /u/local/apps/python/2.7.13/lib/libpython2.7.a  
DEBUG Found: /u/local/apps/python/2.7.13/lib/libpython2.7.a  
DEBUG Candidate: /u/local/apps/python/2.7.13/lib/libpython2.7.so  
DEBUG Not found.  
DEBUG Candidate: /u/local/apps/python/2.7.13/lib/libpython2.so  
DEBUG Not found.  
DEBUG Candidate: /u/local/apps/python/2.7.13/lib/libpython.so  
DEBUG Not found.  
DEBUG Candidate: /u/local/apps/python/2.7.13/libpython2.7.a  
DEBUG Not found.  
DEBUG Candidate: /u/local/apps/python/2.7.13/libpython2.7.so  
DEBUG Not found.  
DEBUG Candidate: /u/local/apps/python/2.7.13/libpython2.so  
DEBUG Not found.  
DEBUG Candidate: /u/local/apps/python/2.7.13/libpython.so  
DEBUG Not found.  
DEBUG Candidate: None  
DEBUG Not found.  
DEBUG Candidate: libpython2.6.so.1.0  
DEBUG Not found.  
ERROR: LoadError: UndefVarError: libpath\_lib not defined  
Stacktrace:  
[1] show\_dlopen\_error(::ErrorException) at /u/home/systems/systest/.julia/packages/PyCall/0jMpb/deps/build.jl:63  
[2] find\_libpython(::String) at /u/home/systems/systest/.julia/packages/PyCall/0jMpb/deps/build.jl:78  
[3] top-level scope at logging.jl:313  
[4] top-level scope at /u/home/systems/systest/.julia/packages/PyCall/0jMpb/deps/build.jl:170  
[5] include at ./boot.jl:317 [inlined]  
[6] include\_relative(::Module, ::String) at ./loading.jl:1041  
[7] include(::Module, ::String) at ./sysimg.jl:29  
[8] include(::String) at ./client.jl:388  
[9] top-level scope at none:0  
in expression starting at /u/home/systems/systest/.julia/packages/PyCall/0jMpb/deps/build.jl:144

Does julia require any special version of python?

The very same issue happens with python/3.6.1 is there a way I can set libpath\_lib?

Thanks!

---

<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:** [October 19, 2018, 6:49pm UTC](https://discourse.julialang.org/t/error-building-pycall/16270/6 "2018-10-19T18:49:56Z")

</div>

It looks like it is looking for python 2.7 libraries. Are you sure you set `ENV["PYTHON"]` to the python version you want? Are you sure that libpython is installed as a shared library? If so, where is it installed?

---

<div class="post-metadata">

**Author:** ![rdauria](https://avatars.discourse-cdn.com/v4/letter/r/a87d85/32.png) [@rdauria](https://discourse.julialang.org/u/rdauria)\
**Post date:** [October 19, 2018, 7:33pm UTC](https://discourse.julialang.org/t/error-building-pycall/16270/7 "2018-10-19T19:33:43Z")

</div>

Right you are!!! I was trying to link against a python not built with shared libraries! Thanks a million!

---

<div class="post-metadata">

**Author:** ![Renato\_Cerda\_Hernand](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/renato_cerda_hernand/32/8375_2.png) [@Renato\_Cerda\_Hernand](https://discourse.julialang.org/u/Renato_Cerda_Hernand)\
**Post date:** [May 8, 2019, 9:48am UTC](https://discourse.julialang.org/t/error-building-pycall/16270/8 "2019-05-08T09:48:55Z")

</div>

Hi, its my first time using Julia and I want to set ENV[“PYTHON”]=“pythoncommand”, but I dont know where I have ti set this. Can you guide me?

---

<div class="post-metadata">

**Author:** ![ArnoBetsy](https://avatars.discourse-cdn.com/v4/letter/a/76d3ee/32.png) [@ArnoBetsy](https://discourse.julialang.org/u/ArnoBetsy)\
**Post date:** [December 25, 2019, 5:54am UTC](https://discourse.julialang.org/t/error-building-pycall/16270/9 "2019-12-25T05:54:10Z")

</div>

Hi, have you solved this problem, I met the same problem just now!

 ![image](https://global.discourse-cdn.com/julialang/original/3X/8/8/88f3c1e39323bf639d5ef69e538e961927278725.png)

---

<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:** [January 7, 2020, 4:59pm UTC](https://discourse.julialang.org/t/error-building-pycall/16270/10 "2020-01-07T16:59:09Z")

</div>

> [@ArnoBetsy](#):
>
> I met the same problem just now!

Your error message (“could not spawn python.exe”) is completely different from the ones earlier in the thread, so it is not the “same problem”. _Not all installation problems are equivalent,_ and posting unrelated issues on an old thread is not helpful.

It looks like you are encountering [this issue](https://github.com/JuliaPy/PyCall.jl/issues/688) that arises with JuliaPro on Windows. See [this workaround](https://github.com/JuliaPy/PyCall.jl/issues/688#issuecomment-571689796).

---

<div class="post-metadata">

**Author:** ![ArnoBetsy](https://avatars.discourse-cdn.com/v4/letter/a/76d3ee/32.png) [@ArnoBetsy](https://discourse.julialang.org/u/ArnoBetsy)\
**Post date:** [January 8, 2020, 12:56am UTC](https://discourse.julialang.org/t/error-building-pycall/16270/11 "2020-01-08T00:56:51Z")

</div>

Thank you! It’s helpful, i was mistaken for mixing up the problem. Thank you again!
