DavidMStraub / flavio-tutorial

MIT License
5 stars 9 forks source link

issue with plotting #1

Open Hakim777 opened 6 years ago

Hakim777 commented 6 years ago

When I try to run this line: fpl.error_budget_pie(err_bsmumu);

I get this:

`Error in callback <function install_repl_displayhook..post_execute at 0x11402c268> (for post_execute):

CalledProcessError Traceback (most recent call last) ~/anaconda3/envs/myenv/lib/python3.6/site-packages/matplotlib/texmanager.py in make_dvi(self, tex, fontsize) 392 cwd=self.texcache, --> 393 stderr=subprocess.STDOUT) 394 except subprocess.CalledProcessError as exc:

~/anaconda3/envs/myenv/lib/python3.6/subprocess.py in check_output(timeout, *popenargs, *kwargs) 335 return run(popenargs, stdout=PIPE, timeout=timeout, check=True, --> 336 **kwargs).stdout 337

~/anaconda3/envs/myenv/lib/python3.6/subprocess.py in run(input, timeout, check, *popenargs, **kwargs) 417 raise CalledProcessError(retcode, process.args, --> 418 output=stdout, stderr=stderr) 419 return CompletedProcess(process.args, retcode, stdout, stderr)

CalledProcessError: Command '['latex', '-interaction=nonstopmode', '9a9941363900849bf4a11d578a4291c3.tex']' returned non-zero exit status 1.

During handling of the above exception, another exception occurred:

RuntimeError Traceback (most recent call last) ~/anaconda3/envs/myenv/lib/python3.6/site-packages/matplotlib/pyplot.py in post_execute() 148 def post_execute(): 149 if matplotlib.is_interactive(): --> 150 draw_all() 151 152 # IPython >= 2

~/anaconda3/envs/myenv/lib/python3.6/site-packages/matplotlib/_pylab_helpers.py in draw_all(cls, force) 148 for f_mgr in cls.get_all_fig_managers(): 149 if force or f_mgr.canvas.figure.stale: --> 150 f_mgr.canvas.draw_idle() 151 152 atexit.register(Gcf.destroy_all)

~/anaconda3/envs/myenv/lib/python3.6/site-packages/matplotlib/backend_bases.py in draw_idle(self, *args, *kwargs) 2059 if not self._is_idle_drawing: 2060 with self._idle_draw_cntx(): -> 2061 self.draw(args, **kwargs) 2062 2063 def draw_cursor(self, event):

~/anaconda3/envs/myenv/lib/python3.6/site-packages/matplotlib/backends/backend_agg.py in draw(self) 428 # if toolbar: 429 # toolbar.set_cursor(cursors.WAIT) --> 430 self.figure.draw(self.renderer) 431 finally: 432 # if toolbar:

~/anaconda3/envs/myenv/lib/python3.6/site-packages/matplotlib/artist.py in draw_wrapper(artist, renderer, *args, *kwargs) 53 renderer.start_filter() 54 ---> 55 return draw(artist, renderer, args, **kwargs) 56 finally: 57 if artist.get_agg_filter() is not None:

~/anaconda3/envs/myenv/lib/python3.6/site-packages/matplotlib/figure.py in draw(self, renderer) 1297 1298 mimage._draw_list_compositing_images( -> 1299 renderer, self, artists, self.suppressComposite) 1300 1301 renderer.close_group('figure')

~/anaconda3/envs/myenv/lib/python3.6/site-packages/matplotlib/image.py in _draw_list_compositing_images(renderer, parent, artists, suppress_composite) 136 if not_composite or not has_images: 137 for a in artists: --> 138 a.draw(renderer) 139 else: 140 # Composite any adjacent images together

~/anaconda3/envs/myenv/lib/python3.6/site-packages/matplotlib/artist.py in draw_wrapper(artist, renderer, *args, *kwargs) 53 renderer.start_filter() 54 ---> 55 return draw(artist, renderer, args, **kwargs) 56 finally: 57 if artist.get_agg_filter() is not None:

~/anaconda3/envs/myenv/lib/python3.6/site-packages/matplotlib/axes/_base.py in draw(self, renderer, inframe) 2435 renderer.stop_rasterizing() 2436 -> 2437 mimage._draw_list_compositing_images(renderer, self, artists) 2438 2439 renderer.close_group('axes')

~/anaconda3/envs/myenv/lib/python3.6/site-packages/matplotlib/image.py in _draw_list_compositing_images(renderer, parent, artists, suppress_composite) 136 if not_composite or not has_images: 137 for a in artists: --> 138 a.draw(renderer) 139 else: 140 # Composite any adjacent images together

~/anaconda3/envs/myenv/lib/python3.6/site-packages/matplotlib/artist.py in draw_wrapper(artist, renderer, *args, *kwargs) 53 renderer.start_filter() 54 ---> 55 return draw(artist, renderer, args, **kwargs) 56 finally: 57 if artist.get_agg_filter() is not None:

~/anaconda3/envs/myenv/lib/python3.6/site-packages/matplotlib/text.py in draw(self, renderer) 713 714 with _wrap_text(self) as textobj: --> 715 bbox, info, descent = textobj._get_layout(renderer) 716 trans = textobj.get_transform() 717

~/anaconda3/envs/myenv/lib/python3.6/site-packages/matplotlib/text.py in _get_layout(self, renderer) 306 tmp, lp_h, lp_bl = renderer.get_text_width_height_descent('lp', 307 self._fontproperties, --> 308 ismath=False) 309 offsety = (lp_h - lp_bl) * self._linespacing 310

~/anaconda3/envs/myenv/lib/python3.6/site-packages/matplotlib/backends/backend_agg.py in get_text_width_height_descent(self, s, prop, ismath) 224 fontsize = prop.get_size_in_points() 225 w, h, d = texmanager.get_text_width_height_descent( --> 226 s, fontsize, renderer=self) 227 return w, h, d 228

~/anaconda3/envs/myenv/lib/python3.6/site-packages/matplotlib/texmanager.py in get_text_width_height_descent(self, tex, fontsize, renderer) 600 else: 601 # use dviread. It sometimes returns a wrong descent. --> 602 dvifile = self.make_dvi(tex, fontsize) 603 with dviread.Dvi(dvifile, 72 * dpi_fraction) as dvi: 604 page = next(iter(dvi))

~/anaconda3/envs/myenv/lib/python3.6/site-packages/matplotlib/texmanager.py in make_dvi(self, tex, fontsize) 398 'Here is the full report generated by LaTeX:\n%s ' 399 '\n\n' % (repr(tex.encode('unicode_escape')), --> 400 exc.output.decode("utf-8")))) 401 mpl.verbose.report(report, 'debug') 402 for fname in glob.glob(basefile + '*'):

RuntimeError: LaTeX was not able to process the following string: b'lp'

Here is the full report generated by LaTeX: This is pdfTeX, Version 3.14159265-2.6-1.40.17 (TeX Live 2016) (preloaded format=latex) restricted \write18 enabled. entering extended mode (./9a9941363900849bf4a11d578a4291c3.tex LaTeX2e <2016/03/31> Babel <3.9r> and hyphenation patterns for 22 language(s) loaded. (/usr/local/texlive/2016basic/texmf-dist/tex/latex/base/article.cls Document Class: article 2014/09/29 v1.4h Standard LaTeX document class (/usr/local/texlive/2016basic/texmf-dist/tex/latex/base/size10.clo))

! LaTeX Error: File `type1cm.sty' not found.

