Error when importing pyplot from matplotlib: »invalid literal for float(): 19#«

Python claims to be unable to import pyplot. Apart from that, it has been
running absolutely fine.

I tried different versions of matplotlib, the one provided in my package
manager (apt-get) and two (stable & last stable) releases compiled from
source. I reinstalled all packages containting "python" on my system (Ubuntu
14.04 LTS). This error still occurs and prevents me from using pyplot.

What should I try next?

Python 2.7.6 (default, Jun 22 2015, 17:58:13)
[GCC 4.8.2] on linux2

from matplotlib import pyplot

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/pymodules/python2.7/matplotlib/pyplot.py", line 24, in
<module>
  import matplotlib.colorbar
File "/usr/lib/pymodules/python2.7/matplotlib/colorbar.py", line 29, in
<module>
  import matplotlib.collections as collections
File "/usr/lib/pymodules/python2.7/matplotlib/collections.py", line 23, in
<module>
  import matplotlib.backend_bases as backend_bases
File "/usr/lib/pymodules/python2.7/matplotlib/backend_bases.py", line 50, in
<module>
  import matplotlib.textpath as textpath
File "/usr/lib/pymodules/python2.7/matplotlib/textpath.py", line 11, in
<module>
  import matplotlib.font_manager as font_manager
File "/usr/lib/pymodules/python2.7/matplotlib/font_manager.py", line 1356,
in <module>
  _rebuild()
File "/usr/lib/pymodules/python2.7/matplotlib/font_manager.py", line 1341,
in _rebuild
  fontManager = FontManager()
File "/usr/lib/pymodules/python2.7/matplotlib/font_manager.py", line 1008,
in __init__
  self.afmlist = createFontList(self.afmfiles, fontext='afm')
File "/usr/lib/pymodules/python2.7/matplotlib/font_manager.py", line 563, in
createFontList
  font = afm.AFM(fh)
File "/usr/lib/pymodules/python2.7/matplotlib/afm.py", line 342, in __init__
  parse_afm(fh)
File "/usr/lib/pymodules/python2.7/matplotlib/afm.py", line 330, in
parse_afm
  dcmetrics_ascii, dcmetrics_name = _parse_char_metrics(fh)
File "/usr/lib/pymodules/python2.7/matplotlib/afm.py", line 203, in
_parse_char_metrics
  bbox = _to_list_of_floats(vals[3][2:])
File "/usr/lib/pymodules/python2.7/matplotlib/afm.py", line 69, in
_to_list_of_floats
  return [_to_float(val) for val in s.split()]
ValueError: invalid literal for float(): 19#

···

--
View this message in context: http://matplotlib.1069221.n5.nabble.com/Error-when-importing-pyplot-from-matplotlib-invalid-literal-for-float-19-tp46000.html
Sent from the matplotlib - users mailing list archive at Nabble.com.

You have an afm font file with a badly formed header. I thought this was fixed on the master branch though…

···

On Fri, Aug 7, 2015 at 4:51 PM knight91 <knight91@…273…> wrote:

Python claims to be unable to import pyplot. Apart from that, it has been

running absolutely fine.

I tried different versions of matplotlib, the one provided in my package

manager (apt-get) and two (stable & last stable) releases compiled from

source. I reinstalled all packages containting “python” on my system (Ubuntu

14.04 LTS). This error still occurs and prevents me from using pyplot.

What should I try next?

Python 2.7.6 (default, Jun 22 2015, 17:58:13)

[GCC 4.8.2] on linux2

from matplotlib import pyplot

Traceback (most recent call last):

File “”, line 1, in

File “/usr/lib/pymodules/python2.7/matplotlib/pyplot.py”, line 24, in

import matplotlib.colorbar

File “/usr/lib/pymodules/python2.7/matplotlib/colorbar.py”, line 29, in

import matplotlib.collections as collections

File “/usr/lib/pymodules/python2.7/matplotlib/collections.py”, line 23, in

