Skip to content

Running Tutorial(jupyter notebook) gives NameError #66

@tcluri

Description

@tcluri

This is an issue in setup of LightOSM.jl by following the tutorial jupyter notebook.

Steps I followed:

  1. Created a python virtual environment in my project directory.
  2. Pip installed pydeck using the forked version of deck.gl in the python virtual environment
  3. Created a Julia environment at the project level and installed PyCall.jl
  4. Set the PyCall build to the virtual environment python version(see screenshot)

pycall

After doing these, whenever it runs the pydeck part of building the layer and defining the tooltip I get the following.

PyError ($(Expr(:escape, :(ccall(#= /home/tcluri/.julia/packages/PyCall/7a7w0/src/pyfncall.jl:43 =# @pysym(:PyObject_Call), PyPtr, (PyPtr, PyPtr, PyPtr), o, pyargsptr, kw))))) <class 'NameError'>
NameError("name 'is_array' is not defined")
  File "/home/tcluri/projects/osmroute/.venv/lib/python3.8/site-packages/pydeck/bindings/layer.py", line 113, in __init__
    self.data = data
  File "/home/tcluri/projects/osmroute/.venv/lib/python3.8/site-packages/pydeck/bindings/layer.py", line 132, in data
    self._data = all_numpy_to_list(data_set)
  File "/home/tcluri/projects/osmroute/.venv/lib/python3.8/site-packages/pydeck/bindings/json_tools.py", line 94, in all_numpy_to_list
    if is_array(obj):


Stacktrace:
  [1] pyerr_check
    @ ~/.julia/packages/PyCall/7a7w0/src/exception.jl:62 [inlined]
  [2] pyerr_check
    @ ~/.julia/packages/PyCall/7a7w0/src/exception.jl:66 [inlined]
  [3] _handle_error(msg::String)
    @ PyCall ~/.julia/packages/PyCall/7a7w0/src/exception.jl:83
  [4] macro expansion
    @ ~/.julia/packages/PyCall/7a7w0/src/exception.jl:97 [inlined]
  [5] #107
    @ ~/.julia/packages/PyCall/7a7w0/src/pyfncall.jl:43 [inlined]
  [6] disable_sigint
    @ ./c.jl:458 [inlined]
  [7] __pycall!
    @ ~/.julia/packages/PyCall/7a7w0/src/pyfncall.jl:42 [inlined]
  [8] _pycall!(ret::PyObject, o::PyObject, args::Tuple{String, Vector{Dict{String, Any}}}, nargs::Int64, kw::PyObject)
    @ PyCall ~/.julia/packages/PyCall/7a7w0/src/pyfncall.jl:29
  [9] _pycall!(ret::PyObject, o::PyObject, args::Tuple{String, Vector{Dict{String, Any}}}, kwargs::Base.Iterators.Pairs{Symbol, Any, NTuple{14, Symbol}, NamedTuple{(:pickable, :opacity, :stroked, :filled, :line_width_min_pixels, :line_width_max_pixels, :line_width_scale, :auto_highlight, :get_position, :get_radius, :radius_scale, :get_line_width, :get_line_color, :get_fill_color), Tuple{Bool, Float64, Bool, Bool, Int64, Int64, Int64, Bool, Vector{String}, Int64, Int64, Int64, Vector{Int64}, Vector{Int64}}}})
    @ PyCall ~/.julia/packages/PyCall/7a7w0/src/pyfncall.jl:11
 [10] #_#114
    @ ~/.julia/packages/PyCall/7a7w0/src/pyfncall.jl:86 [inlined]
 [11] top-level scope
    @ In[25]:17
 [12] eval
    @ ./boot.jl:360 [inlined]
 [13] include_string(mapexpr::typeof(REPL.softscope), mod::Module, code::String, filename::String)
    @ Base ./loading.jl:1116

My understanding is that the PyCall.jl is taking the ubuntu system python(libdynload) and thus
not able to import the numpy array since it is not installed on a system level but present at the
python virtual environment level.

How do I fix it so it runs? What can be alternative methods(if any) like maybe using Conda.jl I can
try, that will run the tutorial code?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions