Agents OSM not working

All the methods in OSM submodule aren’t being recognised. However, the deprecated methods are recognised.

This is my help? output when I search for OSM.

help?> OSM
search: OSMSpace OSMAgent osm_road osm_latlon osm_plan_route osm_road_length osm_intersection osm_random_route! osm_is_stationary osm_map_coordinates osm_random_road_position gethostname

When I try to use any of the methods in OSM submodule, I get the error:

UndefVarError: OSM not defined

My package status is:

  [46ada45e] Agents v4.4.0
  [8f4d0f93] Conda v1.5.2
  [4986ee89] DynamicalBilliards v3.11.4
  [e9467ef8] GLMakie v0.4.1
  [7073ff75] IJulia v1.23.2
  [ec714cd0] InteractiveDynamics v0.14.6
  [91a5bcdd] Plots v1.16.5
  [c3e4b0f8] Pluto v0.14.8
  [92933f4c] ProgressMeter v1.7.1
  [438e738f] PyCall v1.92.3
  [d330b81b] PyPlot v2.9.0
  [324d217c] ReferenceTests v0.9.7

I’m guessing that I did something to mess up the Julia packaging. Please help :slight_smile:

Thanks!

Searching for a string with help?> gives a list of “nearby” terms that julia knows about. Your status seems to suggest that no package named “OSM” is installed and a quick search on JuliaHub seems to suggest that no such package exists. Are you maybe missing ]add OpenStreetMapX?

2 Likes

@Sukera thanks for the reply.

I actually have the OpenStreetMatX.jl added as well. Not sure why it didn’t come up in the package status earlier. Just updated it again and tried, to no luck.

I am trying to access the submodule OSM, which is a part of the Agents.jl module. (Agents.jl/openstreetmap.jl at master · JuliaDynamics/Agents.jl · GitHub)

Also, I ran ]test Agents and it passes tests (which contain calls to functions in it such asOSM.road). But in the Julia console, I get the error.

This is why I thought that it is an error in loading the submodule. (Also, the open street map functionalities which are deprecated - and outside of the submodule - such as osm_road, are accessible).

Hope this clarifies my issue further.

Thanks!

Have you done using Agents or using Agents: OSM?

I used only using Agents … didn’t know I had to load the submodules separately. will try that!

@Sukera that didn’t work either.

julia> using Agents: OSM
ERROR: UndefVarError: OSM not defined

Yeah, something is happening with your environment, but exactly what is unclear.

I’ve made a temporary environment ]activate --temp and then added just Agents.

(jl_k8JGTx) pkg> st
      Status `/tmp/jl_k8JGTx/Project.toml`
  [46ada45e] Agents v4.4.0

julia> using Agents

help?> OSM
search: OSM OSMSpace OSMAgent osm_road osm_latlon osm_plan_route osm_road_length osm_intersection

  OSM

  Submodule for functionality related to OpenStreetMapSpace. See the docstring of the space for
  more info.

One thing you might want to look into is creating one environment per project. Some documentation on that. Especially having al of these different plot libraries in your project can cause version miss-matches - since they are usually large projects that require many packages to work. The probability of one version of those internals not being up-to-date can throw off Pkg.jl's ability to get you all the right versions.

Still. Since you have Agents v4.4.0 installed, it is quite odd that you cannot see the module. What is your julia version? Can you also post ]st -m for me?

1 Like

Thanks @Libbum

