# Psxy \[ERROR\]: Found no history for option -J

**URL:** <https://forum.generic-mapping-tools.org/t/psxy-error-found-no-history-for-option-j/286>\
**Category:** Q&A\
**Created:** [March 8, 2020, 9:16am UTC](https://forum.generic-mapping-tools.org/t/psxy-error-found-no-history-for-option-j/286 "2020-03-08T09:16:52Z")\
**Posts on this page:** 4\
**Page:** 2

<div class="post-metadata">

**Author:** ![Frank](https://avatars.discourse-cdn.com/v4/letter/f/3d9bf3/32.png) [@Frank](https://forum.generic-mapping-tools.org/u/Frank)\
**Post date:** [March 12, 2020, 7:02pm UTC](https://forum.generic-mapping-tools.org/t/psxy-error-found-no-history-for-option-j/286/21 "2020-03-12T19:02:10Z")

</div>

Hi, and thanks again Joaquim.

I have now finally managed to establish a proper setup for my linux machine, but not without a LOT of investigation, trial and error and of course YOUR very helpful guiding. Therfore I think it may be helpful to you and also others experiencing similar challanges in the linux installation that I share my setup. Please note that my experience is done in a pure linux environment and that other challenges may occur if GMT is installed under e.g. a Conda environment.

My GMT/Julia folder locations are set by the installation of the respective modules which you have pointed to in earlier posts.

- Folder with GMT v. 6.x.x installation: **/home/fg/GMT/**
- Folder with GMT.jl wrapper installation: **/home/fg/gmt/**
- Folder with Julia installation: **/home/fg/julia/**

**Added the following lines to my .bshrc file:**  
export PATH="$PATH:$HOME/GMT/bin"  
export PATH="$PATH:$HOME/gmt/bin"  
export PATH="$PATH:$HOME/julia/bin"  
export LD\_LIBRARY\_PATH=$LD\_LIBRARY\_PATH:/home/fg/GMT/lib/

**Create startup.jl file AND “config” folder -\> /home/fg/.julia/config/startup.jl**  
**where startup.jl contains the following two lines (pointing to the libgmt.so file):**  
using Libdl  
push!(Libdl.DL\_LOAD\_PATH, “/home/fg/GMT/lib”)

**Prepare JuliaCall and GMT within RStudio:**  
Install JuliaCall package (a one-timer):  
_\> install.packages(“JuliaCall”)_  
activate JuliaCall library with it’s embedded functions  
_\> library(JuliaCall)_  
Run Julia setup command (a one-timer):  
_\> julia \<- julia\_setup()_  
Install GMT package within R Julia env. (a one-timer):  
_\> julia\_install\_package(“GMT”)_  
Activate GMT library with it’s embedded functions:  
_\> julia\_library(“GMT”)_

There are now at least six (!) different optional ways for me of running GMT commands, 2 in the ordinary linux terminal window (1) Classic mode input as given in the manuals and (2) Modern mode by first starting julia, and 4 others within RStudio:

(3) Start a “Julia console” (within RStudio Console window). Part of JuliaCall package and the “libray(JuliaCall)” command must be run at startup of session.  
_\> julia\_console()_  
A simple Julia console is started -\> GMT testplot:  
_julia\> plot(rand(10), show=true)_

(4) Run GMT modern commands directly in the RStudio console using “julia\_command()”. Part of JuliaCall package and the “libray(JuliaCall)” command must be run first. -\> GMT testplot:  
_\> julia\_command(“plot(rand(10), show=true);”)_

(5) Run GMT classic commands in the RStudio console using RStudio base “system()” command:  
_\> system(“gmt pscoast -R-180/180/-90/90 -Dc -W -M \> world\_crude.txt”)_

(6) Run GMT modern commands directly in the RStudio terminal window by first starting Julia:  
_$ julia_  
_julia\> using GMT_  
-\> GMT testplot:  
_julia\> plot(rand(10), show=true)_

Hope this may be helpful for others!

---

<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:** [March 12, 2020, 11:14pm UTC](https://forum.generic-mapping-tools.org/t/psxy-error-found-no-history-for-option-j/286/22 "2020-03-12T23:14:42Z")

</div>

> [@Frank](#):
>
> export PATH=“$PATH:$HOME/GMT/bin”  
> export PATH=“$PATH:$HOME/gmt/bin”

Nice it works for you too. Yep, linux \<==\> _suffering_  
I don’t think you need the second of the exports above. Your GMT is under `$HOME/GMT/bin`. The other one I don’t know what it is.

> [@](#):
>
> export LD\_LIBRARY\_PATH=$LD\_LIBRARY\_PATH:/home/fg/GMT/lib/
> 
> **Create startup.jl file AND “config” folder → /home/fg/.julia/config/startup.jl**  
> **where startup.jl contains the following two lines (pointing to the libgmt.so file):**  
> using Libdl  
> push!(Libdl.DL\_LOAD\_PATH, “/home/fg/GMT/lib”)

Also, here I don’t think you need both. I installed Julia on WSL and since I’m using there a custom GMT installation I initially also had the error of not finding `libgmt.so` But the `Libdl` setting alone was enough to make it work.

Regarding your now _excess_ of options to run GMT, well they aren’t all equal. Using system calls in R means that you must save the data in disk before being able to use it GMT, whilst the _via-Juia_ way lets you use the in-memory data. This is a BIG difference.

One last thing, does the ` julia_command(“plot(rand(10), show=true);”)` in R automatically displays the plot or it errors like on Windows R?

---

<div class="post-metadata">

**Author:** ![Frank](https://avatars.discourse-cdn.com/v4/letter/f/3d9bf3/32.png) [@Frank](https://forum.generic-mapping-tools.org/u/Frank)\
**Post date:** [March 13, 2020, 4:11pm UTC](https://forum.generic-mapping-tools.org/t/psxy-error-found-no-history-for-option-j/286/23 "2020-03-13T16:11:39Z")

</div>

Hi again Joaquim,

1. Yes, you are right regarding the

> export PATH=“$PATH:$HOME/gmt/bin”

as long as this bin-folder simply is not there 🙂 .

2a. Removing the **startup.jl file** and keeping

> export LD\_LIBRARY\_PATH=$LD\_LIBRARY\_PATH:/home/fg/GMT/lib/

give me error message in RStudio:

> julia\_install\_package(“GMT”)  
> Error in if (is.na(a)) return(-1L) : argument is of length zero

2b. Keeping the **startup.jl file** and removing the .bashrc line:

> export LD\_LIBRARY\_PATH=$LD\_LIBRARY\_PATH:/home/fg/GMT/lib/

Works for all 4 mentioned GMT command input options in RStudio, so yes you are right also here that I don’t need both - but keeping the startup.jl file is the way to go for me.

1. Yes, the

> julia\_command(“plot(rand(10), show=true);”)

will automatically display the plot in my linux RStudio.

---

<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:** [March 14, 2020, 4:10pm UTC](https://forum.generic-mapping-tools.org/t/psxy-error-found-no-history-for-option-j/286/24 "2020-03-14T16:10:35Z")

</div>

Cool. When you have non-trivial examples of using GMT in R you are welcome to post them here.

[Previous page](https://forum.generic-mapping-tools.org/t/psxy-error-found-no-history-for-option-j/286.md?page=1)
