Error importing matplotlib.font_manager

Hi there.

I'm encountering the following error when importing
matplotlib.font_manager:

$ python
Python 2.5.1 (r251:54863, Jan 7 2008, 22:53:42) [GCC 4.2.2 (Gentoo 4.2.2 p1.0)] on linux2
Type "help", "copyright", "credits" or "license" for more information.

import matplotlib.font_manager

python: CXX/cxx_extensions.cxx:1128: virtual Py::PythonExtensionBase::~PythonExtensionBase(): Assertion `ob_refcnt == 0' failed.
Aborted

I wasn't able to figure out where the problem might be. Could anybody
help?

My (gentoo) system is the following:
matplotlib 0.91.2
python 2.5.1
GCC 4.2.2

Cheers,
Tiago

···

--
Tiago de Paula Peixoto <tiago@...1864...>

Another user reported this bug, which I still have been unable to reproduce --

http://sourceforge.net/mailarchive/message.php?msg_id=4794E454.4070700%40bostream.nu

Jorgen tracked it down to a specific font on his system that he was able to delete and then things worked. Unfortunately, when I tried the same font on my system, I could not reproduce the error. Perhaps this issue has to do with the *number* of fonts. Do you have an unusually large amount of fonts?

Cheers,
Mike

Tiago de Paula Peixoto wrote:

···

Hi there.

I'm encountering the following error when importing
matplotlib.font_manager:

$ python
Python 2.5.1 (r251:54863, Jan 7 2008, 22:53:42) [GCC 4.2.2 (Gentoo 4.2.2 p1.0)] on linux2
Type "help", "copyright", "credits" or "license" for more information.

import matplotlib.font_manager

python: CXX/cxx_extensions.cxx:1128: virtual Py::PythonExtensionBase::~PythonExtensionBase(): Assertion `ob_refcnt == 0' failed.
Aborted

I wasn't able to figure out where the problem might be. Could anybody
help?

My (gentoo) system is the following:
matplotlib 0.91.2
python 2.5.1
GCC 4.2.2

Cheers,
Tiago

--
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA

It also may be of interest which version of freetype you have installed.

Michael Droettboom wrote:

···

Another user reported this bug, which I still have been unable to reproduce --

http://sourceforge.net/mailarchive/message.php?msg_id=4794E454.4070700%40bostream.nu

Jorgen tracked it down to a specific font on his system that he was able to delete and then things worked. Unfortunately, when I tried the same font on my system, I could not reproduce the error. Perhaps this issue has to do with the *number* of fonts. Do you have an unusually large amount of fonts?

Cheers,
Mike

Tiago de Paula Peixoto wrote:

Hi there.

I'm encountering the following error when importing
matplotlib.font_manager:

$ python
Python 2.5.1 (r251:54863, Jan 7 2008, 22:53:42) [GCC 4.2.2 (Gentoo 4.2.2 p1.0)] on linux2
Type "help", "copyright", "credits" or "license" for more information.

import matplotlib.font_manager

python: CXX/cxx_extensions.cxx:1128: virtual Py::PythonExtensionBase::~PythonExtensionBase(): Assertion `ob_refcnt == 0' failed.
Aborted

I wasn't able to figure out where the problem might be. Could anybody
help?

My (gentoo) system is the following:
matplotlib 0.91.2
python 2.5.1
GCC 4.2.2

Cheers,
Tiago

--
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA

I'll also give a "blanket" answer to these sorts of gremlins:

   Remove the "build" directory in the source tree
   Remove site-packages/matplotlib (usually in /usr/lib/python2.5/site-packages)
   Rebuild everything

Cheers,
Mike

Michael Droettboom wrote:

···

It also may be of interest which version of freetype you have installed.

Michael Droettboom wrote:

Another user reported this bug, which I still have been unable to reproduce --

http://sourceforge.net/mailarchive/message.php?msg_id=4794E454.4070700%40bostream.nu

Jorgen tracked it down to a specific font on his system that he was able to delete and then things worked. Unfortunately, when I tried the same font on my system, I could not reproduce the error. Perhaps this issue has to do with the *number* of fonts. Do you have an unusually large amount of fonts?

Cheers,
Mike

Tiago de Paula Peixoto wrote:

Hi there.

I'm encountering the following error when importing
matplotlib.font_manager:

$ python
Python 2.5.1 (r251:54863, Jan 7 2008, 22:53:42) [GCC 4.2.2 (Gentoo 4.2.2 p1.0)] on linux2
Type "help", "copyright", "credits" or "license" for more information.

import matplotlib.font_manager

python: CXX/cxx_extensions.cxx:1128: virtual Py::PythonExtensionBase::~PythonExtensionBase(): Assertion `ob_refcnt == 0' failed.
Aborted