(Julia-Testing) pkg> st -m
      Status `~/..../Manifest.toml`
  [621f4979] AbstractFFTs v1.0.1
  [537997a7] AbstractPlotting v0.18.2
  [1520ce14] AbstractTrees v0.3.4
  [79e6a3ab] Adapt v3.3.1
  [46ada45e] Agents v4.4.0
  [27a7e980] Animations v0.4.1
  [ec485272] ArnoldiMethod v0.1.0
  [4fba245c] ArrayInterface v3.1.17
  [13072b0f] AxisAlgorithms v1.0.0
  [fa961155] CEnum v0.4.1
  [336ed68f] CSV v0.8.5
  [d360d2e6] ChainRulesCore v0.10.9
  [a2cac450] ColorBrewer v0.4.0
  [35d6a980] ColorSchemes v3.12.1
  [3da002f7] ColorTypes v0.10.12
  [c3611d14] ColorVectorSpace v0.8.7
  [5ae59095] Colors v0.12.8
  [34da2185] Compat v3.31.0
  [8f4d0f93] Conda v1.5.2
  [5218b696] Configurations v0.15.4
  [d38c429a] Contour v0.5.7
  [150eb455] CoordinateTransformations v0.6.1
  [a8cc5b0e] Crayons v4.0.4
  [9a962f9c] DataAPI v1.6.0
  [a93c6f00] DataFrames v1.1.1
  [864edb3b] DataStructures v0.18.9
  [e2d170a0] DataValueInterfaces v1.0.0
  [ab62b9b5] DeepDiffs v1.2.0
  [b4f34e82] Distances v0.10.3
  [31c24e10] Distributions v0.24.18
  [ffbed154] DocStringExtensions v0.8.5
  [4986ee89] DynamicalBilliards v3.11.4
  [da5c29d0] EllipsisNotation v1.1.0
  [b305315f] Elliptic v1.0.1
  [55351af7] ExproniconLite v0.6.9
  [c87230d0] FFMPEG v0.4.1
  [7a1cc6ca] FFTW v1.4.3
  [5789e2e9] FileIO v1.10.1
  [1a297f60] FillArrays v0.10.2
  [53c48c17] FixedPointNumbers v0.8.4
  [59287772] Formatting v0.4.2
  [b38be410] FreeType v4.0.0
  [663a7486] FreeTypeAbstraction v0.9.1
  [fb4132e2] FuzzyCompletions v0.4.1
  [f7f18e0c] GLFW v3.4.1
  [e9467ef8] GLMakie v0.4.1
  [28b8d3ca] GR v0.57.5
  [5c1252a2] GeometryBasics v0.3.10
  [4d00f742] GeometryTypes v0.8.4
  [bd48cda9] GraphRecipes v0.5.6
  [a2bd30eb] Graphics v1.1.0
  [3955a311] GridLayoutBase v0.5.4
  [42e2da0e] Grisu v1.0.2
  [cd3eb016] HTTP v0.9.10
  [7073ff75] IJulia v1.23.2
  [bbac6d45] IdentityRanges v0.3.1
  [615f187c] IfElse v0.1.0
  [a09fc81d] ImageCore v0.8.22
  [82e4d734] ImageIO v0.5.5
  [d8c32880] ImageInTerminal v0.4.6
  [02fcd773] ImageTransformations v0.8.12
  [9b13fd28] IndirectArrays v0.5.1
  [d25df0c9] Inflate v0.1.2
  [83e8ac13] IniFile v0.5.0
  [ec714cd0] InteractiveDynamics v0.14.6
  [a98d9a8b] Interpolations v0.13.2
  [8197267c] IntervalSets v0.5.3
  [41ab1584] InvertedIndices v1.0.0
  [f1662d9f] Isoband v0.1.1
  [c8e1da08] IterTools v1.3.0
  [82899510] IteratorInterfaceExtensions v1.0.0
  [033835bb] JLD2 v0.4.10
  [692b3bcd] JLLWrappers v1.3.0
  [682c06a0] JSON v0.21.1
  [5ab0869b] KernelDensity v0.6.3
  [b964fa9f] LaTeXStrings v1.2.1
  [23fbe1c1] Latexify v0.15.6
  [522f3ed2] LibExpat v0.6.1
  [093fc24a] LightGraphs v1.3.5
  [2ab3a3ac] LogExpFunctions v0.2.4
  [1914dd2f] MacroTools v0.5.6
  [ee78f7c6] Makie v0.14.1
  [20f20a25] MakieCore v0.1.3
  [dbb5928d] MappedArrays v0.4.0
  [7eb4fadd] Match v1.1.0
  [739be429] MbedTLS v1.0.3
  [442fdcdd] Measures v0.3.1
  [7269a6da] MeshIO v0.4.7
  [e1d29d7a] Missings v1.0.0
  [66fc600b] ModernGL v1.1.2
  [e94cdb99] MosaicViews v0.3.3
  [99f44e22] MsgPack v1.1.0
  [77ba4419] NaNMath v0.3.5
  [f09324ee] Netpbm v1.0.1
  [46757867] NetworkLayout v0.3.0
  [510215fc] Observables v0.4.0
  [6fe1bfb0] OffsetArrays v1.10.0
  [86cd37e6] OpenStreetMapX v0.2.3
  [d3d4fdd0] OpenStreetMapXPlot v0.1.2
  [bac558e1] OrderedCollections v1.4.1
  [90014a1f] PDMats v0.11.1
  [f57f5aa1] PNGFiles v0.3.7
  [19eb6ba3] Packing v0.4.1
  [5432bcbf] PaddedViews v0.5.8
  [69de0a69] Parsers v1.1.0
  [eebad327] PkgVersion v0.1.1
  [ccf2f8ad] PlotThemes v2.0.1
  [995b91a9] PlotUtils v1.0.10
  [91a5bcdd] Plots v1.16.5
  [c3e4b0f8] Pluto v0.14.8
  [647866c9] PolygonOps v0.1.1
  [2dfb63ee] PooledArrays v1.2.1
  [21216c6a] Preferences v1.2.2
  [08abe8d2] PrettyTables v1.1.0
  [92933f4c] ProgressMeter v1.7.1
  [438e738f] PyCall v1.92.3
  [d330b81b] PyPlot v2.9.0
  [1fd47b50] QuadGK v2.4.1
  [c84ed2f1] Ratios v0.4.0
  [3cdcf5f2] RecipesBase v1.1.1
  [01d81517] RecipesPipeline v0.3.3
  [189a3867] Reexport v1.1.0
  [324d217c] ReferenceTests v0.9.7
  [ae029012] Requires v1.1.3
  [79098fc4] Rmath v0.7.0
  [6038ab10] Rotations v1.0.2
  [6c6a2e73] Scratch v1.1.0
  [91c51154] SentinelArrays v1.3.3
  [65257c39] ShaderAbstractions v0.2.6
  [992d4aef] Showoff v1.0.3
  [73760f76] SignedDistanceFields v0.4.0
  [699a6c99] SimpleTraits v0.9.3
  [b85f4697] SoftGlobalScope v1.1.0
  [a2af1166] SortingAlgorithms v1.0.0
  [276daf66] SpecialFunctions v1.5.1
  [cae243ae] StackViews v0.1.1
  [aedffcd0] Static v0.2.5
  [90137ffa] StaticArrays v1.2.4
  [82ae8749] StatsAPI v1.0.0
  [2913bbd2] StatsBase v0.33.8
  [4c63d2b9] StatsFuns v0.9.8
  [09ab397b] StructArrays v0.4.2
  [d1efa939] TableIOInterface v0.1.6
  [3783bdb8] TableTraits v1.0.1
  [bd369af6] Tables v1.4.4
  [731e570b] TiffImages v0.3.2
  [3bb67fe8] TranscodingStreams v0.9.5
  [5c2747f8] URIs v1.3.0
  [1cfade01] UnicodeFun v0.4.1
  [81def892] VersionParsing v1.2.0
  [efce3f68] WoodburyMatrices v0.5.3
  [c2297ded] ZMQ v1.2.1
  [6e34b625] Bzip2_jll v1.0.6+5
  [83423d85] Cairo_jll v1.16.0+6
  [5ae413db] EarCut_jll v2.1.5+1
  [2e619515] Expat_jll v2.2.10+0
  [b22a6f82] FFMPEG_jll v4.3.1+4
  [f5851436] FFTW_jll v3.3.9+7
  [a3f928ae] Fontconfig_jll v2.13.1+14
  [d7e528f0] FreeType2_jll v2.10.1+5
  [559328eb] FriBidi_jll v1.0.10+0
  [0656b61e] GLFW_jll v3.3.5+0
  [d2c73de3] GR_jll v0.57.3+0
  [78b55507] Gettext_jll v0.21.0+0
  [7746bdde] Glib_jll v2.68.1+0
  [1d5cc7b8] IntelOpenMP_jll v2018.0.3+2
  [aacddb02] JpegTurbo_jll v2.1.0+0
  [c1c5ebd0] LAME_jll v3.100.1+0
  [dd4b983a] LZO_jll v2.10.1+0
  [dd192d2f] LibVPX_jll v1.10.0+0
  [e9f186c6] Libffi_jll v3.2.2+0
  [d4300ac3] Libgcrypt_jll v1.8.7+0
  [7e76a0d4] Libglvnd_jll v1.3.0+3
  [7add5ba3] Libgpg_error_jll v1.42.0+0
  [94ce4f54] Libiconv_jll v1.16.1+1
  [4b2f31a3] Libmount_jll v2.35.0+0
  [89763e89] Libtiff_jll v4.3.0+0
  [38a345b3] Libuuid_jll v2.36.0+0
  [856f044c] MKL_jll v2021.1.1+1
  [e7412a2a] Ogg_jll v1.3.5+0
  [458c3c95] OpenSSL_jll v1.1.10+0
  [efe28fd5] OpenSpecFun_jll v0.5.5+0
  [91d4177d] Opus_jll v1.3.2+0
  [2f80f16e] PCRE_jll v8.44.0+0
  [30392449] Pixman_jll v0.40.1+0
  [ea2cea3b] Qt5Base_jll v5.15.3+0
  [f50d1b31] Rmath_jll v0.3.0+0
  [a2964d1f] Wayland_jll v1.19.0+0
  [2381bf8a] Wayland_protocols_jll v1.18.0+4
  [02c8fc9c] XML2_jll v2.9.12+0
  [aed1982a] XSLT_jll v1.1.34+0
  [4f6342f7] Xorg_libX11_jll v1.6.9+4
  [0c0b7dd1] Xorg_libXau_jll v1.0.9+4
  [935fb764] Xorg_libXcursor_jll v1.2.0+4
  [a3789734] Xorg_libXdmcp_jll v1.1.3+4
  [1082639a] Xorg_libXext_jll v1.3.4+4
  [d091e8ba] Xorg_libXfixes_jll v5.0.3+4
  [a51aa0fd] Xorg_libXi_jll v1.7.10+4
  [d1454406] Xorg_libXinerama_jll v1.1.4+4
  [ec84b674] Xorg_libXrandr_jll v1.5.2+4
  [ea2f1a96] Xorg_libXrender_jll v0.9.10+4
  [14d82f49] Xorg_libpthread_stubs_jll v0.1.0+3
  [c7cfdc94] Xorg_libxcb_jll v1.13.0+3
  [cc61e674] Xorg_libxkbfile_jll v1.1.0+4
  [12413925] Xorg_xcb_util_image_jll v0.4.0+1
  [2def613f] Xorg_xcb_util_jll v0.4.0+1
  [975044d2] Xorg_xcb_util_keysyms_jll v0.4.0+1
  [0d47668e] Xorg_xcb_util_renderutil_jll v0.3.9+1
  [c22f9ab0] Xorg_xcb_util_wm_jll v0.4.1+1
  [35661453] Xorg_xkbcomp_jll v1.4.2+4
  [33bec58e] Xorg_xkeyboard_config_jll v2.27.0+4
  [c5fb5394] Xorg_xtrans_jll v1.4.0+3
  [8f1865be] ZeroMQ_jll v4.3.4+0
  [3161d3a3] Zstd_jll v1.5.0+0
  [9a68df92] isoband_jll v0.2.2+0
  [0ac62f75] libass_jll v0.14.0+4
  [f638f0a6] libfdk_aac_jll v0.1.6+4
  [b53b4c65] libpng_jll v1.6.38+0
  [a9144af2] libsodium_jll v1.0.20+0
  [f27f6e37] libvorbis_jll v1.3.7+0
  [1270edf5] x264_jll v2020.7.14+2
  [dfaa095f] x265_jll v3.0.0+3
  [d8fb68d0] xkbcommon_jll v0.9.1+5
  [0dad84c5] ArgTools
  [56f22d72] Artifacts
  [2a0f44e3] Base64
  [ade2ca70] Dates
  [8bb1440f] DelimitedFiles
  [8ba89e20] Distributed
  [f43a241f] Downloads
  [7b1f6079] FileWatching
  [9fa8497b] Future
  [b77e0a4c] InteractiveUtils
  [4af54fe1] LazyArtifacts
  [b27032c2] LibCURL
  [76f85450] LibGit2
  [8f399da3] Libdl
  [37e2e46d] LinearAlgebra
  [56ddb016] Logging
  [d6f4376e] Markdown
  [a63ad114] Mmap
  [ca575930] NetworkOptions
  [44cfe95a] Pkg
  [de0858da] Printf
  [3fa0cd96] REPL
  [9a3f8284] Random
  [ea8e919c] SHA
  [9e88b42a] Serialization
  [1a1011a3] SharedArrays
  [6462fe0b] Sockets
  [2f01184e] SparseArrays
  [10745b16] Statistics
  [4607b0f0] SuiteSparse
  [fa267f1f] TOML
  [a4e569a6] Tar
  [8dfed614] Test
  [cf7118a7] UUIDs
  [4ec0a83e] Unicode
  [e66e0078] CompilerSupportLibraries_jll
  [deac9b47] LibCURL_jll
  [29816b5a] LibSSH2_jll
  [c8ffd9c3] MbedTLS_jll
  [14a3606d] MozillaCACerts_jll
  [83775a58] Zlib_jll
  [8e850ede] nghttp2_jll
  [3f19e933] p7zip_jll