Type X to quit or to proceed, or enter new name. (Default extension: sty)

Enter file name: ! Emergency stop. <read *>

l.3 ^^M

No pages of output. Transcript written on 9a9941363900849bf4a11d578a4291c3.log.


CalledProcessError Traceback (most recent call last) ~/anaconda3/envs/myenv/lib/python3.6/site-packages/matplotlib/texmanager.py in make_dvi(self, tex, fontsize) 392 cwd=self.texcache, --> 393 stderr=subprocess.STDOUT) 394 except subprocess.CalledProcessError as exc:

~/anaconda3/envs/myenv/lib/python3.6/subprocess.py in check_output(timeout, *popenargs, *kwargs) 335 return run(popenargs, stdout=PIPE, timeout=timeout, check=True, --> 336 **kwargs).stdout 337

~/anaconda3/envs/myenv/lib/python3.6/subprocess.py in run(input, timeout, check, *popenargs, **kwargs) 417 raise CalledProcessError(retcode, process.args, --> 418 output=stdout, stderr=stderr) 419 return CompletedProcess(process.args, retcode, stdout, stderr)

CalledProcessError: Command '['latex', '-interaction=nonstopmode', '9a9941363900849bf4a11d578a4291c3.tex']' returned non-zero exit status 1.

During handling of the above exception, another exception occurred:

