Closed cosmicpudding closed 12 years ago
I think I encountered a similar error at some point, and I think I have fixed it. It is possible that this is version mismatch between other tools that pywcsgrid2 depends on. I just tested the current master branch of pywcsgrid2 with the following versions of modules and everything seems okay.
pyfits : 3.0.4 pywcs : 1.11-4.8.2
So,
Thanks for the quick reply!
I first tried installing newer versions of pyfits and pywcs so they are updated to the newest now and no effect.
So I downloaded the master branch as a zip file (I had downloaded from the 'Downloads' section which I guess is out of date now) and extracted, then ran setup.
Now I get a different error:
Traceback (most recent call last):
File "shassa_average_scripter.py", line 16, in
Which possibly is a Matplotlib issue so I'll try installing a newer version of that and see if it helps.
Will let you know, thanks!
I just installed Matplotlib 1.1.0 and I'm still getting the same error:
/Library/Python/2.6/site-packages/pywcsgrid2-0.1b1-py2.6.egg/pywcsgrid2/locator_formatter.py in
ImportError: cannot import name LocatorH
Without upgrading all my Python libraries and hoping one of them fixes it, I'm not sure how to get around this :(
Hmm, that is weird as I think matplotlib v1.1.0 should have mpl_toolkits.axisartist.angle_helper.LocatorH.
https://github.com/matplotlib/matplotlib/blob/v1.1.x/lib/mpl_toolkits/axisartist/angle_helper.py
I was actually testing with mpl v1.1.x and everything was fine.
Can you double check if correct version of matplotlib is getting imported?
import matplotlib
print matplotlib.__version__
print matplotlib
import mpl_toolkits.axisartist
print mpl_toolkits.axisartist
import mpl_toolkits.axisartist.angle_helper
print mpl_toolkits.axisartist.angle_helper.LocatorH
Hi again -- here is the output from putting that into Python (the same comes out if I go via iPython):
Python 2.6.1 (r261:67515, Jun 24 2010, 21:47:49) [GCC 4.2.1 (Apple Inc. build 5646)] on darwin Type "help", "copyright", "credits" or "license" for more information.
import matplotlib print matplotlib.version 1.1.0 print matplotlib <module 'matplotlib' from '/Library/Python/2.6/site-packages/matplotlib-1.1.0-py2.6-macosx-10.6-universal.egg/matplotlib/init.pyc'> import mpl_toolkits.axisartist /Library/Python/2.6/site-packages/matplotlib-1.1.0-py2.6-macosx-10.6-universal.egg/mpl_toolkits/init.py:2: UserWarning: Module pkg_resources was already imported from /Library/Python/2.6/site-packages/setuptools-0.6c9-py2.6.egg/pkg_resources.py, but /Library/Python/2.6/site-packages/distribute-0.6.24-py2.6.egg is being added to sys.path import('pkg_resources').declare_namespace(name) /Library/Python/2.6/site-packages/matplotlib-1.1.0-py2.6-macosx-10.6-universal.egg/mpl_toolkits/init.py:2: UserWarning: Module site was already imported from /System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site.pyc, but /Library/Python/2.6/site-packages/distribute-0.6.24-py2.6.egg is being added to sys.path import('pkg_resources').declare_namespace(name) print mpl_toolkits.axisartist <module 'mpl_toolkits.axisartist' from '/Library/Python/2.6/site-packages/matplotlib-1.1.0-py2.6-macosx-10.6-universal.egg/mpl_toolkits/axisartist/init.pyc'> import mpl_toolkits.axisartist.angle_helper print mpl_toolkits.axisartist.angle_helper.LocatorH Traceback (most recent call last): File "
", line 1, in AttributeError: 'module' object has no attribute 'LocatorH'
Not sure why this is happening.
Can you take a look the file
/Library/Python/2.6/site-packages/matplotlib-1.1.0-py2.6-macosx-10.6-universal.egg/mpl_toolkits/axisartist/angle_helper.py
and double check if LocatorH is indeed not defined?
How did yo install matpltolib 1.1.0? "angle_helper.py" included in the mpl 1.1.0 source tarball does define LocatorH.
@rhobslein: do you find anything about the angle_helper.py? Meanwhile, I just pushed new bug fix release (v0.1b2) that I believe fixes this bug. Please try it (you should be able to download it from the download page) and see if it works. Although, I'm afraid that the angle_helper.py issue may still give you an error.
Thanks for the reminder! I got a bit sidetracked trying to debug the matplotlib problem and left it :p
As you suggested, I looked at angle_helper.py and it is missing LocatorH. There seems to have been something buggy with my matplotlib installation and I think it is to do with gfortran not working properly and crashing the installation, so that's probably why angle_helper.py isn't updating to the proper version... I'll try the new download and see if that works.
Otherwise, will try to get someone to look at my matplotlib installation tomorrow! Thanks :)
Still the LocatorH error :( bummer.
I don't think you can help with this, but this is the matplotlib installation error:
lipo: can't open input file: /var/tmp//ccFuikw5.out (No such file or directory) error: Command "gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -DNDEBUG -g -fwrapv -Os -Wall -DENABLE_DTRACE -arch i386 -arch ppc -arch x86_64 -pipe -DPY_ARRAY_UNIQUE_SYMBOL=MPL_ARRAY_API -DPYCXX_ISO_CPP_LIB=1 -I/Library/Python/2.6/site-packages/numpy-2.0.0.dev_b5cdaee_20110710-py2.6-macosx-10.6-universal.egg/numpy/core/include -I. -I/Library/Python/2.6/site-packages/numpy-2.0.0.dev_b5cdaee_20110710-py2.6-macosx-10.6-universal.egg/numpy/core/include/freetype2 -I./freetype2 -I/System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6 -c src/ft2font.cpp -o build/temp.macosx-10.6-universal-2.6/src/ft2font.o" failed with exit status 1
I will try to get help with this tomorrow and get back to you. Thanks again for your help!
Hi again,
So the LocatorH functions (and presumably others) are definitely not in Matplotlib 1.1.0, it must be a 1.1.x thing? I tried to install 1.1.1 but since it is a release candidate it doesn't install properly. I did get help and a few things were tried but without completely destroying my existing Python libraries it doesn't seem possible to install anything other than Matplotlib 1.1.0 in its current form.
Now I guess it looks like the master branch of pywcsgrid2 cannot work on my computer due to the Matplotlib functions not being up to date, and the older version has that 'no wcs' issue that I originally posted about :(
Is there anything more to be done? Have you tried running the master branch of pywcsgrid2 with the current 1.1.0 release of Matplotlib? if that works for you then the problem might be something else...
1) As far as I can see, Matplotlib 1.1.0 does have LocatorH function. I just downloaded a source tarball and it is in there. Also, Here is the v1.1.0 tag of matplotlib. https://github.com/matplotlib/matplotlib/tree/0fc9830fe946f6221e9ceff2910cd0c2118b0965 And there is LocatorH. Of course, v1.1.x branch also has it. So, I recommend you to do a "clean" install of matplotlib v1.1.0. Delete installed matplotlib and mpl_toolkits (Note that mpl_toolkits directory may contain other modules). Download the source tarball of v1.1.0 and install from it.
2) As I mentioned in my previous post, I pushed a new 0.1b2 version of pywcsgrid2 which I believe fixed the wcs issue you originally reported (also see #9).
Sorry to be difficult... I am having immense trouble trying to install Matplotlib 1.1.0 from tarball (on a Mac).
I have tried installing the .dmg versions (all of them basically). and even though they say they have installed, there is still no LocatorH present. So is this function something that is only in the tarball version and not yet in a .dmg installation?
Every time I tried to install Matplotlib from source, I get the same error as above, referring to gcc-4.2 or so. I'm not familiar with what the error is and so have no idea why it is doing or what I can do to fix it. It doesn't matter which Matplotlib it is, it fails every time. I'm told that Matplotlib is renowned to be difficult to install from source on a Mac... so unless there is an obvious fix for the issue that is crashing the installation, I don't think I can install it from source.
If that's all that can be done, then thanks for your help and sorry to be a pain!
The dmg should match the tarball version. Can you remove the matplotlib package and reinstall (from the dmg), making sure that axis_artist files are also removed when matplotlib is removed?
Also, if you can, try the pywcsgrid2 v0.1b2. This should not require LocatorH.
If neither of these work for you, I guess there is not much I can help more.
That worked!!!
I downloaded (from the Downloads section) pywcsgrid2 v0.1b2, and deleted all the other pywcsgrid2 from /Library (since others were intervening when trying to import), and installed it and now it plots :) No 'wcs' issue either.
Awesomeness -- thanks lots for your help and patience! :)
Good to hear that! I'm closing this issue.
Hi,
I am getting this error when trying to plot a figure:
--> 188 pywcsgrid2.subplot(121,header=h) 189 imshow(d, origin="lower") 190
/Library/Python/2.6/site-packages/pywcsgrid2/init.pyc in subplot(_args, _kwargs) 45 fig = plt.gcf() 46 ax = Subplot(fig, _args, _kwargs) ---> 47 ax = plt.subplot(ax) 48 return ax 49
/Library/Python/2.6/site-packages/matplotlib-1.1.0-py2.6-macosx-10.6-universal.egg/matplotlib/pyplot.pyc in subplot(_args, _kwargs) 656 657 fig = gcf() --> 658 a = fig.add_subplot(_args, _kwargs) 659 bbox = a.bbox 660 byebye = []
/Library/Python/2.6/site-packages/matplotlib-1.1.0-py2.6-macosx-10.6-universal.egg/matplotlib/figure.pyc in add_subplot(self, _args, _kwargs) 736 a = args[0] 737 assert(a.get_figure() is self) --> 738 key = self._make_key(_args, _kwargs) 739 else: 740 kwargs = kwargs.copy()
/Library/Python/2.6/site-packages/matplotlib-1.1.0-py2.6-macosx-10.6-universal.egg/matplotlib/figure.pyc in _make_key(self, _args, *_kwargs) 629 return tuple(ret) 630 --> 631 key = fixlist(args), fixitems(kwargs.items()) 632 return key 633
/Library/Python/2.6/site-packages/matplotlib-1.1.0-py2.6-macosx-10.6-universal.egg/matplotlib/figure.pyc in fixlist(args) 625 ret = [] 626 for a in args: --> 627 if iterable(a): a = tuple(a) 628 ret.append(a) 629 return tuple(ret)
/Library/Python/2.6/site-packages/pywcsgrid2/axes_wcs.pyc in getitem(self, key) 1268 raise ValueError("invalide key : %s" % repr(key)) 1269 -> 1270 key = proj.sub([1,2]) 1271 1272 if key not in self._wcsgrid_wcsaxes:
/Library/Python/2.6/site-packages/pywcsgrid2/wcs_helper.pyc in sub(self, axes) 238 def sub(self, axes): 239 axis_nums_to_keep = [i-1 for i in axes] --> 240 return self.substitute(axis_nums_to_keep, [0] * self.naxis) 241 242
/Library/Python/2.6/site-packages/pywcsgrid2/wcs_helper.pyc in _get_naxis(self) 262 263 def _get_naxis(self): --> 264 return self._pywcs.wcs.naxis 265 266 naxis = property(_get_naxis)
AttributeError: 'int' object has no attribute 'wcs'
As far as I can tell this does not appear to be any issue with my code, but with pywcsgrid2 itself and it is not specific to the FITS file I am using - I've tried on a few different ones and get the same error each time.
Any suggestions as to how to fix this would be great! Thanks :)