Problem installing Julia plugin in TeXmacs (Windows)

Hi comunity. I’m trying to install Julia from https://github.com/mgubi/tm-julia. I followed the steps (of a form a little diferent) of the readme, but at the finish TeXmacs doesn’t recognize it. I recorded the installation, you can watch the video here https://www.youtube.com/watch?v=03GyogQJZDo. What can I do?

1 Like

Hi @MillerSilva!

Could you try to do “Tools->Update->Plugins”?

And if that doesn’t work, could you open a Scheme session, enter

(url-exists-in-path? "julia")

and tell us what output you get? It may be that the plugin needs some more information to find the Julia executable (perhaps a :winpath option is needed in init-julia.scm)

I think the problem is that the executable is not found. I do not know what to implement on the scheme side. We need some help from somebody with a Windows machine to find out what is the proper call to make.

From what I can find on the net, it seems like Julia should be installed under

C:\Users\NAME\AppData\Local\Julia-X.X.X\bin\julia.exe 

Looking at what other plugins do, adding

(:winpath "Julia*" "bin")

to plugin-configure in init-julia.scm might work (perhaps :slight_smile: ).

I did it, but same,TeXmacs doesn’t recognize it. And when I run (url-exists-in-path? "julia") in Scheme, it return #f.
On other hand, I have Julia language installed in my pc.

Could you please try to open the file plugins/julia/progs/init-julia.scm in your TeXmacs folder with a text editor and add a line after (plugin-configure julia to make it look like this?

(plugin-configure julia
 (:winpath "Julia*" "bin")
 (:require (url-exists-in-path? "julia"))
 (:serializer ,julia-serialize)
 (:launch ,(julia-launcher))
 (:tab-completion #t)
 (:session "Julia"))

The second line, (:winpath "Julia*" "bin") should be added.

Ok, I just did. But it´s not recognizes by TeXmacs, still.

Could you please retry the (url-exists-in-path? "julia") command?

There may be another issue with the julia-entry function, since it uses slashes / and not backslashes as you would on Windows. It would be good to know if the path issue is already sorted now.

I run again the comand (url-exists-in-path? "julia") but it returned #f.

What is the return value of

(supports-julia?)

Maybe one has to update the plugin list: Tools->Update->Plugins

I updated the plugin list and then run (supports-julia?) and it returned Unbound variable: supports-julia?.

What is the output of

(getenv "PATH")

in a scheme session?

It return this

And what about (getenv "HOME")?

It return "C:\\Users\\mille".

Hi,
You can also have : C:\Users\NAME\AppData\Local\Programs\Julia-X.X.X\bin\julia.exe

@pireddag can you help us with this? I’ve checked the source code for plugins initialisation and it seems to be able to setup the right directories and to look for “.exe” files on Windows. I do not understand why it doesn’t.

@MillerSilva does the Python plugin works for you?

It does not work for me too. In my case

(url-exists-in-path? "julia")
#t
(supports-julia?)
#f

In my PATH I have C:\Users\Giovanni\AppData\Local\Programs\Julia-1.6.1\bin in the user part.

Edit:

It works if the folder is put in TEXMACS_PATH\plugins, it does not work in TEXMACS_HOME_PATH\plugins

Edit 2:

Perhaps the reason why it does not work for @MillerSilva is that he does not have the necessary entry in PATH??

Edit 3:
It works on the TEXMACS_HOME_PATH\plugins too. In this case one needs to update the plugins twice (“Tools->Update->Plugins”) (TeXmacs finds new plugins up to the fourth or fifth “Update”)

The relevant functions are in progs/kernel/texmacs/tm-plugins.scm:

(define (add-to-path u after?)
  (add-to-check-dir-table u)
  (let* ((u1 (url-complete u "dr"))
         (u2 "$PATH")
         (u3 (if after? (url-or u2 u1) (url-or u1 u2)))
         (p  (url-expand u3)))
    (when (not (url-none? u1))
      (setenv "PATH" (url->system p)))))

(define (add-to-path* prefix u after?)
  (add-to-path (url-append (system->url prefix) u) after?))

(define (add-windows-program-path u after?)
  (add-to-path* "C:\\." u after?)
  (add-to-path* "C:\\Program File*" u after?)
  (add-to-path* "$HOME\\AppData\\Local" u after?)
  (add-to-path* "$HOME\\AppData\\Local\\Programs" u after?))

Called by the :winpath declaration in the plugin. It seems it is also adding the path relative to the home directory of the user. Can you check what does it gives that:

(define u (url-append (system->url "$HOME\\AppData\\Local\\Programs" ) (url-append "Julia*" "bin") ))
(url-complete u "dr")
1 Like