error building "pycall"

package

#1

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


#2

What is the output of this?

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

#3

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


#4

There was a bug in the exception message (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)?


#5

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® Xeon® 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!


#6

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?


#7

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