RuntimeError: Failed to process string with tex because latex could not be found
Qixin913 opened this issue · 5 comments
When I tested your demo, the following error occurred.
what should I do? Thank u so much!! :)
/Users/qixin/miniconda3/envs/pyhso/bin/python /Users/qixin/Desktop/PhySO-main/demo/demo_damped_harmonic_oscillator/demo_damped_harmonic_oscillator.py
cpu
Traceback (most recent call last):
File "/Users/qixin/miniconda3/envs/pyhso/lib/python3.8/site-packages/matplotlib/texmanager.py", line 233, in _run_checked_subprocess
report = subprocess.check_output(
File "/Users/qixin/miniconda3/envs/pyhso/lib/python3.8/subprocess.py", line 415, in check_output
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
File "/Users/qixin/miniconda3/envs/pyhso/lib/python3.8/subprocess.py", line 493, in run
with Popen(*popenargs, **kwargs) as process:
File "/Users/qixin/miniconda3/envs/pyhso/lib/python3.8/subprocess.py", line 858, in init
self._execute_child(args, executable, preexec_fn, close_fds,
File "/Users/qixin/miniconda3/envs/pyhso/lib/python3.8/subprocess.py", line 1704, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'latex'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/Users/qixin/miniconda3/envs/pyhso/lib/python3.8/site-packages/matplotlib/backends/backend_macosx.py", line 41, in _draw
self.figure.draw(renderer)
File "/Users/qixin/miniconda3/envs/pyhso/lib/python3.8/site-packages/matplotlib/artist.py", line 73, in draw_wrapper
result = draw(artist, renderer, *args, **kwargs)
File "/Users/qixin/miniconda3/envs/pyhso/lib/python3.8/site-packages/matplotlib/artist.py", line 50, in draw_wrapper
return draw(artist, renderer)
File "/Users/qixin/miniconda3/envs/pyhso/lib/python3.8/site-packages/matplotlib/figure.py", line 2810, in draw
mimage._draw_list_compositing_images(
File "/Users/qixin/miniconda3/envs/pyhso/lib/python3.8/site-packages/matplotlib/image.py", line 132, in _draw_list_compositing_images
a.draw(renderer)
File "/Users/qixin/miniconda3/envs/pyhso/lib/python3.8/site-packages/matplotlib/artist.py", line 50, in draw_wrapper
return draw(artist, renderer)
File "/Users/qixin/miniconda3/envs/pyhso/lib/python3.8/site-packages/matplotlib/axes/_base.py", line 3082, in draw
mimage._draw_list_compositing_images(
File "/Users/qixin/miniconda3/envs/pyhso/lib/python3.8/site-packages/matplotlib/image.py", line 132, in _draw_list_compositing_images
a.draw(renderer)
File "/Users/qixin/miniconda3/envs/pyhso/lib/python3.8/site-packages/matplotlib/artist.py", line 50, in draw_wrapper
return draw(artist, renderer)
File "/Users/qixin/miniconda3/envs/pyhso/lib/python3.8/site-packages/matplotlib/axis.py", line 1159, in draw
ticklabelBoxes, ticklabelBoxes2 = self._get_tick_bboxes(ticks_to_draw,
File "/Users/qixin/miniconda3/envs/pyhso/lib/python3.8/site-packages/matplotlib/axis.py", line 1085, in _get_tick_bboxes
return ([tick.label1.get_window_extent(renderer)
File "/Users/qixin/miniconda3/envs/pyhso/lib/python3.8/site-packages/matplotlib/axis.py", line 1085, in
return ([tick.label1.get_window_extent(renderer)
File "/Users/qixin/miniconda3/envs/pyhso/lib/python3.8/site-packages/matplotlib/text.py", line 910, in get_window_extent
bbox, info, descent = self._get_layout(self._renderer)
File "/Users/qixin/miniconda3/envs/pyhso/lib/python3.8/site-packages/matplotlib/text.py", line 309, in _get_layout
_, lp_h, lp_d = renderer.get_text_width_height_descent(
File "/Users/qixin/miniconda3/envs/pyhso/lib/python3.8/site-packages/matplotlib/backends/backend_agg.py", line 259, in get_text_width_height_descent
w, h, d = texmanager.get_text_width_height_descent(
File "/Users/qixin/miniconda3/envs/pyhso/lib/python3.8/site-packages/matplotlib/texmanager.py", line 335, in get_text_width_height_descent
dvifile = self.make_dvi(tex, fontsize)
File "/Users/qixin/miniconda3/envs/pyhso/lib/python3.8/site-packages/matplotlib/texmanager.py", line 271, in make_dvi
self._run_checked_subprocess(
File "/Users/qixin/miniconda3/envs/pyhso/lib/python3.8/site-packages/matplotlib/texmanager.py", line 237, in _run_checked_subprocess
raise RuntimeError(
RuntimeError: Failed to process string with tex because latex could not be found
/Users/qixin/Desktop/PhySO-main/physo/physym/reward.py:118: UserWarning: Unable to optimize.py free constants of prog 115 -> r = 0
warnings.warn("Unable to optimize.py free constants of prog %i -> r = 0"%(i))
Figure(2800x1400)
Unable to make visualisation plots.
Unable to save pareto figure.
Hello,
I also encountered this problem, and I refer to #8 (comment) install latex with command pip install latex
and install latex app (MacTex) in this link, but the problem still exists.
After checking, this is because the latex binary program cannot be found in the new environment PhySO
created by Conda. Please check if there is a latex binary in your PATH
in the virtual environment PhySO
with the following commands:
conda activate PhySO
echo $PATH
If not, use the following command to add it in MacOS:
export PATH=/Library/TeX/texbin:$PATH
Hi @Qixin913, can you confirm that you were able to resolve your issue installing latex so I can close this thread ?
Hi @Qixin913, can you confirm that you were able to resolve your issue installing latex so I can close this thread ?
Hi @WassimTenachi Wassim, The latex problem was solved, Thank u very much!
Sure no problem ! :)