Using the Julia Wrapper in Ubuntu 20.04

Hi all.
I am sorry to bug you guys with the Julia GMT.jl.

I am trying to user in my University’s server. Running Ubuntu 20.04 TLS. GMT was installed by my boss and it has 6.0.0 and runs as expected. But the GMT.jl does not load.

The problem is described bellow, I would appreciate any recommendation.

When I enter Julia and ask it to use GMT. I get:

> julia> using GMT
> 
> 	GMT - The Generic Mapping Tools, Version 6.0.0 [64-bit] [128 cores]
> 	(c) 1991-2019 The GMT Team (https://www.generic-mapping-tools.org/team.html).
> 
> Supported in part by the US National Science Foundation (http://www.nsf.gov/)
> and volunteers from around the world.
> 
> GMT is distributed under the GNU LGP License (http://www.gnu.org/licenses/lgpl.html).
> 
> usage: gmt [options]
>        gmt <module name> [<module-options>]
> 
> options:
>   --help            List descriptions of available GMT modules.
>   --new-script[=L]  Write GMT modern mode script template to stdout.
>                     Optionally specify bash|csh|batch [Default is current shell]
>   --show-bindir     Show directory with GMT executables.
>   --show-citation   Show the most recent citation for GMT.
>   --show-cores      Show number of available cores.
>   --show-datadir    Show directory/ies with user data.
>   --show-dataserver Show URL of the remote GMT data server.
>   --show-doi        Show the DOI for the current release.
>   --show-modules    Show all module names.
>   --show-library    Show path of the shared GMT library.
>   --show-plugindir  Show directory for plug-ins.
>   --show-sharedir   Show directory for shared GMT resources.
>   --version         Print GMT version number.
> 
> if <module-options> is '=' we call exit (0) if module exist and non-zero otherwise.
> 
> 
> 	GMT - The Generic Mapping Tools, Version 6.0.0 [64-bit] [128 cores]
> 	(c) 1991-2019 The GMT Team (https://www.generic-mapping-tools.org/team.html).
> 
> Supported in part by the US National Science Foundation (http://www.nsf.gov/)
> and volunteers from around the world.
> 
> GMT is distributed under the GNU LGP License (http://www.gnu.org/licenses/lgpl.html).
> 
> usage: gmt [options]
>        gmt <module name> [<module-options>]
> 
> options:
>   --help            List descriptions of available GMT modules.
>   --new-script[=L]  Write GMT modern mode script template to stdout.
>                     Optionally specify bash|csh|batch [Default is current shell]
>   --show-bindir     Show directory with GMT executables.
>   --show-citation   Show the most recent citation for GMT.
>   --show-cores      Show number of available cores.
>   --show-datadir    Show directory/ies with user data.
>   --show-dataserver Show URL of the remote GMT data server.
>   --show-doi        Show the DOI for the current release.
>   --show-modules    Show all module names.
>   --show-library    Show path of the shared GMT library.
>   --show-plugindir  Show directory for plug-ins.
>   --show-sharedir   Show directory for shared GMT resources.
>   --version         Print GMT version number.
> 
> if <module-options> is '=' we call exit (0) if module exist and non-zero otherwise.
> 
> ERROR: InitError: failed process: Process(`gmt --show-userdir`, ProcessExited(78)) [78]
> 
> Stacktrace:
>   [1] pipeline_error
>     @ ./process.jl:531 [inlined]
>   [2] (::Base.var"#697#698"{Base.Process})()
>     @ Base ./process.jl:320
>   [3] iterate(itr::Base.EachLine{Base.PipeEndpoint}, state::Nothing) (repeats 2 times)
>     @ Base ./io.jl:1019
>   [4] _collect(cont::UnitRange{Int64}, itr::Base.EachLine{Base.PipeEndpoint}, #unused#::Base.HasEltype, isz::Base.SizeUnknown)
>     @ Base ./array.jl:660
>   [5] collect
>     @ ./array.jl:649 [inlined]
>   [6] #readlines#378
>     @ ./io.jl:553 [inlined]
>   [7] readlines
>     @ ./io.jl:553 [inlined]
>   [8] __init__(test::Bool)
>     @ GMT ~/.julia/packages/GMT/pWfCU/src/GMT.jl:295
>   [9] __init__()
>     @ GMT ~/.julia/packages/GMT/pWfCU/src/GMT.jl:275
>  [10] _include_from_serialized(path::String, depmods::Vector{Any})
>     @ Base ./loading.jl:768
>  [11] _require_search_from_serialized(pkg::Base.PkgId, sourcepath::String)
>     @ Base ./loading.jl:854
>  [12] _require(pkg::Base.PkgId)
>     @ Base ./loading.jl:1097
>  [13] require(uuidkey::Base.PkgId)
>     @ Base ./loading.jl:1013
>  [14] require(into::Module, mod::Symbol)
>     @ Base ./loading.jl:997
> during initialization of module GMT

The problem is that GMT6.0.0 is not supported because the above command did not existed at that time.
You must install a new version (always preferably the latest). Note that even if it’s a server where you have limited privileges you can still install a version in your local directory and make it findable first then the one at toot.

If you tray the GMT.jl master branch, I’ve added a test to detect no-supported GMT versions and failures will trig the GMT automatic installation. Maybe this solves your issue in the server.

Sorry… for the double post. I am testing now if it will update the GMT in the server. Will report back :slight_smile:

is sudo required before running Julia for the installation to run?

You need the same privileges as for installing any other Julia package. GMT will be installed by conda.jl

Worked great!
I figured the permissions thing.
I get an error about png…

plot(x,y,show=true)

Error: no “view” rule for type “image/png” passed its test case

(for more information, add “–debug=1” on the command line)

/usr/bin/xdg-open: 869: www-browser: not found

/usr/bin/xdg-open: 869: links2: not found

/usr/bin/xdg-open: 869: elinks: not found

/usr/bin/xdg-open: 869: links: not found

/usr/bin/xdg-open: 869: lynx: not found

/usr/bin/xdg-open: 869: w3m: not found

xdg-open: no method available for opening ‘/tmp/GMTjl_tmp.png’

ERROR: failed process: Process(xdg-open /tmp/GMTjl_tmp.png, ProcessExited(3)) [3]

Stacktrace:

[1] pipeline_error

@ ./process.jl:531 [inlined]

[2] run(::Cmd; wait::Bool**)**

@ Base ./process.jl:446

[3] run

@ ./process.jl:444 [inlined]

[4] showfig(d::Dict{Symbol, Any}, fname_ps::String, fname_ext::String, opt_T::String, K::Bool, fname::String)

@ GMT ~/.julia/packages/GMT/Fq8wF/src/common_options.jl:3443

[5] finish_PS_module(::Dict{Symbol, Any}, ::Vector{String}, ::String, ::Bool, ::Bool, ::Bool, ::Matrix{Float64}, ::Vararg{Any})

@ GMT ~/.julia/packages/GMT/Fq8wF/src/common_options.jl:3643

[6] common_plot_xyz(cmd0::String, arg1::Matrix{Float64}, caller::String, first::Bool, is3D::Bool, kwargs::Pair{Symbol, Bool})

@ GMT ~/.julia/packages/GMT/Fq8wF/src/psxy.jl:255

[7] #plot#267

@ ~/.julia/packages/GMT/Fq8wF/src/plot.jl:130 [inlined]

[8] top-level scope

@ REPL[5]:1

The problem is that often the servers don’t have it installed. That’s the program that automatically does the display. This means that you generated the figure but automatic display failed.

Sorry to ask about something like this, but xdg-open is installed (apparently) but I get:

Error: no “view” rule for type “image/png” passed its test case

(for more information, add “–debug=1” on the command line)

/usr/bin/xdg-open: 869: www-browser: not found

/usr/bin/xdg-open: 869: links2: not found

/usr/bin/xdg-open: 869: elinks: not found

/usr/bin/xdg-open: 869: links: not found

/usr/bin/xdg-open: 869: lynx: not found

/usr/bin/xdg-open: 869: w3m: not found

xdg-open: no method available for opening ‘/tmp/GMTjl_tmp.png’

ERROR: failed process: Process(xdg-open /tmp/GMTjl_tmp.png, ProcessExited(3)) [3]

Yes sorry, that’s true. Only realized that after replying.
Can’t really help you much here. The problem is how to visualize the remote image. Probably you must be running Julia from an env that has a remote display set, or else download the image to your local machine and visualize it there.

It’s ok hehehe. I will write it to a file and download :slight_smile: