Open schlichtanders opened 3 weeks ago
It seems the only way to actually fix this is to first add the RCall package (which will trigger precompilation of RCall) and then add the preferences like above.
I tried writing the LocalPreferences.toml directly, but it won't actually work, has_preferences
will simply show false as long as RCall is not a top-level dependency, even if the preferences are set inside LocalPreferences.toml
I think this setup is also desirable behavior -- I think it makes sense to require direct dependency for something you care enough about the details of to set a preference on.
The confusing part is on reading the preferences. Despite having LocalPreferences.toml filled with an entry for RCall, you will get the following divergent behaviour between UUID and package-name, if RCall is not added as a toplevel dependency.
julia> using Preferences, UUIDs
julia> RCALL_UUID = UUID("6f49c342-dc21-5d91-9882-a32aef131414")
julia> has_preference(RCALL_UUID, "Rhome")
false
julia> has_preference("RCall", "Rhome")
ERROR: ArgumentError: Cannot resolve package 'RCall' in load path; have you added the package as a top-level dependency?
Stacktrace:
[1] package_lookup_error(name::String)
@ Preferences ~/.julia/packages/Preferences/enLcN/src/utils.jl:88
[2] has_preference(name::String, key::String)
@ Preferences ~/.julia/packages/Preferences/enLcN/src/Preferences.jl:76
[3] top-level scope
@ REPL[8]:1
This might be relevant/helpful: https://github.com/JuliaPackaging/Preferences.jl/issues/53
Trying to define the preferences for RCall, I am running into an error. How to actually do this?