RuntimeError Traceback (most recent call last) ~/anaconda3/envs/myenv/lib/python3.6/site-packages/IPython/core/formatters.py in call(self, obj) 339 pass 340 else: --> 341 return printer(obj) 342 # Finally look for special method names 343 method = get_real_method(obj, self.print_method)

~/anaconda3/envs/myenv/lib/python3.6/site-packages/IPython/core/pylabtools.py in (fig) 236 237 if 'png' in formats: --> 238 png_formatter.for_type(Figure, lambda fig: print_figure(fig, 'png', kwargs)) 239 if 'retina' in formats or 'png2x' in formats: 240 png_formatter.for_type(Figure, lambda fig: retina_figure(fig, kwargs))

~/anaconda3/envs/myenv/lib/python3.6/site-packages/IPython/core/pylabtools.py in print_figure(fig, fmt, bbox_inches, kwargs) 120 121 bytes_io = BytesIO() --> 122 fig.canvas.print_figure(bytes_io, kw) 123 data = bytes_io.getvalue() 124 if fmt == 'svg':

~/anaconda3/envs/myenv/lib/python3.6/site-packages/matplotlib/backend_bases.py in print_figure(self, filename, dpi, facecolor, edgecolor, orientation, format, kwargs) 2214 orientation=orientation, 2215 dryrun=True, -> 2216 kwargs) 2217 renderer = self.figure._cachedRenderer 2218 bbox_inches = self.figure.get_tightbbox(renderer)

~/anaconda3/envs/myenv/lib/python3.6/site-packages/matplotlib/backends/backend_agg.py in print_png(self, filename_or_obj, *args, *kwargs) 505 506 def print_png(self, filename_or_obj, args, **kwargs): --> 507 FigureCanvasAgg.draw(self) 508 renderer = self.get_renderer() 509 original_dpi = renderer.dpi

~/anaconda3/envs/myenv/lib/python3.6/site-packages/matplotlib/backends/backend_agg.py in draw(self) 428 # if toolbar: 429 # toolbar.set_cursor(cursors.WAIT) --> 430 self.figure.draw(self.renderer) 431 finally: 432 # if toolbar:

~/anaconda3/envs/myenv/lib/python3.6/site-packages/matplotlib/artist.py in draw_wrapper(artist, renderer, *args, *kwargs) 53 renderer.start_filter() 54 ---> 55 return draw(artist, renderer, args, **kwargs) 56 finally: 57 if artist.get_agg_filter() is not None:

~/anaconda3/envs/myenv/lib/python3.6/site-packages/matplotlib/figure.py in draw(self, renderer) 1297 1298 mimage._draw_list_compositing_images( -> 1299 renderer, self, artists, self.suppressComposite) 1300 1301 renderer.close_group('figure')

~/anaconda3/envs/myenv/lib/python3.6/site-packages/matplotlib/image.py in _draw_list_compositing_images(renderer, parent, artists, suppress_composite) 136 if not_composite or not has_images: 137 for a in artists: --> 138 a.draw(renderer) 139 else: 140 # Composite any adjacent images together

~/anaconda3/envs/myenv/lib/python3.6/site-packages/matplotlib/artist.py in draw_wrapper(artist, renderer, *args, *kwargs) 53 renderer.start_filter() 54 ---> 55 return draw(artist, renderer, args, **kwargs) 56 finally: 57 if artist.get_agg_filter() is not None:

~/anaconda3/envs/myenv/lib/python3.6/site-packages/matplotlib/axes/_base.py in draw(self, renderer, inframe) 2435 renderer.stop_rasterizing() 2436 -> 2437 mimage._draw_list_compositing_images(renderer, self, artists) 2438 2439 renderer.close_group('axes')

