# Using the Julia Wrapper in Ubuntu 20.04

**URL:** <https://forum.generic-mapping-tools.org/t/using-the-julia-wrapper-in-ubuntu-20-04/2899>\
**Category:** GMT.jl Q&A\
**Tags:** gmt\
**Created:** [May 9, 2022, 4:11pm UTC](https://forum.generic-mapping-tools.org/t/using-the-julia-wrapper-in-ubuntu-20-04/2899 "2022-05-09T16:11:33Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![marianoarnaiz](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/marianoarnaiz/32/971_2.png) [@marianoarnaiz](https://forum.generic-mapping-tools.org/u/marianoarnaiz)\
**Post date:** [May 9, 2022, 4:11pm UTC](https://forum.generic-mapping-tools.org/t/using-the-julia-wrapper-in-ubuntu-20-04/2899/1 "2022-05-09T16:11:33Z")

</div>

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:

```auto
> 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

```

---

<div class="post-metadata">

**Author:** ![Joaquim](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/joaquim/32/16_2.png) [@Joaquim](https://forum.generic-mapping-tools.org/u/Joaquim)\
**Post date:** [May 9, 2022, 4:33pm UTC](https://forum.generic-mapping-tools.org/t/using-the-julia-wrapper-in-ubuntu-20-04/2899/2 "2022-05-09T16:33:49Z")

</div>

> [@marianoarnaiz](#):
>
> `gmt --show-userdir`

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_.

---

<div class="post-metadata">

**Author:** ![Joaquim](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/joaquim/32/16_2.png) [@Joaquim](https://forum.generic-mapping-tools.org/u/Joaquim)\
**Post date:** [May 9, 2022, 5:09pm UTC](https://forum.generic-mapping-tools.org/t/using-the-julia-wrapper-in-ubuntu-20-04/2899/3 "2022-05-09T17:09:15Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![marianoarnaiz](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/marianoarnaiz/32/971_2.png) [@marianoarnaiz](https://forum.generic-mapping-tools.org/u/marianoarnaiz)\
**Post date:** [May 9, 2022, 6:02pm UTC](https://forum.generic-mapping-tools.org/t/using-the-julia-wrapper-in-ubuntu-20-04/2899/5 "2022-05-09T18:02:41Z")

</div>

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

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

---

<div class="post-metadata">

**Author:** ![Joaquim](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/joaquim/32/16_2.png) [@Joaquim](https://forum.generic-mapping-tools.org/u/Joaquim)\
**Post date:** [May 9, 2022, 6:17pm UTC](https://forum.generic-mapping-tools.org/t/using-the-julia-wrapper-in-ubuntu-20-04/2899/6 "2022-05-09T18:17:35Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![marianoarnaiz](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/marianoarnaiz/32/971_2.png) [@marianoarnaiz](https://forum.generic-mapping-tools.org/u/marianoarnaiz)\
**Post date:** [May 9, 2022, 6:24pm UTC](https://forum.generic-mapping-tools.org/t/using-the-julia-wrapper-in-ubuntu-20-04/2899/7 "2022-05-09T18:24:12Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Joaquim](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/joaquim/32/16_2.png) [@Joaquim](https://forum.generic-mapping-tools.org/u/Joaquim)\
**Post date:** [May 9, 2022, 6:28pm UTC](https://forum.generic-mapping-tools.org/t/using-the-julia-wrapper-in-ubuntu-20-04/2899/8 "2022-05-09T18:28:14Z")

</div>

> [@marianoarnaiz](#):
>
> xdg-open

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.

---

<div class="post-metadata">

**Author:** ![marianoarnaiz](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/marianoarnaiz/32/971_2.png) [@marianoarnaiz](https://forum.generic-mapping-tools.org/u/marianoarnaiz)\
**Post date:** [May 9, 2022, 6:50pm UTC](https://forum.generic-mapping-tools.org/t/using-the-julia-wrapper-in-ubuntu-20-04/2899/9 "2022-05-09T18:50:12Z")

</div>

> [@Joaquim](#):
>
> > [@marianoarnaiz](#):
> >
> > xdg-open

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]

---

<div class="post-metadata">

**Author:** ![Joaquim](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/joaquim/32/16_2.png) [@Joaquim](https://forum.generic-mapping-tools.org/u/Joaquim)\
**Post date:** [May 9, 2022, 6:58pm UTC](https://forum.generic-mapping-tools.org/t/using-the-julia-wrapper-in-ubuntu-20-04/2899/10 "2022-05-09T18:58:35Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![marianoarnaiz](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/marianoarnaiz/32/971_2.png) [@marianoarnaiz](https://forum.generic-mapping-tools.org/u/marianoarnaiz)\
**Post date:** [May 9, 2022, 7:25pm UTC](https://forum.generic-mapping-tools.org/t/using-the-julia-wrapper-in-ubuntu-20-04/2899/11 "2022-05-09T19:25:30Z")

</div>

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