I’ll definitely try creating an environment just for this and report back.

Also the same happens to me when I tried this in Pluto. I think Pluto creates an environment specifically for the notebook, right?

This is what I have in my Pluto

begin
	let
		env = mktempdir()
		import Pkg
		Pkg.activate(env)
		Pkg.Registry.update()
		Pkg.add(Pkg.PackageSpec(;name="PlutoUI", version="0.6.7-0.6"))
		Pkg.add("PyPlot")
		Pkg.add("Agents")	
		Pkg.add("Plots")
		Pkg.add("OpenStreetMapX")
		Pkg.add("OpenStreetMapXPlot")
	end
	using PlutoUI
	using Agents
	using Random
	using Statistics: mean
	using Plots
	using OpenStreetMapX
	using OpenStreetMapXPlot
end

Thanks for the responses! :smiley:

I tried a temp environment and the same happened.

(Julia-Testing) pkg> activate --temp
  Activating new environment at `/var/folders/b9/pknhp85d281_dkf_27q7mllr0000gn/T/jl_fMU16B/Project.toml`

(jl_fMU16B) pkg> add Agents
   Resolving package versions...
    Updating `/private/var/folders/b9/pknhp85d281_dkf_27q7mllr0000gn/T/jl_fMU16B/Project.toml`
  [46ada45e] + Agents v4.4.0

.
.
.
  [8e850ede] + nghttp2_jll
  [3f19e933] + p7zip_jll
Precompiling project...
  ? JLD2
  ? GeometryBasics
  ? Agents
  1 dependency successfully precompiled in 9 seconds (65 already precompiled)
  3 dependencies failed but may be precompilable after restarting julia

julia> using Agents

julia> OSM
ERROR: UndefVarError: OSM not defined

julia> 

Maybe I need to restart Julia. —update: this worked

(Sorry if I’m spamming… just thought might be better to document step by step, in case it helps you guys in helping me :smiley: - and in case it helps someone later!)

:pray:

1 Like