Opened 4 months ago
Closed 3 months ago
#33231 closed defect (fixed)
[Errno 86] Bad CPU type in executable: 'convert'
Reported by:  slabbe  Owned by:  

Priority:  major  Milestone:  sage9.6 
Component:  packages: optional  Keywords:  
Cc:  Merged in:  
Authors:  Sébastien Labbé  Reviewers:  Matthias Koeppe 
Report Upstream:  N/A  Work issues:  
Branch:  767fb8e (Commits, GitHub, GitLab)  Commit:  767fb8e61149a0727d4457bd8de4ee810b625d86 
Dependencies:  Stopgaps: 
Description (last modified by )
On !MacOS 10.15.7, 8core Core i9 2019 MacBook Pro, Justin reported the following failure https://groups.google.com/g/sagerelease/c/aOpjpfOXgro/m/pxW2mRdQAwAJ :
********************************************************************** File "src/sage/misc/latex.py", line 164, in sage.misc.latex.bool Failed example: have_convert() # random Exception raised: Traceback (most recent call last): File "sage/misc/cachefunc.pyx", line 996, in sage.misc.cachefunc.CachedFunction.__call__ (build/cythonized/sage/misc/cachefunc.c:5998) return self.cache[k] KeyError: ((), ()) During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/Users/Sage/sage9.5.rc4/local/var/lib/sage/venvpython3.9.9/lib/python3.9/sitepackages/sage/doctest/forker.py", line 694, in _run self.compile_and_execute(example, compiler, test.globs) File "/Users/Sage/sage9.5.rc4/local/var/lib/sage/venvpython3.9.9/lib/python3.9/sitepackages/sage/doctest/forker.py", line 1088, in compile_and_execute exec(compiled, globs) File "<doctest sage.misc.latex.bool[1]>", line 1, in <module> have_convert() # random File "sage/misc/cachefunc.pyx", line 1001, in sage.misc.cachefunc.CachedFunction.__call__ (build/cythonized/sage/misc/cachefunc.c:6126) w = self.f(*args, **kwds) File "/Users/Sage/sage9.5.rc4/local/var/lib/sage/venvpython3.9.9/lib/python3.9/sitepackages/sage/misc/latex.py", line 171, in have_convert return ImageMagick().is_present() File "/Users/Sage/sage9.5.rc4/local/var/lib/sage/venvpython3.9.9/lib/python3.9/sitepackages/sage/features/__init__.py", line 176, in is_present res = self._is_present() File "/Users/Sage/sage9.5.rc4/local/var/lib/sage/venvpython3.9.9/lib/python3.9/sitepackages/sage/features/join_feature.py", line 63, in _is_present test = f._is_present() File "/Users/Sage/sage9.5.rc4/local/var/lib/sage/venvpython3.9.9/lib/python3.9/sitepackages/sage/features/__init__.py", line 466, in _is_present return self.is_functional() File "/Users/Sage/sage9.5.rc4/local/var/lib/sage/venvpython3.9.9/lib/python3.9/sitepackages/sage/features/imagemagick.py", line 84, in is_functional result = run(cmd, cwd=base, capture_output=True, text=True) File "/Users/Sage/sage9.5.rc4/local/var/lib/sage/venvpython3.9.9/lib/python3.9/subprocess.py", line 505, in run with Popen(*popenargs, **kwargs) as process: File "/Users/Sage/sage9.5.rc4/local/var/lib/sage/venvpython3.9.9/lib/python3.9/subprocess.py", line 951, in __init__ self._execute_child(args, executable, preexec_fn, close_fds, File "/Users/Sage/sage9.5.rc4/local/var/lib/sage/venvpython3.9.9/lib/python3.9/subprocess.py", line 1821, in _execute_child raise child_exception_type(errno_num, err_msg, err_filename) OSError: [Errno 86] Bad CPU type in executable: 'convert' ********************************************************************** 1 item had failures: 1 of 23 in sage.misc.latex.bool
The is_functional
method in features/imagemagick.py
was added #33092.
Change History (5)
comment:1 Changed 4 months ago by
comment:2 Changed 4 months ago by
 Branch set to u/slabbe/33231
 Commit set to 767fb8e61149a0727d4457bd8de4ee810b625d86
 Description modified (diff)
 Status changed from new to needs_review
New commits:
767fb8e  33231: running the cmd inside of a try except clause

comment:3 Changed 4 months ago by
On my side, I tested the change by replacing convert
by convvert
in the cmd
which generates such an OSError
and I obtain:
sage: from sage.features.imagemagick import Convert sage: a = Convert().is_functional() sage: a FeatureTestResult('convert', False) sage: print(a.reason) Running command "convvert dispose Background delay 20 loop 0 tmp_6spbh_52.png tmp_6spbh_52.gif" raised an OSError "[Errno 2] No such file or directory: 'convvert'"
comment:4 Changed 4 months ago by
 Reviewers set to Matthias Koeppe
 Status changed from needs_review to positive_review
comment:5 Changed 3 months ago by
 Branch changed from u/slabbe/33231 to 767fb8e61149a0727d4457bd8de4ee810b625d86
 Resolution set to fixed
 Status changed from positive_review to closed
Note: See
TracTickets for help on using
tickets.
One possible solution is to put the line
inside of a
try
to catchOSError
type of failures and return False for feature not present.