import matplotlib.backend_bases as backend_bases

File “/usr/lib/pymodules/python2.7/matplotlib/backend_bases.py”, line 50, in

import matplotlib.textpath as textpath

File “/usr/lib/pymodules/python2.7/matplotlib/textpath.py”, line 11, in

import matplotlib.font_manager as font_manager

File “/usr/lib/pymodules/python2.7/matplotlib/font_manager.py”, line 1356,

in

_rebuild()

File “/usr/lib/pymodules/python2.7/matplotlib/font_manager.py”, line 1341,

in _rebuild

fontManager = FontManager()

File “/usr/lib/pymodules/python2.7/matplotlib/font_manager.py”, line 1008,

in init

self.afmlist = createFontList(self.afmfiles, fontext=‘afm’)

File “/usr/lib/pymodules/python2.7/matplotlib/font_manager.py”, line 563, in

createFontList

font = afm.AFM(fh)

File “/usr/lib/pymodules/python2.7/matplotlib/afm.py”, line 342, in init

parse_afm(fh)

File “/usr/lib/pymodules/python2.7/matplotlib/afm.py”, line 330, in

parse_afm

dcmetrics_ascii, dcmetrics_name = _parse_char_metrics(fh)

File “/usr/lib/pymodules/python2.7/matplotlib/afm.py”, line 203, in

_parse_char_metrics

bbox = _to_list_of_floats(vals[3][2:])

File “/usr/lib/pymodules/python2.7/matplotlib/afm.py”, line 69, in

_to_list_of_floats

return [_to_float(val) for val in s.split()]

ValueError: invalid literal for float(): 19#

View this message in context: http://matplotlib.1069221.n5.nabble.com/Error-when-importing-pyplot-from-matplotlib-invalid-literal-for-float-19-tp46000.html

Sent from the matplotlib - users mailing list archive at Nabble.com.



Matplotlib-users mailing list

Matplotlib-users@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Okay, is there a way to get an afm font file with a nicely formed header? How
could I try to solve this problem?

Thomas Caswell wrote

···

You have an afm font file with a badly formed header. I thought this was
fixed on the master branch though....

On Fri, Aug 7, 2015 at 4:51 PM knight91 &lt; > knight91@ > &gt; wrote:

Python claims to be unable to import pyplot. Apart from that, it has been
running absolutely fine.

I tried different versions of matplotlib, the one provided in my package
manager (apt-get) and two (stable & last stable) releases compiled from
source. I reinstalled all packages containting "python" on my system
(Ubuntu
14.04 LTS). This error still occurs and prevents me from using pyplot.

What should I try next?

Python 2.7.6 (default, Jun 22 2015, 17:58:13)
[GCC 4.8.2] on linux2
>>> from matplotlib import pyplot
Traceback (most recent call last):
File "

<stdin>
", line 1, in
<module>

File "/usr/lib/pymodules/python2.7/matplotlib/pyplot.py", line 24, in

<module>

  import matplotlib.colorbar
File "/usr/lib/pymodules/python2.7/matplotlib/colorbar.py", line 29, in

<module>

  import matplotlib.collections as collections
File "/usr/lib/pymodules/python2.7/matplotlib/collections.py", line 23,
in

<module>

  import matplotlib.backend_bases as backend_bases
File "/usr/lib/pymodules/python2.7/matplotlib/backend_bases.py", line 50,
in

<module>

  import matplotlib.textpath as textpath
File "/usr/lib/pymodules/python2.7/matplotlib/textpath.py", line 11, in

<module>

  import matplotlib.font_manager as font_manager
File "/usr/lib/pymodules/python2.7/matplotlib/font_manager.py", line
1356,
in

<module>

  _rebuild()
File "/usr/lib/pymodules/python2.7/matplotlib/font_manager.py", line
1341,
in _rebuild
  fontManager = FontManager()
File "/usr/lib/pymodules/python2.7/matplotlib/font_manager.py", line
1008,
in __init__
  self.afmlist = createFontList(self.afmfiles, fontext='afm')
