TensorFlow Issue with Logistic Regression Example

After a fresh installation of Julia on CentOS 7.2, I added TensorFlow, ran the “basic usage” test in README.md and passed it. Then, after installing also the Distributions and Printf packages, I tried to run the “logistic regression example” in the same README and, when I executed minimize_op = train.minimize(optimizer, Loss), I got an error claiming PyCall is not found in current path (see snippet below).

ERROR: On worker 2:
LoadError: ArgumentError: Package PyCall not found in current path:
- Run `import Pkg; Pkg.add("PyCall")` to install the PyCall package.

require at ./loading.jl:823
include at ./boot.jl:317 [inlined]
include_relative at ./loading.jl:1044
include at ./sysimg.jl:29
include at ./client.jl:392
#5 at /home/adude/.julia/packages/TensorFlow/q9pY2/src/TensorFlow.jl:160
#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
in expression starting at /home/adude/.julia/packages/TensorFlow/q9pY2/src/py.jl:1
Stacktrace:
 [1] #remotecall_wait#154(::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::Function, ::Function, ::Distributed.Worker, ::String) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.0/Distributed/src/remotecall.jl:421
 [2] remotecall_wait(::Function, ::Distributed.Worker, ::String) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.0/Distributed/src/remotecall.jl:412
 [3] #remotecall_wait#157(::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::Function, ::Function, ::Int64, ::String) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.0/Distributed/src/remotecall.jl:433
 [4] remotecall_wait(::Function, ::Int64, ::String) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.0/Distributed/src/remotecall.jl:433
 [5] top-level scope at /home/adude/.julia/packages/TensorFlow/q9pY2/src/TensorFlow.jl:159
 [6] eval at ./boot.jl:319 [inlined]
 [7] eval at ./sysimg.jl:68 [inlined]
 [8] #load_python_process#1(::Bool, ::Function) at /home/adude/.julia/packages/TensorFlow/q9pY2/src/TensorFlow.jl:156
 [9] load_python_process at /home/adude/.julia/packages/TensorFlow/q9pY2/src/TensorFlow.jl:149 [inlined]
 [10] macro expansion at /home/adude/.julia/packages/TensorFlow/q9pY2/src/TensorFlow.jl:187 [inlined]
 [11] add_gradients_py(::Tensor{Float64}, ::Array{Any,1}, ::Nothing) at /home/adude/.julia/packages/TensorFlow/q9pY2/src/core.jl:1548
 [12] gradients at /home/adude/.julia/packages/TensorFlow/q9pY2/src/core.jl:1536 [inlined] (repeats 2 times)
 [13] compute_gradients(::TensorFlow.train.AdamOptimizer, ::Tensor{Float64}, ::Nothing) at /home/adude/.julia/packages/TensorFlow/q9pY2/src/train.jl:49
 [14] #minimize#1(::Nothing, ::Nothing, ::Nothing, ::Function, ::TensorFlow.train.AdamOptimizer, ::Tensor{Float64}) at /home/adude/.julia/packages/TensorFlow/q9pY2/src/train.jl:41
 [15] minimize(::TensorFlow.train.AdamOptimizer, ::Tensor{Float64}) at /home/adude/.julia/packages/TensorFlow/q9pY2/src/train.jl:38
 [16] top-level scope at none:0

Scratching my head, I subsequently added PyCall and re-ran the logistic regression example. Again I was thrown an error at minimize_op = train.minimize(optimizer, Loss), however this time the error stated that py_gradients is not defined (see folowing snippet). How can it be? Any idea on how to fix it?