~/anaconda3/envs/myenv/lib/python3.6/site-packages/matplotlib/image.py in _draw_list_compositing_images(renderer, parent, artists, suppress_composite) 136 if not_composite or not has_images: 137 for a in artists: --> 138 a.draw(renderer) 139 else: 140 # Composite any adjacent images together

~/anaconda3/envs/myenv/lib/python3.6/site-packages/matplotlib/artist.py in draw_wrapper(artist, renderer, *args, *kwargs) 53 renderer.start_filter() 54 ---> 55 return draw(artist, renderer, args, **kwargs) 56 finally: 57 if artist.get_agg_filter() is not None:

~/anaconda3/envs/myenv/lib/python3.6/site-packages/matplotlib/text.py in draw(self, renderer) 713 714 with _wrap_text(self) as textobj: --> 715 bbox, info, descent = textobj._get_layout(renderer) 716 trans = textobj.get_transform() 717

~/anaconda3/envs/myenv/lib/python3.6/site-packages/matplotlib/text.py in _get_layout(self, renderer) 306 tmp, lp_h, lp_bl = renderer.get_text_width_height_descent('lp', 307 self._fontproperties, --> 308 ismath=False) 309 offsety = (lp_h - lp_bl) * self._linespacing 310

~/anaconda3/envs/myenv/lib/python3.6/site-packages/matplotlib/backends/backend_agg.py in get_text_width_height_descent(self, s, prop, ismath) 224 fontsize = prop.get_size_in_points() 225 w, h, d = texmanager.get_text_width_height_descent( --> 226 s, fontsize, renderer=self) 227 return w, h, d 228

~/anaconda3/envs/myenv/lib/python3.6/site-packages/matplotlib/texmanager.py in get_text_width_height_descent(self, tex, fontsize, renderer) 600 else: 601 # use dviread. It sometimes returns a wrong descent. --> 602 dvifile = self.make_dvi(tex, fontsize) 603 with dviread.Dvi(dvifile, 72 * dpi_fraction) as dvi: 604 page = next(iter(dvi))

~/anaconda3/envs/myenv/lib/python3.6/site-packages/matplotlib/texmanager.py in make_dvi(self, tex, fontsize) 398 'Here is the full report generated by LaTeX:\n%s ' 399 '\n\n' % (repr(tex.encode('unicode_escape')), --> 400 exc.output.decode("utf-8")))) 401 mpl.verbose.report(report, 'debug') 402 for fname in glob.glob(basefile + '*'):

RuntimeError: LaTeX was not able to process the following string: b'lp'

Here is the full report generated by LaTeX: This is pdfTeX, Version 3.14159265-2.6-1.40.17 (TeX Live 2016) (preloaded format=latex) restricted \write18 enabled. entering extended mode (./9a9941363900849bf4a11d578a4291c3.tex LaTeX2e <2016/03/31> Babel <3.9r> and hyphenation patterns for 22 language(s) loaded. (/usr/local/texlive/2016basic/texmf-dist/tex/latex/base/article.cls Document Class: article 2014/09/29 v1.4h Standard LaTeX document class (/usr/local/texlive/2016basic/texmf-dist/tex/latex/base/size10.clo))

! LaTeX Error: File `type1cm.sty' not found.

Type X to quit or to proceed, or enter new name. (Default extension: sty)

Enter file name: ! Emergency stop. <read *>

l.3 ^^M

No pages of output. Transcript written on 9a9941363900849bf4a11d578a4291c3.log.

<matplotlib.figure.Figure at 0x114023da0>`

I have already installed: matplotlib/flavio[plotting]/numpy/scipy

DavidMStraub commented 6 years ago

Hi,

it is a LaTeX error. Is this a local install? which OS? Please try installing texlive-latex-extra and texlive-fonts-recommended.

Hakim777 commented 6 years ago

Hi

it's OS 10.10.5. I have already install LaTex from pip. From where I can install these texlive-latex-extra and texlive-fonts-recommended please?

DavidMStraub commented 6 years ago

LaTeX from pip? It is not a Python package. You should use your system package manager (homebrew?)

I think you are encountering this problem: https://stackoverflow.com/questions/11354149/python-unable-to-render-tex-in-matplotlib

Hakim777 commented 6 years ago

Thank you so much. I install MacTex and now it works!