Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ERROR: UndefVarError: iscall not defined at startup #62

Closed
tencnivel opened this issue Nov 1, 2021 · 7 comments
Closed

ERROR: UndefVarError: iscall not defined at startup #62

tencnivel opened this issue Nov 1, 2021 · 7 comments

Comments

@tencnivel
Copy link

When starting the julia session using C-c C-z from a julia file buffer

               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.6.3 (2021-09-23)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release
|__/                   |

julia> JuliaSnail.start(10011); # please wait, time-to-first-plot...
ERROR: UndefVarError: iscall not defined
Stacktrace:
 [1] (::Main.JuliaSnail.CST.var"#1#2"{String, Dict{Any, Any}})(node::CSTParser.EXPR, modules::Vector{Any})
   @ Main.JuliaSnail.CST ~/.emacs.d/elpa/julia-snail-20210818.310/JuliaSnail.jl:535
 [2] (::Main.JuliaSnail.CST.var"#1#2"{String, Dict{Any, Any}})(node::CSTParser.EXPR)
   @ Main.JuliaSnail.CST ~/.emacs.d/elpa/julia-snail-20210818.310/JuliaSnail.jl:534
 [3] includesin(encodedbuf::String, path::String)
   @ Main.JuliaSnail.CST ~/.emacs.d/elpa/julia-snail-20210818.310/JuliaSnail.jl:547
 [4] includesin
   @ ~/.emacs.d/elpa/julia-snail-20210818.310/JuliaSnail.jl:529 [inlined]
 [5] forcecompile
   @ ~/.emacs.d/elpa/julia-snail-20210818.310/JuliaSnail.jl:565 [inlined]
 [6] start(port::Int64)
   @ Main.JuliaSnail ~/.emacs.d/elpa/julia-snail-20210818.310/JuliaSnail.jl:686
 [7] top-level scope
   @ REPL[1]:1
@gcv
Copy link
Owner

gcv commented Nov 2, 2021

What version of CSTParser do you have installed in your Julia environment? In a fresh session of the Snail REPL, run the following:

Pkg.activate(LOAD_PATH[end]); Pkg.status()

What is the output?

@tencnivel
Copy link
Author

tencnivel commented Nov 2, 2021

Apparently CSTParser was not downloaded.
I instantiated JuliaSnail.jl and tried to relaunch julia-snail, but same error.
There is also a timed-out message in the 'Messages' buffer (see below) and the VTerm opened by julia-snail is opened at the location of my home directory instead of the directory where the julia file is.

Output from the REPL buffer

julia> LOAD_PATH[end]
"/home/myuser/.emacs.d/elpa/julia-snail-20210818.310"

julia> using Pkg

julia> Pkg.activate(LOAD_PATH[end])
  Activating environment at `~/.emacs.d/elpa/julia-snail-20210818.310/Project.toml`

julia> Pkg.status()
      Status `~/.emacs.d/elpa/julia-snail-20210818.310/Project.toml`
→ [00ebfdb7] CSTParser v3.2.3
        Info packages marked with → not downloaded, use `instantiate` to download

(julia-snail-20210818.310) pkg> instantiate
   Installed CSTParser ─ v3.2.3
┌ Debug: Creating new cache for "/home/myuser/.emacs.d/elpa/julia-snail-20210818.310/Manifest.toml"
└ @ Base loading.jl:225
┌ Debug: Rejecting cache file /home/myuser/.julia/compiled/v1.6/Tokenize/7Oi97_b8jdf.ji because it is for file /home/myuser/.julia/packages/Tokenize/FGrTw/src/Tokenize.jl) not file /home/myuser/.julia/packages/Tokenize/kKojO/src/Tokenize.jl
└ @ Base loading.jl:1770
┌ Debug: Rejecting cache file /home/myuser/.julia/compiled/v1.6/Tokenize/7Oi97_giU3j.ji due to it containing an invalid cache header
└ @ Base loading.jl:1719
Precompiling project...
  ✓ Tokenize
  ✓ CSTParser
  2 dependencies successfully precompiled in 6 seconds
  2 dependencies precompiled but different versions are currently loaded. Restart julia to access the new versions

(julia-snail-20210818.310) pkg>

Output from the 'Messages' buffer:

Starting Julia process and loading Snail...
Snail connecting to Julia process, attempt 1/5...
Snail connected to Julia. Happy hacking!
julia-snail--send-to-server: Snail command timed out

@gcv
Copy link
Owner

gcv commented Nov 2, 2021

Looks like you have CSTParser already installed in your global Julia environment, which conflicts with the version Snail tries to install. You probably have something from the v2 series, while Snail requires v3.

Remove CSTParser and Tokenize from your global environment and try to restart Snail.

I should try to make Snail more resilient for when this occurs. At least an informative error message would be nice. :)

Meanwhile, why do you have CSTParser explicitly installed in your global environment? Were you hacking on it? Or did another tool install it? I thought most tools which depend on it have the grace to keep it isolated (as Snail does), but maybe not.

@tencnivel
Copy link
Author

tencnivel commented Nov 2, 2021

Atom installed it and the Project.toml of Atom.jl has the following compat definition:

[compat]
CSTParser = "=1.1.0, ^2"

What would you recommend?
Install CSTParser v3 in my global environment together with CSTParser v2? I have to keep Atom

@gcv
Copy link
Owner

gcv commented Nov 3, 2021

I was thinking about how to deal with tooling which leaves conflicting litter in the global environment, and I may have a solution. Commit 74aa827 on branch https://github.com/gcv/julia-snail/tree/fix-load-path-order.

Could you try running Julia from that branch? If you don't use an Emacs package manager or extension which can install arbitrary branches (such as Quelpa or Straight.el), the easiest way is to replace the JuliaSnail.jl file in your Snail installation with https://raw.githubusercontent.com/gcv/julia-snail/fix-load-path-order/JuliaSnail.jl (only the Julia side changed which makes this possible).

It just changes the LOAD_PATH order at startup so that Snail's dependencies load first, and then restores it.

@tencnivel
Copy link
Author

Using JuliaSnail.jl from branch https://raw.githubusercontent.com/gcv/julia-snail/fix-load-path-order/JuliaSnail.jl fixed the problem.

@gcv
Copy link
Owner

gcv commented Nov 4, 2021

Branch merged into master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants