Opened 16 years ago

Closed 16 years ago

Last modified 11 years ago

#18047 closed defect (fixed)

py25-matplotlib - 0.98.5.2 - Graphics fails when using CocoaAgg

Reported by: krunk7@… Owned by: skymoo (Adam Mercer)
Priority: Normal Milestone:
Component: ports Version: 1.7.0
Keywords: Cc:
Port: py25-matplotlib

Description (last modified by mf2k (Frank Schima))

If CocoaAgg is set in the matplotlibrc, an error is thrown:

"must have pyObjc installed"

After installing py25-pyobjc2 (for Leopard 10.5), the following error is produced on render:

:!python2.5 temp.py  2>&1| tee /var/folders/jT/jTtjyOlwG-iLpczTAAnRIE+++TM/-Tmp-/v182152/22
Traceback (most recent call last):
  File "temp.py", line 2, in <module>
    from pylab import *
  File "/opt/local/lib/python2.5/site-packages/pylab.py", line 1, in <module>
    from matplotlib.pylab import *
  File "/opt/local/lib/python2.5/site-packages/matplotlib/pylab.py", line 253, in <module>
    from matplotlib.pyplot import *
  File "/opt/local/lib/python2.5/site-packages/matplotlib/pyplot.py", line 75, in <module>
    new_figure_manager, draw_if_interactive, show = pylab_setup()
  File "/opt/local/lib/python2.5/site-packages/matplotlib/backends/__init__.py", line 25, in pylab_setup
    globals(),locals(),[backend_name])
  File "/opt/local/lib/python2.5/site-packages/matplotlib/backends/backend_cocoaagg.py", line 26, in <module>
    from Foundation import *
ImportError: No module named Foundation

Attachments (1)

temp.py (359 bytes) - added by krunk7@… 16 years ago.
Generic rendering code used to test CocoaAgg

Download all attachments as: .zip

Change History (12)

Changed 16 years ago by krunk7@…

Attachment: temp.py added

Generic rendering code used to test CocoaAgg

comment:1 Changed 16 years ago by mf2k (Frank Schima)

Description: modified (diff)
Owner: changed from macports-tickets@… to ram@…
Port: py25-matplotlib added

Please remember to use WikiFormatting.

comment:2 Changed 16 years ago by mf2k (Frank Schima)

import Foundation works fine for me in python 2.5 - tested in ipython2.5. Do you have python_select installed? Have you run:

sudo python_select python25

Maybe try re-installing py25-matplotlib now that py25-pyobjc2 is installed.

comment:3 in reply to:  2 Changed 16 years ago by krunk7@…

Replying to macsforever2000@…:

import Foundation works fine for me in python 2.5 - tested in ipython2.5. Do you have python_select installed? Have you run:

sudo python_select python25
jkyle ~  % which python                                  
/opt/local/bin/python
jkyle ~  % python --version
Python 2.5.4
jkyle ~  % 

Maybe try re-installing py25-matplotlib now that py25-pyobjc2 is installed.

I gave that a shot, still didn't work. Here's my current matplotlib variants args:

The following ports are currently installed:
  py25-matplotlib @0.98.5.2_0+cairo+ghostscript+gtk2+latex+wxpython (active)

I can even open up python (no ipython) and attempt to import Foundation, same error.

jkyle ~  % sudo port install py25-pyobjc2                 
--->  Fetching py25-pyobjc2
--->  Verifying checksum(s) for py25-pyobjc2
--->  Extracting py25-pyobjc2
--->  Configuring py25-pyobjc2
--->  Building py25-pyobjc2
--->  Staging py25-pyobjc2 into destroot
--->  Installing py25-pyobjc2 @2.0_0
--->  Activating py25-pyobjc2 @2.0_0
--->  Cleaning py25-pyobjc2
jkyle ~  % python
Python 2.5.4 (r254:67916, Jan  3 2009, 15:50:29) 
[GCC 4.0.1 (Apple Inc. build 5490)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import Foundation
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named Foundation
>>> 
Last edited 11 years ago by ryandesign (Ryan Carsten Schmidt) (previous) (diff)

comment:4 in reply to:  2 Changed 16 years ago by skymoo (Adam Mercer)

Status: newassigned

Replying to macsforever2000@…:

import Foundation works fine for me in python 2.5 - tested in ipython2.5.

Are you sure you aren't using the system python? AFAICT py25-pyobjc2 doesn't contain the Foundation modules, therefore they won't be available to the MacPorts python.

$ port installed py25-pyobjc2
The following ports are currently installed:
  py25-pyobjc2 @2.0_0 (active)
$ port contents py25-pyobjc2 | grep Foundation
$

comment:5 Changed 16 years ago by jmroot (Joshua Root)

Foundation is provided by py25-pyobjc2-cocoa.

comment:6 in reply to:  5 Changed 16 years ago by skymoo (Adam Mercer)

Replying to jmr@…:

Foundation is provided by py25-pyobjc2-cocoa.

Thanks, I'll look into supporting the CocoaAgg backend

comment:7 in reply to:  5 Changed 16 years ago by krunk7@…

Replying to jmr@…:

Foundation is provided by py25-pyobjc2-cocoa.

I've verified that I'm not using any system bins/libs

Ok, installing py25-pyobjc2-cocoa gets rid of the Foundation import error. However, I get this:

Traceback (most recent call last):
  File "set1.py", line 2, in <module>
    from pylab import *
  File "/opt/local/lib/python2.5/site-packages/pylab.py", line 1, in <module>
    from matplotlib.pylab import *
  File "/opt/local/lib/python2.5/site-packages/matplotlib/pylab.py", line 253, in <module>
    from matplotlib.pyplot import *
  File "/opt/local/lib/python2.5/site-packages/matplotlib/pyplot.py", line 75, in <module>
    new_figure_manager, draw_if_interactive, show = pylab_setup()
  File "/opt/local/lib/python2.5/site-packages/matplotlib/backends/__init__.py", line 25, in pylab_setup
    globals(),locals(),[backend_name])
  File "/opt/local/lib/python2.5/site-packages/matplotlib/backends/backend_cocoaagg.py", line 54, in <module>
    class FigureCanvasCocoaAgg(FigureCanvasAgg):
  File "/opt/local/lib/python2.5/site-packages/matplotlib/backends/backend_cocoaagg.py", line 63, in FigureCanvasCocoaAgg
    start_event_loop.__doc__=FigureCanvasBase.start_event_loop_default.__doc__
NameError: name 'FigureCanvasBase' is not defined
Last edited 11 years ago by ryandesign (Ryan Carsten Schmidt) (previous) (diff)

comment:8 Changed 16 years ago by skymoo (Adam Mercer)

I also get this error when running you're example script. I'll enquire with upstream.

comment:9 Changed 16 years ago by skymoo (Adam Mercer)

Upstream has responded to my query, there's a bug that is responsible for the backtrace which is now fixed in Matplotlib SVN. However it looks like there's not that much that can be done to get your example working, as that style of animation is no longer supported; they offer some alternatives maybe those can be of use.

I'll get the port patched with the fix so we don't have to wait for a new release.

comment:10 Changed 16 years ago by skymoo (Adam Mercer)

Resolution: fixed
Status: assignedclosed

backtrace fixed in r45788

comment:11 Changed 16 years ago by (none)

Milestone: Port Bugs

Milestone Port Bugs deleted

Note: See TracTickets for help on using tickets.