File "/usr/lib/pymodules/python2.7/matplotlib/font_manager.py", line 563,
in
createFontList
  font = afm.AFM(fh)
File "/usr/lib/pymodules/python2.7/matplotlib/afm.py", line 342, in
__init__
  parse_afm(fh)
File "/usr/lib/pymodules/python2.7/matplotlib/afm.py", line 330, in
parse_afm
  dcmetrics_ascii, dcmetrics_name = _parse_char_metrics(fh)
File "/usr/lib/pymodules/python2.7/matplotlib/afm.py", line 203, in
_parse_char_metrics
  bbox = _to_list_of_floats(vals[3][2:])
File "/usr/lib/pymodules/python2.7/matplotlib/afm.py", line 69, in
_to_list_of_floats
  return [_to_float(val) for val in s.split()]
ValueError: invalid literal for float(): 19#

--
View this message in context: http://matplotlib.1069221.n5.nabble.com/Error-when-importing-pyplot-from-matplotlib-invalid-literal-for-float-19-tp46000p46002.html
Sent from the matplotlib - users mailing list archive at Nabble.com.

I don’t know for certain, but perhaps the font-forge program has a repair utility? http://fontforge.github.io/en-US/

···

On Sat, Aug 8, 2015 at 5:51 AM, knight91 <knight91@…273…> wrote:

Okay, is there a way to get an afm font file with a nicely formed header? How

could I try to solve this problem?

Thomas Caswell wrote

You have an afm font file with a badly formed header. I thought this was

fixed on the master branch though…

On Fri, Aug 7, 2015 at 4:51 PM knight91 <

knight91@

> wrote:

Python claims to be unable to import pyplot. Apart from that, it has been

running absolutely fine.

I tried different versions of matplotlib, the one provided in my package

manager (apt-get) and two (stable & last stable) releases compiled from

source. I reinstalled all packages containting “python” on my system

(Ubuntu

14.04 LTS). This error still occurs and prevents me from using pyplot.

What should I try next?

Python 2.7.6 (default, Jun 22 2015, 17:58:13)

[GCC 4.8.2] on linux2

from matplotlib import pyplot

Traceback (most recent call last):

File "

", line 1, in

File “/usr/lib/pymodules/python2.7/matplotlib/pyplot.py”, line 24, in

import matplotlib.colorbar

File “/usr/lib/pymodules/python2.7/matplotlib/colorbar.py”, line 29, in

import matplotlib.collections as collections

File “/usr/lib/pymodules/python2.7/matplotlib/collections.py”, line 23,

in

import matplotlib.backend_bases as backend_bases

File “/usr/lib/pymodules/python2.7/matplotlib/backend_bases.py”, line 50,

in

import matplotlib.textpath as textpath

File “/usr/lib/pymodules/python2.7/matplotlib/textpath.py”, line 11, in

import matplotlib.font_manager as font_manager

File “/usr/lib/pymodules/python2.7/matplotlib/font_manager.py”, line

1356,

in

_rebuild()

File “/usr/lib/pymodules/python2.7/matplotlib/font_manager.py”, line

1341,

in _rebuild

fontManager = FontManager()

File “/usr/lib/pymodules/python2.7/matplotlib/font_manager.py”, line

1008,

in init

self.afmlist = createFontList(self.afmfiles, fontext=‘afm’)

File “/usr/lib/pymodules/python2.7/matplotlib/font_manager.py”, line 563,

in

createFontList

font = afm.AFM(fh)

File “/usr/lib/pymodules/python2.7/matplotlib/afm.py”, line 342, in

init

parse_afm(fh)

File “/usr/lib/pymodules/python2.7/matplotlib/afm.py”, line 330, in

parse_afm

dcmetrics_ascii, dcmetrics_name = _parse_char_metrics(fh)

File “/usr/lib/pymodules/python2.7/matplotlib/afm.py”, line 203, in

