Revise.jl doesn't appear to do anything

I have a project called VCLR, and am trying to get Revise.jl to work, but it seems like it doesn’t do anything at all.

I have a folder structure like this:

VCLR
├── data
│   └── ... data files ...
├── Project.toml
├── README.md
├── src
│   └── VCLR.jl
│   └── ... lots of other files ...

With Project.toml

name = "VCLR"
uuid = "87991b44-5e96-4a8e-9f69-41755a642646"
authors = ["Alice Ryhl <alice@ryhl.io>"]
version = "0.1.0"

[deps]
DataStructures = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8"
GLM = "38e38edf-8417-5370-95a0-9cbb8c7f171a"
Gurobi = "2e9cd046-0924-5485-92f1-d5272153d98b"
JuMP = "4076af6c-e467-56ae-b986-b466b2749572"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
Revise = "295af30f-e4ad-537b-8983-00126c2a3abe"

With my current directory in the top-level VCLR folder, I open the julia repl, and have the following interaction:

               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.5.3 (2020-11-09)
 _/ |\__'_|_|_|\__'_|  |  
|__/                   |

julia> using Revise

(@v1.5) pkg> activate .
 Activating environment at `~/src/VCLR/Project.toml`

julia> import VCLR 
[ Info: Precompiling VCLR [87991b44-5e96-4a8e-9f69-41755a642646]
Academic license - for non-commercial use only - expires 2021-03-05

julia> VCLR.foo()
ERROR: UndefVarError: foo not defined
Stacktrace:
 [1] top-level scope at REPL[4]:1
 [2] run_repl(::REPL.AbstractREPL, ::Any) at /build/julia/src/julia-1.5.3/usr/share/julia/stdlib/v1.5/REPL/src/REPL.jl:288

Now I follow the documentation for Revise.jl (link), which (I think) says that changes are immediately loaded when I save the file. I add a function to VCLR.jl.

module VCLR

... previous contents ...

function foo()
  println("Hi!")
end

end

However it doesn’t work.

julia> VCLR.foo()
ERROR: UndefVarError: foo not defined
Stacktrace:
 [1] top-level scope at REPL[4]:1
 [2] run_repl(::REPL.AbstractREPL, ::Any) at /build/julia/src/julia-1.5.3/usr/share/julia/stdlib/v1.5/REPL/src/REPL.jl:288

I also try to import it again:

julia> import VCLR

julia> VCLR.foo()
ERROR: UndefVarError: foo not defined
Stacktrace:
 [1] top-level scope at REPL[6]:1
 [2] run_repl(::REPL.AbstractREPL, ::Any) at /build/julia/src/julia-1.5.3/usr/share/julia/stdlib/v1.5/REPL/src/REPL.jl:288

Of course, restarting the repl makes it work:

               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.5.3 (2020-11-09)
 _/ |\__'_|_|_|\__'_|  |  
|__/                   |

(@v1.5) pkg> activate .
 Activating environment at `~/src/VCLR/Project.toml`

julia> import VCLR
[ Info: Precompiling VCLR [87991b44-5e96-4a8e-9f69-41755a642646]
Academic license - for non-commercial use only - expires 2021-03-05

julia> VCLR.foo()
Hi!

How can I incrementally develop my project without waiting an ungodly amount of time for every change while the REPL restarts?

Note that I am currently trying toa apply the advice from this thread. Before those changes, I had a setup that worked perfectly fine, since calling include("include.jl") from the REPL had no issues with reloading everything. However, unless it makes my development many times slower, I’d like to do it the right way.

Note: I did try to run ] dev VCLR in the pkg terminal like in the linked docs, but it emits an error about my package not being in the public package repository, which it indeed is not.

This does not answer your question, but one usually does not have Revise as a package dependency. Instead, Revise goes as a dependency into the startup environment (e.g. @v1.5). Otherwise, all dependencies of Revise get compiled even when the package is deployed (instead of being developed).

1 Like

Ah, I hadn’t even noticed that. The REPL must have added it when I tried to install Revise.

Okay, I’ve at least found a way to unblock myself. It seems like I can skip all the activate . and Revise.jl stuff and just do

include("src/VCLR.jl")
VCLR.foo()

Then include the file again on every change.

However, I’d still like to know how this Revise.jl stuff works.

I think you should activate, then do using Revise. That might help

I don’t think that’s necessary, if that was the case then you couldn’t have ‘using Revise’ in your startup file.

1 Like

I … uhh … I’m not sure what to make of this, but when I do that, Gurobi consistently fails with one of two outputs:

Output with segfault
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.5.3 (2020-11-09)
 _/ |\__'_|_|_|\__'_|  |  
|__/                   |

(@v1.5) pkg> activate .
 Activating environment at `~/src/VCLR/Project.toml`

julia> using Revise
[ Info: Precompiling Revise [295af30f-e4ad-537b-8983-00126c2a3abe]

julia> import VCLR
[ Info: Precompiling VCLR [87991b44-5e96-4a8e-9f69-41755a642646]
Academic license - for non-commercial use only - expires 2021-03-05
WARNING: could not import VCLRPerturbationMod.perturbation_heuristic into VCLR

julia> data = VCLR.Loaders.load_fsu("data/fsu-regression/x03.txt")
VCLR.Shared.Dataset(Array{Float64,N} where N[[39.0], [47.0], [45.0], [47.0], [65.0], [46.0], [67.0], [42.0], [67.0], [56.0]  …  [36.0], [50.0], [39.0], [21.0], [44.0], [53.0], [63.0], [29.0], [25.0], [69.0]], [144.0, 220.0, 138.0, 145.0, 162.0, 142.0, 170.0, 124.0, 158.0, 154.0  …  136.0, 142.0, 120.0, 120.0, 160.0, 158.0, 144.0, 130.0, 125.0, 175.0])

julia> VCLR.solve_vclr(data, 3)
Node 1 with dual 0.0

signal (11): Segmentation fault
in expression starting at REPL[5]:1
GRBgetmerrormsg at /usr/lib/libgurobi91.so (unknown line)
GRBgetmerrormsg at /home/alice/.julia/packages/Gurobi/0xAkW/src/gen91/libgrb_api.jl:810 [inlined]
_check_ret at /home/alice/.julia/packages/Gurobi/0xAkW/src/MOI_wrapper.jl:276 [inlined]
empty! at /home/alice/.julia/packages/Gurobi/0xAkW/src/MOI_wrapper.jl:329
Optimizer#5 at /home/alice/.julia/packages/Gurobi/0xAkW/src/MOI_wrapper.jl:252
Optimizer at /home/alice/.julia/packages/Gurobi/0xAkW/src/MOI_wrapper.jl:225
#7 at /home/alice/.julia/packages/JuMP/qhoVb/src/JuMP.jl:125
_instantiate_and_check at /home/alice/.julia/packages/MathOptInterface/ZJFKw/src/instantiate.jl:56
unknown function (ip: 0x7fc5e9acc451)
#instantiate#23 at /home/alice/.julia/packages/MathOptInterface/ZJFKw/src/instantiate.jl:107
unknown function (ip: 0x7fc5e9acc077)
instantiate##kw at /home/alice/.julia/packages/MathOptInterface/ZJFKw/src/instantiate.jl:107
#set_optimizer#99 at /home/alice/.julia/packages/JuMP/qhoVb/src/optimizer_interface.jl:66
set_optimizer##kw at /home/alice/.julia/packages/JuMP/qhoVb/src/optimizer_interface.jl:61 [inlined]
#Model#14 at /home/alice/.julia/packages/JuMP/qhoVb/src/JuMP.jl:235
unknown function (ip: 0x7fc5e9acbd16)
Model at /home/alice/.julia/packages/JuMP/qhoVb/src/JuMP.jl:234 [inlined]
CLRMasterProblem at /home/alice/src/VCLR/src/Shared/master_problem.jl:37
unknown function (ip: 0x7fc5e9ac4516)
optimize! at /home/alice/src/VCLR/src/Shared/branch_and_bound.jl:69
solve_vclr at /home/alice/src/VCLR/src/VCLR.jl:27
unknown function (ip: 0x7fc5e9ab0d48)
unknown function (ip: 0x7fc64ab65735)
unknown function (ip: 0x7fc64ab653be)
unknown function (ip: 0x7fc64ab65f00)
unknown function (ip: 0x7fc64ab669b0)
unknown function (ip: 0x7fc64ab82cf1)
unknown function (ip: 0x7fc64ab83398)
unknown function (ip: 0x7fc64ab83398)
jl_toplevel_eval_in at /usr/bin/../lib/libjulia.so.1 (unknown line)
unknown function (ip: 0x7fc639e2eb41)
unknown function (ip: 0x7fc63988e46e)
unknown function (ip: 0x7fc63988eac0)
unknown function (ip: 0x7fc63989258a)
unknown function (ip: 0x7fc6398b4b47)
run_repl at /build/julia/src/julia-1.5.3/usr/share/julia/stdlib/v1.5/REPL/src/REPL.jl:288
unknown function (ip: 0x7fc639af3c1f)
unknown function (ip: 0x7fc639af3cf8)
unknown function (ip: 0x7fc64ab5c3e4)
jl_f__apply_latest at /usr/bin/../lib/libjulia.so.1 (unknown line)
unknown function (ip: 0x7fc639b0d937)
unknown function (ip: 0x7fc639b1b707)
unknown function (ip: 0x7fc639b1c99e)
unknown function (ip: 0x7fc639b1caf5)
unknown function (ip: 0x55f3a80504fe)
unknown function (ip: 0x55f3a80500a7)
__libc_start_main at /usr/bin/../lib/libc.so.6 (unknown line)
unknown function (ip: 0x55f3a805015d)
Allocations: 46106181 (Pool: 46093856; Big: 12325); GC: 42
zsh: segmentation fault (core dumped)  julia
Output with error 10002
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.5.3 (2020-11-09)
 _/ |\__'_|_|_|\__'_|  |  
|__/                   |

(@v1.5) pkg> activate .
 Activating environment at `~/src/VCLR/Project.toml`

julia> import VCLR

julia> data = VCLR.Loaders.load_fsu("data/fsu-regression/x03.txt")
VCLR.Shared.Dataset(Array{Float64,N} where N[[39.0], [47.0], [45.0], [47.0], [65.0], [46.0], [67.0], [42.0], [67.0], [56.0]  …  [36.0], [50.0], [39.0], [21.0], [44.0], [53.0], [63.0], [29.0], [25.0], [69.0]], [144.0, 220.0, 138.0, 145.0, 162.0, 142.0, 170.0, 124.0, 158.0, 154.0  …  136.0, 142.0, 120.0, 120.0, 160.0, 158.0, 144.0, 130.0, 125.0, 175.0])

julia> VCLR.solve_vclr(data, 3)
Node 1 with dual 0.0
ERROR: Gurobi Error 10002: 
Stacktrace:
 [1] _check_ret at /home/alice/.julia/packages/Gurobi/0xAkW/src/MOI_wrapper.jl:277 [inlined]
 [2] empty!(::Gurobi.Optimizer) at /home/alice/.julia/packages/Gurobi/0xAkW/src/MOI_wrapper.jl:329
 [3] Gurobi.Optimizer(::Gurobi.Env; kwargs::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at /home/alice/.julia/packages/Gurobi/0xAkW/src/MOI_wrapper.jl:252
 [4] Gurobi.Optimizer(::Gurobi.Env) at /home/alice/.julia/packages/Gurobi/0xAkW/src/MOI_wrapper.jl:225
 [5] (::JuMP.var"#7#10"{DataType,Tuple{Gurobi.Env}})() at /home/alice/.julia/packages/JuMP/qhoVb/src/JuMP.jl:125
 [6] _instantiate_and_check(::JuMP.var"#7#10"{DataType,Tuple{Gurobi.Env}}) at /home/alice/.julia/packages/MathOptInterface/ZJFKw/src/instantiate.jl:56
 [7] instantiate(::Function; with_bridge_type::Type{Float64}, with_names::Bool) at /home/alice/.julia/packages/MathOptInterface/ZJFKw/src/instantiate.jl:107
 [8] set_optimizer(::JuMP.Model, ::Function; bridge_constraints::Bool) at /home/alice/.julia/packages/JuMP/qhoVb/src/optimizer_interface.jl:66
 [9] JuMP.Model(::Function; bridge_constraints::Bool, kwargs::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at /home/alice/.julia/packages/JuMP/qhoVb/src/JuMP.jl:235
 [10] Model at /home/alice/.julia/packages/JuMP/qhoVb/src/JuMP.jl:234 [inlined]
 [11] VCLR.Shared.CLRMasterProblemMod.CLRMasterProblem{VCLR.VCLR.VCLRSubProblem}(::VCLR.Shared.Dataset, ::VCLR.VCLR.VCLRInstance, ::VCLR.Shared.ClusterSet, ::VCLR.Shared.ConstraintSet) at /home/alice/src/VCLR/src/Shared/master_problem.jl:37
 [12] optimize!(::VCLR.Shared.CLRBranchAndBoundMod.CLRBranchAndBound{VCLR.VCLR.VCLRSubProblem}) at /home/alice/src/VCLR/src/Shared/branch_and_bound.jl:69
 [13] solve_vclr(::VCLR.Shared.Dataset, ::Int64) at /home/alice/src/VCLR/src/VCLR.jl:27
 [14] top-level scope at REPL[4]:1
 [15] run_repl(::REPL.AbstractREPL, ::Any) at /build/julia/src/julia-1.5.3/usr/share/julia/stdlib/v1.5/REPL/src/REPL.jl:288

It works perfectly fine when I paste

include("src/VCLR.jl")
data = VCLR.Loaders.load_fsu("data/fsu-regression/x03.txt")
VCLR.solve_vclr(data, 3)

into my terminal.

To be clear, the above failures are consistent (well it picks one of the two randomly), and it works consistently without Revise.

Yes, I would have asked about that if I didn’t run into this…

I see two changes, though. In the first, you simply to include("src/VCLR.jl").

In the second, you add in Revise and do import VCLR. Can you do import VCLR without Revise?

Hmm, you are right, that also fails:

               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.5.3 (2020-11-09)
 _/ |\__'_|_|_|\__'_|  |  
|__/                   |

(@v1.5) pkg> activate .
 Activating environment at `~/src/VCLR/Project.toml`

julia> import VCLR

julia> data = VCLR.Loaders.load_fsu("data/fsu-regression/x03.txt")
VCLR.Shared.Dataset(Array{Float64,N} where N[[39.0], [47.0], [45.0], [47.0], [65.0], [46.0], [67.0], [42.0], [67.0], [56.0]  …  [36.0], [50.0], [39.0], [21.0], [44.0], [53.0], [63.0], [29.0], [25.0], [69.0]], [144.0, 220.0, 138.0, 145.0, 162.0, 142.0, 170.0, 124.0, 158.0, 154.0  …  136.0, 142.0, 120.0, 120.0, 160.0, 158.0, 144.0, 130.0, 125.0, 175.0])

julia> VCLR.solve_vclr(data, 3)
Node 1 with dual 0.0
ERROR: Gurobi Error 10002: 
Stacktrace:
 [1] _check_ret at /home/alice/.julia/packages/Gurobi/0xAkW/src/MOI_wrapper.jl:277 [inlined]
 [2] empty!(::Gurobi.Optimizer) at /home/alice/.julia/packages/Gurobi/0xAkW/src/MOI_wrapper.jl:329
 [3] Gurobi.Optimizer(::Gurobi.Env; kwargs::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at /home/alice/.julia/packages/Gurobi/0xAkW/src/MOI_wrapper.jl:252
 [4] Gurobi.Optimizer(::Gurobi.Env) at /home/alice/.julia/packages/Gurobi/0xAkW/src/MOI_wrapper.jl:225
 [5] (::JuMP.var"#7#10"{DataType,Tuple{Gurobi.Env}})() at /home/alice/.julia/packages/JuMP/qhoVb/src/JuMP.jl:125
 [6] _instantiate_and_check(::JuMP.var"#7#10"{DataType,Tuple{Gurobi.Env}}) at /home/alice/.julia/packages/MathOptInterface/ZJFKw/src/instantiate.jl:56
 [7] instantiate(::Function; with_bridge_type::Type{Float64}, with_names::Bool) at /home/alice/.julia/packages/MathOptInterface/ZJFKw/src/instantiate.jl:107
 [8] set_optimizer(::JuMP.Model, ::Function; bridge_constraints::Bool) at /home/alice/.julia/packages/JuMP/qhoVb/src/optimizer_interface.jl:66
 [9] JuMP.Model(::Function; bridge_constraints::Bool, kwargs::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at /home/alice/.julia/packages/JuMP/qhoVb/src/JuMP.jl:235
 [10] Model at /home/alice/.julia/packages/JuMP/qhoVb/src/JuMP.jl:234 [inlined]
 [11] VCLR.Shared.CLRMasterProblemMod.CLRMasterProblem{VCLR.VCLR.VCLRSubProblem}(::VCLR.Shared.Dataset, ::VCLR.VCLR.VCLRInstance, ::VCLR.Shared.ClusterSet, ::VCLR.Shared.ConstraintSet) at /home/alice/src/VCLR/src/Shared/master_problem.jl:37
 [12] optimize!(::VCLR.Shared.CLRBranchAndBoundMod.CLRBranchAndBound{VCLR.VCLR.VCLRSubProblem}) at /home/alice/src/VCLR/src/Shared/branch_and_bound.jl:69
 [13] solve_vclr(::VCLR.Shared.Dataset, ::Int64) at /home/alice/src/VCLR/src/VCLR.jl:27
 [14] top-level scope at REPL[4]:1
 [15] run_repl(::REPL.AbstractREPL, ::Any) at /build/julia/src/julia-1.5.3/usr/share/julia/stdlib/v1.5/REPL/src/REPL.jl:288

So this has nothing to do with Revise.

Can you activate the project and then do include? My guess is that the version of Gurobi in your global environment is different than the one in your local environment. `

3 Likes

Yes, activate followed by include works. The first time I did that, it recompiled all of my dependencies, and when I got back with another cup of coffee, it had started running successfully.

However, even after that recompilation, it still emits the error from above when I use import VCLR rather than the include(...).

How do I make sure everything is up-to-date and the same version?

Okay. Thanks for doing this. We’ve pinpointed your problem.

I want to emphasize that even though it isn’t always explicitly stated, when working on a project it is super important to always make sure you are working in the project’s environment and using Revise.

If you are using linux or mac, you can start julia with julia --project. Otherwise, you can put some code in your startup.jl that does this for you.

Revise is also essential. Being able to make changes without reloading the module makes your life a lot easier. Additionally, include-ing a file which defines a module over and over again can cause some frustrating bugs.

You need to go to your default environment — the one that is loaded when you start julia without --project or anything, and determine which version of Gurobi you are using. You do this with ] st

Then, start julia in your VCLR environment (with --project or activate) and do ] add Gurobi@(version number you found)

You might be in “compatability hell” for a bit here. Perhaps some packages in your local environment aren’t compatible with the version of Gurobi you want to add. That’s okay.

If you run into too many problems this way, you can copy and paste the Project.toml file from your default environment into your local environment.

Then you can just remove extraneous packages until your list of packages matches the one in your original local project.toml.

1 Like

Thanks! That post has a lot of tricks I didn’t know about.

Okay so I downgraded Gurobi from 0.9.8 to 0.9.6, and now it looks like this:

(VoronoiCLR) pkg> st
Project VCLR v0.1.0
Status `~/src/VCLR/Project.toml`
  [864edb3b] DataStructures v0.18.9
  [38e38edf] GLM v1.3.11
  [2e9cd046] Gurobi v0.9.6
  [4076af6c] JuMP v0.21.5
  [9a3f8284] Random
(@v1.5) pkg> st
Status `~/.julia/environments/v1.5/Project.toml`
  [c52e3926] Atom v0.12.21
  [336ed68f] CSV v0.8.2
  [a93c6f00] DataFrames v0.22.2
  [864edb3b] DataStructures v0.18.8
  [38e38edf] GLM v1.3.11
  [60bf3e95] GLPK v0.13.0
  [2e9cd046] Gurobi v0.9.6
  [4076af6c] JuMP v0.21.5
  [e5e0dc1b] Juno v0.8.3
  [295af30f] Revise v1.0.3
  [90137ffa] StaticArrays v0.12.4
  [bd369af6] Tables v1.2.2

I have also double-checked that all UUIDs in the two Project.toml files match.

However it still fails in the same way. Can I clear the precompiled artifacts in some way?

Hmm…

I’m not 100% sure if that’s the problem, and if it were the problem, what the solution would be.

You could try ] instantiate in your local project environment. You could also do ] build VCLR

Also, I’m not sure you’ve actually solved the original problem. Is there a reason why you have a larger folder, VoronoiCLR and then have a separate subfolder in src containing the module code for VCLR?

Why not just have a volder called VCLR on its own?

The problem appears to have to do with a global constant I define like this:

const GRB_ENV = Gurobi.Env()
GRBsetintparam(GRB_ENV, "OutputFlag", 0)

and then pass to my model on initialization. If I don’t pass this global, it works fine.

1 Like

I’m unable to help with Gurobi-specific problems. But I’m glad you found the solution!

In the future, remember how important it is to make sure you use Revise and a local environment.

I think you still have a bit more work to do, though, in re-organizing your code base. Your VoronoiCLR/src/VCLR/Project.toml folder structure is not common, but is a structure that can be useful in some circumstances, namely sub-modules.

Okay great, so passing the gurobi environment around as an argument rather than a global variable seems to have fixed the issues.

The Revise.jl thing still doesn’t seem to work though. Am I supposed to do anything to tell it to load my changes? Can I inspect its state somehow?

One possibility is that Revise isn’t working because you have a non-standard folder structure. You should make sure that you start Julia in the VCLR folder that has the structure

.
└── VCLR
    ├── Project.toml
    └── src
        └── VCLR.jl

I think Revise (and lots of internals of Pkg) assume that kind of folder structure. Don’t start Julia in the VoronoiCLR folder as you were doing above.

To test that Revise is working, just add a little function

function helloworld(x)
    println("hello, world")
end

and then try and call VCLR.helloworld(1). It should work. Then delete the function and see if Revise noticed that it was deleted as well (it should).

1 Like

Okay, I have simplified the structure a bit, but it still doesn’t seem to work. Now it looks like this:

/home/alice/src/VoronoiCLR
├── data
│   └── ...
├── Manifest.toml
├── Project.toml
├── README.md
├── src
│   ├── CLR
│   │   ├── CLR.jl
│   │   ├── ...
│   ├── delaunay.jl
│   ├── Generators
│   │   ├── Generators.jl
│   │   └── ...
│   ├── Loaders
│   │   ├── Loaders.jl
│   │   └── ...
│   ├── Shared
│   │   ├── Shared.jl
│   │   └── ...
│   ├── VCLR
│   │   ├── VCLR.jl
│   │   └── ...
│   └── VoronoiCLR.jl
name = "VoronoiCLR"
uuid = "87991b44-5e96-4a8e-9f69-41755a642646"
authors = ["Alice Ryhl <alice@ryhl.io>"]
version = "0.1.0"

[deps]
DataStructures = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8"
GLM = "38e38edf-8417-5370-95a0-9cbb8c7f171a"
Gurobi = "2e9cd046-0924-5485-92f1-d5272153d98b"
JuMP = "4076af6c-e467-56ae-b986-b466b2749572"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"

I have then cleared /home/alice/src/VoronoiCLR/src/VoronoiCLR.jl so it only contains a module:

module VoronoiCLR

end

Now running the terminal:

$ pwd 
/home/alice/src/VoronoiCLR
$ julia --project
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.5.3 (2020-11-09)
 _/ |\__'_|_|_|\__'_|  |  
|__/                   |

julia> using Revise

julia> import VoronoiCLR
[ Info: Precompiling VoronoiCLR [87991b44-5e96-4a8e-9f69-41755a642646]

julia> VoronoiCLR.helloworld(1)
ERROR: UndefVarError: helloworld not defined
Stacktrace:
 [1] top-level scope at REPL[3]:1
 [2] run_repl(::REPL.AbstractREPL, ::Any) at /build/julia/src/julia-1.5.3/usr/share/julia/stdlib/v1.5/REPL/src/REPL.jl:288

Then adding your helloworld function to /home/alice/src/VoronoiCLR/src/VoronoiCLR.jl, resulting in this:

module VoronoiCLR

function helloworld(x)
    println("hello, world")
end

end

However trying to call it still doesn’t work. This is in the same terminal as above, including a call to read to make it clear that the function really has been added.

julia> read("./src/VoronoiCLR.jl", String)
"module VoronoiCLR\n\nfunction helloworld(x)\n    println(\"hello, world\")\nend\n\nend\n"

julia> VoronoiCLR.helloworld(1)
ERROR: UndefVarError: helloworld not defined
Stacktrace:
 [1] top-level scope at REPL[6]:1
 [2] run_repl(::REPL.AbstractREPL, ::Any) at /build/julia/src/julia-1.5.3/usr/share/julia/stdlib/v1.5/REPL/src/REPL.jl:288

I’m not sure what the issue is here. Things works for me (here on 1.6 but should be the same on 1.5):

❯ julia16 -q
(@v1.6) pkg> st
      Status `C:\Users\Jeremy\.julia\environments\v1.6\Project.toml`
  [6e4b80f9] BenchmarkTools v0.5.0
  [4c0ca9eb] Gtk v1.1.5
  [6218d12a] ImageMagick v1.1.6
  [86fae568] ImageView v0.10.13
  [916415d5] Images v0.23.3
  [5fb14364] OhMyREPL v0.5.10
  [1dea7af3] OrdinaryDiffEq v5.50.0
  [295af30f] Revise v3.1.11

julia> using Revise

(@v1.6) pkg> activate "C:\Users\SomePath\Ditto"
  Activating environment at `C:\Users\SomePath\Ditto\Project.toml`

julia> using Ditto
[ Info: Precompiling Ditto [38516915-fba7-4209-b88c-55e2a7b2e272]

julia> Ditto.foo()
ERROR: MethodError: no method matching foo()
Stacktrace:
 [1] top-level scope
   @ REPL[5]:1

julia> Ditto.foo() # after adding the function and saving
4

(Ditto) pkg> st
     Project Ditto v0.1.0
      Status `C:\Users\SomePath\Ditto\Project.toml`
  [cd3eb016] HTTP v0.9.2
  [ea8e919c] SHA
  [6462fe0b] Sockets