TensorFlow.jl icon indicating copy to clipboard operation
TensorFlow.jl copied to clipboard

Logistic Regression example does not run in Docker container

Open metanoid opened this issue 7 years ago • 5 comments

I used commit 05ea5a6929ccdf28870591b56aac81795203fc23 to install Julia 1.0.0 and TensorFlow in a Docker container. Then I tried running the "Logistic Regression" example in the resulting terminal.

  • First problem: User needs to explicitly add, build, and using PyCall to get rid of messages complaining of PyCall being missing
  • Second Problem: py_gradients not defined (See error log at bottom of issue)
----------------
Library Versions
----------------
$(Expr(:escape, :(ENV["TF_USE_GPU"]))) = "0"
Trying to evaluate ENV["LIBTENSORFLOW"] but got error: KeyError("LIBTENSORFLOW")

$(Expr(:escape, :(tf_version(kind=:backend)))) = v"1.10.0"
Trying to evaluate tf_version(kind=:python) but got error: RemoteException(2, CapturedException(UndefVarError(:py_tf), Any[(#13 at TensorFlow.jl:181, 1), (#116 at process_messages.jl:276, 1), (run_work_thunk at process_messages.jl:56, 1), (run_work_thunk at process_messages.jl:65, 1), (#102 at task.jl:259, 1)]))
$(Expr(:escape, :(tf_version(kind=:julia)))) = v"0.10.1+"

-------------
Python Status
-------------
$(Expr(:escape, :(PyCall.conda))) = false
$(Expr(:escape, :(ENV["PYTHON"]))) = "/usr/bin/python"
$(Expr(:escape, :(PyCall.PYTHONHOME))) = "/usr:/usr"
Trying to evaluate readstring(#= /root/.julia/packages/TensorFlow/W6Dwj/src/version.jl:101 =# @cmd("pip --version")) but got error: UndefVarError(:readstring)
Trying to evaluate readstring(#= /root/.julia/packages/TensorFlow/W6Dwj/src/version.jl:102 =# @cmd("pip3 --version")) but got error: UndefVarError(:readstring)

------------
Julia Status
------------
Julia Version 1.0.0
Commit 5d4eaca0c9 (2018-08-08 20:58 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
  CPU: Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-6.0.0 (ORCJIT, skylake)
julia> minimize_op = train.minimize(optimizer, Loss)
ERROR: On worker 2:
UndefVarError: py_gradients not defined
#11 at /root/.julia/packages/TensorFlow/W6Dwj/src/TensorFlow.jl:181
#116 at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.0/Distributed/src/process_messages.jl:276
run_work_thunk at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.0/Distributed/src/process_messages.jl:56
run_work_thunk at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.0/Distributed/src/process_messages.jl:65
#102 at ./task.jl:259
Stacktrace:
 [1] #remotecall_wait#154(::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::Function, ::Function, ::Distributed.Worker) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.0/Distributed/src/remotecall.jl:407
 [2] remotecall_wait(::Function, ::Distributed.Worker) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.0/Distributed/src/remotecall.jl:398
 [3] #remotecall_wait#157(::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::Function, ::Function, ::Int64) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.0/Distributed/src/remotecall.jl:419
 [4] remotecall_wait(::Function, ::Int64) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.0/Distributed/src/remotecall.jl:419
 [5] top-level scope at /root/.julia/packages/TensorFlow/W6Dwj/src/TensorFlow.jl:180
 [6] eval at ./boot.jl:319 [inlined]
 [7] eval at ./sysimg.jl:68 [inlined]
 [8] add_gradients_py(::Tensor{Float64}, ::Array{Any,1}, ::Nothing) at /root/.julia/packages/TensorFlow/W6Dwj/src/core.jl:1545
 [9] gradients at /root/.julia/packages/TensorFlow/W6Dwj/src/core.jl:1533 [inlined] (repeats 2 times)
 [10] compute_gradients(::TensorFlow.train.AdamOptimizer, ::Tensor{Float64}, ::Nothing) at /root/.julia/packages/TensorFlow/W6Dwj/src/train.jl:49
 [11] #minimize#1(::Nothing, ::Nothing, ::Nothing, ::Function, ::TensorFlow.train.AdamOptimizer, ::Tensor{Float64}) at /root/.julia/packages/TensorFlow/W6Dwj/src/train.jl:41
 [12] minimize(::TensorFlow.train.AdamOptimizer, ::Tensor{Float64}) at /root/.julia/packages/TensorFlow/W6Dwj/src/train.jl:38
 [13] top-level scope at none:0

metanoid avatar Sep 23 '18 19:09 metanoid

I wonder if this is an upstream problem with the new package manager, since PyCall is clearly there in REQUIRES.

malmaud avatar Sep 24 '18 15:09 malmaud

Currently getting this problem with py_gradients not defined when using TensorFlow with XLA

NTimmons avatar Jan 29 '19 19:01 NTimmons

#493 will fix the need to manually install PyCall

oxinabox avatar Jan 29 '19 20:01 oxinabox

Yes, missing PyCall is only one of the reasons a worker might be dying. This is unfortunately not an easy one to debug.

oxinabox avatar Jan 29 '19 21:01 oxinabox

I am getting same: UndefVarError: py_gradients not defined #9 at /home/jack/.julia/packages/TensorFlow/q9pY2/src/TensorFlow.jl:189 With Julia 1.1 and Tensorflow 1.13.0

jackvice avatar Feb 02 '19 01:02 jackvice