I wasn't able to figure out where the problem might be. Could anybody
help?

My (gentoo) system is the following:
matplotlib 0.91.2
python 2.5.1
GCC 4.2.2

Cheers,
Tiago

--
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA

More information: this problem reared its ugly head way back in 2005 and the same font (orlando.ttf) was the culprit then! :wink:

http://sourceforge.net/mailarchive/message.php?msg_id=42E69B61.4060008%40caltech.edu

Also, is it possible you have PyCXX installed in a system-wide location, such as /usr/include/CXX or /usr/include/python2.5/CXX ? If so, the compiler might be included those headers, but building with the matplotlib-included ones, causing all kinds of craziness. Try uninstalling pycxx and rebuilding matplotlib and see if that solves things.

Cheers,
Mike

Michael Droettboom wrote:

···

I'll also give a "blanket" answer to these sorts of gremlins:

  Remove the "build" directory in the source tree
  Remove site-packages/matplotlib (usually in /usr/lib/python2.5/site-packages)
  Rebuild everything

Cheers,
Mike

Michael Droettboom wrote:

It also may be of interest which version of freetype you have installed.

Michael Droettboom wrote:

Another user reported this bug, which I still have been unable to reproduce --

http://sourceforge.net/mailarchive/message.php?msg_id=4794E454.4070700%40bostream.nu

Jorgen tracked it down to a specific font on his system that he was able to delete and then things worked. Unfortunately, when I tried the same font on my system, I could not reproduce the error. Perhaps this issue has to do with the *number* of fonts. Do you have an unusually large amount of fonts?

Cheers,
Mike

Tiago de Paula Peixoto wrote:

Hi there.

I'm encountering the following error when importing
matplotlib.font_manager:

$ python
Python 2.5.1 (r251:54863, Jan 7 2008, 22:53:42) [GCC 4.2.2 (Gentoo 4.2.2 p1.0)] on linux2
Type "help", "copyright", "credits" or "license" for more information.

import matplotlib.font_manager

python: CXX/cxx_extensions.cxx:1128: virtual Py::PythonExtensionBase::~PythonExtensionBase(): Assertion `ob_refcnt == 0' failed.
Aborted

I wasn't able to figure out where the problem might be. Could anybody
help?

My (gentoo) system is the following:
matplotlib 0.91.2
python 2.5.1
GCC 4.2.2

Cheers,
Tiago

--
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA

Thanks for the prompt answer. This was indeed a font-related issue. I
temporarily moved my font collection out of the way -- it is not very
big, but contains some ttf fonts from random web sources -- and then
everything worked. I'll try to find out what font might be the cause,
and isolate it.

And for the record:

$ freetype-config --version
9.16.3

Thanks a lot!

Tiago

···

On 01/31/2008 02:58 PM, Michael Droettboom wrote:

More information: this problem reared its ugly head way back in 2005
and the same font (orlando.ttf) was the culprit then! :wink:

http://sourceforge.net/mailarchive/message.php?msg_id=42E69B61.4060008%40caltech.edu

Also, is it possible you have PyCXX installed in a system-wide
location, such as /usr/include/CXX or /usr/include/python2.5/CXX ? If
so, the compiler might be included those headers, but building with
the matplotlib-included ones, causing all kinds of craziness. Try
uninstalling pycxx and rebuilding matplotlib and see if that solves
things.

--
Tiago de Paula Peixoto <tiago@...1864...>