ERROR: On worker 2:
UndefVarError: py_gradients not defined
#13 at /home/adude/.julia/packages/TensorFlow/q9pY2/src/TensorFlow.jl:189
#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:421
 [2] remotecall_wait(::Function, ::Distributed.Worker) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.0/Distributed/src/remotecall.jl:412
 [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:433
 [4] remotecall_wait(::Function, ::Int64) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.0/Distributed/src/remotecall.jl:433
 [5] top-level scope at /home/adude/.julia/packages/TensorFlow/q9pY2/src/TensorFlow.jl:188
 [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 /home/adude/.julia/packages/TensorFlow/q9pY2/src/core.jl:1548
 [9] gradients at /home/adude/.julia/packages/TensorFlow/q9pY2/src/core.jl:1536 [inlined] (repeats 2 times)
 [10] compute_gradients(::TensorFlow.train.AdamOptimizer, ::Tensor{Float64}, ::Nothing) at /home/adude/.julia/packages/TensorFlow/q9pY2/src/train.jl:49
 [11] #minimize#1(::Nothing, ::Nothing, ::Nothing, ::Function, ::TensorFlow.train.AdamOptimizer, ::Tensor{Float64}) at /home/adude/.julia/packages/TensorFlow/q9pY2/src/train.jl:41
 [12] minimize(::TensorFlow.train.AdamOptimizer, ::Tensor{Float64}) at /home/adude/.julia/packages/TensorFlow/q9pY2/src/train.jl:38
 [13] top-level scope at none:0

I even tried to kill process 2 (rmprocs(2)), but kept facing an error at the same place:

ERROR: ProcessExitedException()
Stacktrace:
 [1] worker_from_id(::Distributed.ProcessGroup, ::Int64) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.0/Distributed/src/cluster.jl:973
 [2] worker_from_id at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.0/Distributed/src/cluster.jl:970 [inlined]
 [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:433
 [4] remotecall_wait(::Function, ::Int64) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.0/Distributed/src/remotecall.jl:433
 [5] top-level scope at /home/adude/.julia/packages/TensorFlow/q9pY2/src/TensorFlow.jl:188
 [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 /home/adude/.julia/packages/TensorFlow/q9pY2/src/core.jl:1548
 [9] gradients at /home/adude/.julia/packages/TensorFlow/q9pY2/src/core.jl:1536 [inlined] (repeats 2 times)
 [10] compute_gradients(::TensorFlow.train.AdamOptimizer, ::Tensor{Float64}, ::Nothing) at /home/adude/.julia/packages/TensorFlow/q9pY2/src/train.jl:49
 [11] #minimize#1(::Nothing, ::Nothing, ::Nothing, ::Function, ::TensorFlow.train.AdamOptimizer, ::Tensor{Float64}) at /home/adude/.julia/packages/TensorFlow/q9pY2/src/train.jl:41
 [12] minimize(::TensorFlow.train.AdamOptimizer, ::Tensor{Float64}) at /home/adude/.julia/packages/TensorFlow/q9pY2/src/train.jl:38
 [13] top-level scope at none:0

If you are making a bug report, please copy and paste the output of the following Julia snippet into the issue:

using TensorFlow
tf_version()

Wording: Please copy-paste the entirely of the below output into any bug reports.
Note that this may display some errors, depending upon on your configuration. This is fine.

----------------
Library Versions
----------------
Trying to evaluate ENV["TF_USE_GPU"] but got error: KeyError("TF_USE_GPU")
Trying to evaluate ENV["LIBTENSORFLOW"] but got error: KeyError("LIBTENSORFLOW")

tf_version(kind=:backend) = 1.12.0
Trying to evaluate tf_version(kind=:python) but got error: RemoteException(2, CapturedException(UndefVarError(:py_tf), Any[(#9 at TensorFlow.jl:189, 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)]))
tf_version(kind=:julia) = 0.11.0

-------------
Python Status
-------------
PyCall.conda = false
Trying to evaluate ENV["PYTHON"] but got error: KeyError("PYTHON")
PyCall.PYTHONHOME = /home/adude/anaconda3:/home/adude/anaconda3
String(read(#= /home/adude/.julia/packages/TensorFlow/q9pY2/src/version.jl:104 =# @cmd("pip --version"))) = pip 19.3.1 from /home/adude/anaconda3/lib/python3.6/site-packages/pip (python 3.6)

Trying to evaluate String(read(#= /home/adude/.julia/packages/TensorFlow/q9pY2/src/version.jl:105 =# @cmd("pip3 --version"))) but got error: Base.IOError("could not spawn `pip3 --version`: no such file or directory (ENOENT)", -2)

------------
Julia Status
------------
Julia Version 1.0.5
Commit 3af96bcefc (2019-09-09 19:06 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
  CPU: Intel(R) Xeon(R) CPU E5-2673 v3 @ 2.40GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-6.0.0 (ORCJIT, haswell)