_parse_char_metrics

bbox = _to_list_of_floats(vals[3][2:])

File “/usr/lib/pymodules/python2.7/matplotlib/afm.py”, line 69, in

_to_list_of_floats

return [_to_float(val) for val in s.split()]

ValueError: invalid literal for float(): 19#

View this message in context: http://matplotlib.1069221.n5.nabble.com/Error-when-importing-pyplot-from-matplotlib-invalid-literal-for-float-19-tp46000p46002.html
Sent from the matplotlib - users mailing list archive at Nabble.com.



Matplotlib-users mailing list

Matplotlib-users@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Also try deleting your font cache.

Have you tried with the master branch?

Tom

···

On Sat, Aug 8, 2015 at 5:51 AM, knight91 <knight91@…273…> wrote:

Okay, is there a way to get an afm font file with a nicely formed header? How

could I try to solve this problem?

Thomas Caswell wrote

You have an afm font file with a badly formed header. I thought this was

fixed on the master branch though…

On Fri, Aug 7, 2015 at 4:51 PM knight91 <

knight91@

> wrote:

Python claims to be unable to import pyplot. Apart from that, it has been

running absolutely fine.

I tried different versions of matplotlib, the one provided in my package

manager (apt-get) and two (stable & last stable) releases compiled from

source. I reinstalled all packages containting “python” on my system

(Ubuntu

14.04 LTS). This error still occurs and prevents me from using pyplot.

What should I try next?

Python 2.7.6 (default, Jun 22 2015, 17:58:13)

[GCC 4.8.2] on linux2

from matplotlib import pyplot

Traceback (most recent call last):

File "

", line 1, in

File “/usr/lib/pymodules/python2.7/matplotlib/pyplot.py”, line 24, in

import matplotlib.colorbar

File “/usr/lib/pymodules/python2.7/matplotlib/colorbar.py”, line 29, in

import matplotlib.collections as collections

File “/usr/lib/pymodules/python2.7/matplotlib/collections.py”, line 23,

in

import matplotlib.backend_bases as backend_bases

File “/usr/lib/pymodules/python2.7/matplotlib/backend_bases.py”, line 50,

in

import matplotlib.textpath as textpath

File “/usr/lib/pymodules/python2.7/matplotlib/textpath.py”, line 11, in

import matplotlib.font_manager as font_manager

File “/usr/lib/pymodules/python2.7/matplotlib/font_manager.py”, line

1356,

in

_rebuild()

File “/usr/lib/pymodules/python2.7/matplotlib/font_manager.py”, line

1341,

in _rebuild

fontManager = FontManager()

File “/usr/lib/pymodules/python2.7/matplotlib/font_manager.py”, line

1008,

in init

self.afmlist = createFontList(self.afmfiles, fontext=‘afm’)

File “/usr/lib/pymodules/python2.7/matplotlib/font_manager.py”, line 563,

in

createFontList

font = afm.AFM(fh)

File “/usr/lib/pymodules/python2.7/matplotlib/afm.py”, line 342, in

init

parse_afm(fh)

File “/usr/lib/pymodules/python2.7/matplotlib/afm.py”, line 330, in

parse_afm

dcmetrics_ascii, dcmetrics_name = _parse_char_metrics(fh)

File “/usr/lib/pymodules/python2.7/matplotlib/afm.py”, line 203, in

_parse_char_metrics

bbox = _to_list_of_floats(vals[3][2:])

File “/usr/lib/pymodules/python2.7/matplotlib/afm.py”, line 69, in

_to_list_of_floats

return [_to_float(val) for val in s.split()]

ValueError: invalid literal for float(): 19#

View this message in context: http://matplotlib.1069221.n5.nabble.com/Error-when-importing-pyplot-from-matplotlib-invalid-literal-for-float-19-tp46000p46002.html
Sent from the matplotlib - users mailing list archive at Nabble.com.



Matplotlib-users mailing list

Matplotlib-users@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/matplotlib-users