One option: in any notebook where you want to use, for example, ImageMagick's binary "convert", first you have to find that file. On my machine it's in /usr/local/bin
. Then add this to the notebook:
import os
os.environ['PATH'] += ':/usr/local/bin'
(The leading colon is important: PATH
is a list of directories separated by colons. If you want this to be platform independent, then I guess you should use os.environ['PATH'] += os.pathsep + '/usr/local/bin'
: see https://docs.python.org/3/library/os.....)
Another option is to automatically add /usr/local/bin
(or whatever directory is appropriate) to PATH for any notebook. You will need to create a Jupyter configuration file for this, and I can't see a way to do this while running Jupyter: you will have to use the Terminal. Locate the SageMath app; on my computer it is on my Desktop: it's /Users/palmieri/Desktop/SageMath-9-6.app
. From the Terminal, do this, replacing the first part with the location of your SageMath app:
% /Users/palmieri/Desktop/SageMath-9-6.app/Contents/Frameworks/Sage.framework/Versions/9.6/venv/bin/ipython profile create
This will print a message along these lines:
[ProfileCreate] Generating default config file: '/Users/palmieri/.ipython/profile_default/ipython_config.py'
[ProfileCreate] Generating default config file: '/Users/palmieri/.ipython/profile_default/ipython_kernel_config.py'
Now edit either of these files, I don't think it matters which one. These instructions come from @slelievre, via https://groups.google.com/g/sage-supp.... Find these lines:
## lines of code to run at IPython startup.
# Default: []
# c.InteractiveShellApp.exec_lines = []
Replace the last line with
c.InteractiveShellApp.exec_lines = ["import os; os.environ['PATH'] += ':/usr/local/bin' "]
(Make sure to remove the "#" at the start: that's a comment character.)
Welcome to Ask Sage! Thank you for your question.
Do the commands
from sage.features.imagemagick import ImageMagick; ImageMagick().require()
return without error? How aboutfrom sage.features.ffmpeg import FFmpeg; FFmpeg().require()
? (The animation works for me with ImageMagick installed but not ffmpeg. Maybe try deleting ffmpeg?)I tried what you suggested. I get the following error... Is this a python PATH issue? How do I fix? Thanks
FeatureNotPresentError Traceback (most recent call last) /var/folders/h5/lf9qnqx523s8_f80_bkb4j3c0000gp/T/ipykernel_2817/568311210.py in <module> ----> 1 from sage.features.imagemagick import ImageMagick; ImageMagick().require()
/private/var/tmp/sage-9.6-current/local/var/lib/sage/venv-python3.10.3/lib/python3.10/site-packages/sage/features/__init__.py in require(self) 207 presence = self.is_present() 208 if not presence: --> 209 raise FeatureNotPresentError(self, presence.reason, presence.resolution) 210 211 def __repr__(self):
FeatureNotPresentError: imagemagick is not available. Ex
On my machine, ImageMagick installs into
/usr/local/bin
. Try evaluatingos.environ['PATH']
from within Sage and see if/usr/local/bin
is listed.I get...
On my system, it looks like it's installed to /usr/local/lib
How do I add the necessary path? Or should I try to install ImageMagick to a different directory?
Thanks, Eric