Ask Your Question
1

Sage does not see Imagemagick

asked 2018-09-12 02:18:14 +0100

Symbol 1 gravatar image

updated 2020-01-12 13:26:18 +0100

FrédéricC gravatar image

I am trying out the animation thing in http://doc.sagemath.org/html/en/refer....

But Sage keep saying

Error: Neither ImageMagick nor ffmpeg appears to be installed.

And indeed

from sage.misc.sage_ostools import have_program
have_program('convert')

returns false.

But I do have ImageMagick installed by homwbrew. i.e. it works perfectly in Terminal.

What Could Possibly Go Wrong?

(macOS 10.13; Sage 8.3; Imagemagick 7.0.8.)

edit retag flag offensive close merge delete

Comments

Update: have_program('convert',path="/usr/local/bin") returns true.

Symbol 1 gravatar imageSymbol 1 ( 2018-09-12 02:27:11 +0100 )edit

I temporarily solve this by os.environ["PATH"]+=":/usr/local/bin". Looking for a permanent solution.

Symbol 1 gravatar imageSymbol 1 ( 2018-09-12 02:49:38 +0100 )edit

Well, sounds to me like your ImageMagick is installed under the /usr/local prefix so you should add that permanently to your PATH (such as in .profile or something). On Most Linuxes /usr/local/bin will be on your PATH by default, but I don't know about macOS.

Iguananaut gravatar imageIguananaut ( 2018-09-12 11:30:13 +0100 )edit

@Iguananaut I feel like there are two PATHs. The PATH in my terminal does contains /usr/local/bin/ as I can see it if I do echo $PATH. But then the python coming with sage assumes a different PATH, which does not contain /usr/local/, as shown by os.environ["PATH"]. I am not sure which .profile should I fix in this case.

Symbol 1 gravatar imageSymbol 1 ( 2018-09-15 22:36:56 +0100 )edit
1

How do you run Sage?

Iguananaut gravatar imageIguananaut ( 2018-09-19 16:20:01 +0100 )edit

1 Answer

Sort by » oldest newest most voted
1

answered 2018-09-22 09:29:35 +0100

slelievre gravatar image

If you are launching Sage using a terminal, it should inherit the shell's PATH.

Are you maybe launching Sage as an app?

Setting the PATH for GUI apps can be done, see for example

Another solution might be to include the command from your temporary fix in the init.sage file in the .sage folder in your home folder (this .sage folder should exist; create the file init.sage if necessary).

os.environ["PATH"] += ":/usr/local/bin"

This init.sage is also a good place for putting an instruction such as

%colors Linux

which will improve the syntax highlighting color scheme in the Sage REPL if you work in a terminal with dark background. Indeed the default is

%colors LightBG

which works well for terminals with light background.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2018-09-12 02:18:14 +0100

Seen: 860 times

Last updated: Sep 22 '18