From: Chris B. <Chr...@no...> - 2005-06-16 23:59:31
|
Hi all, As promised, I've been working on building my binary package for matplotlib 0.82 for OS-X. I've got the one for Apple's python2.3 on OS-X 10.3.* working now. I'm having a little trouble with a version for Python 2.4. If I use: $ sudo python2.4 setup.py install It seems to work fine (Yahoo!) But if I use bdist_mpkg, then install the package, I get this when I try to import matplotlib: >>> import matplotlib Traceback (most recent call last): File "<stdin>", line 1, in ? File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib/__init__.py", line 509, in ? defaultParams = { File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib/__init__.py", line 245, in wrapper ret = func(*args, **kwargs) File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib/__init__.py", line 318, in _get_data_path raise RuntimeError('Could not find the matplotlib data files') RuntimeError: Could not find the matplotlib data files I suspect this is a Py2app error (or a setup.py incompatibility with matplotlib), but I don't know where it is looking for the matplotlib data files, so I'm not sure how to debug this. By the way, if I install with "setup.py install", then remove site-packages/matplotlib, then install with the package, it works, so I guess that means that the data files are being installed outside of site-packages/matplotlib where would that be? thanks, -Chris PS: in another note, I'll post how I'm compiling all this, so you can comment on that. -- Christopher Barker, Ph.D. Oceanographer NOAA/OR&R/HAZMAT (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception Chr...@no... |
From: Robert K. <rk...@uc...> - 2005-06-17 00:23:42
|
Chris Barker wrote: > Hi all, > > As promised, I've been working on building my binary package for > matplotlib 0.82 for OS-X. I've got the one for Apple's python2.3 on OS-X > 10.3.* working now. I'm having a little trouble with a version for > Python 2.4. If I use: > > $ sudo python2.4 setup.py install > > It seems to work fine (Yahoo!) > > But if I use bdist_mpkg, then install the package, I get this when I try > to import matplotlib: > > >>> import matplotlib > Traceback (most recent call last): > File "<stdin>", line 1, in ? > File > "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib/__init__.py", > line 509, in ? > defaultParams = { > File > "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib/__init__.py", > line 245, in wrapper > ret = func(*args, **kwargs) > File > "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib/__init__.py", > line 318, in _get_data_path > raise RuntimeError('Could not find the matplotlib data files') > RuntimeError: Could not find the matplotlib data files > > I suspect this is a Py2app error (or a setup.py incompatibility with > matplotlib), but I don't know where it is looking for the matplotlib > data files, so I'm not sure how to debug this. > > By the way, if I install with "setup.py install", then remove > site-packages/matplotlib, then install with the package, it works, so I > guess that means that the data files are being installed outside of > site-packages/matplotlib where would that be? Probably /System/Libraray/Frameworks/Python.framework/Versions/Current/share/... I always use the following setup.cfg when building matplotlib: [install] install-data=/usr/local You can check where the package is placing the data files by looking at matplotlib-<etc>.mpkg/Contents/Packages/matplotlib-data-<etc>.pkg/Contents/Info.plist under the IFPkgFlagDefaultLocation key. Note that this isn't quite the same as the install-data. It is usually <install-data>/share/matplotlib. At my request, matplotlib now searches /usr/local/share/matplotlib by default on OS X. -- Robert Kern rk...@uc... "In the fields of hell where the grass grows high Are the graves of dreams allowed to die." -- Richard Harter |
From: Chris B. <Chr...@no...> - 2005-06-17 18:04:35
|
Robert Kern wrote: >> I guess that means that the data files are being installed outside of >> site-packages/matplotlib where would that be? > > > Probably > /System/Libraray/Frameworks/Python.framework/Versions/Current/share/... That's where they are put by the 2.3 package > I always use the following setup.cfg when building matplotlib: > > [install] > install-data=/usr/local > > You can check where the package is placing the data files by looking at > matplotlib-<etc>.mpkg/Contents/Packages/matplotlib-data-<etc>.pkg/Contents/Info.plist > under the IFPkgFlagDefaultLocation key. Note that this isn't quite the > same as the install-data. It is usually <install-data>/share/matplotlib. > > At my request, matplotlib now searches /usr/local/share/matplotlib by > default on OS X. The 2.4 package is putting it in: /usr/local/share/share/matplotlib/ Note the double "share". I'm guessing that's the problem. I don't have the time to dig into this further right now, but if someone just knows how to fix it and can tell me, great! -Chris -- Christopher Barker, Ph.D. Oceanographer NOAA/OR&R/HAZMAT (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception Chr...@no... |
From: Charles M. <cm...@in...> - 2005-06-17 18:20:25
|
I got this same problem with bdist_mpkg. You can just edit the plist file to point to the right directory as Robert mentioned. Replace /usr/local/share with whatever you want. As a point of preference, I think the data should be installed in "System/Libraray/Frameworks/Python.framework/Versions/Current/" since this is the install root of the rest of matplotlib. Putting it in /usr/local seems to me like you are putting your build "all over" the place and losing the notion of the install-root. I reiterate, this is my opinion so take it fwiw. - Charlie Chris Barker wrote: > Robert Kern wrote: > >>> I guess that means that the data files are being installed outside of >>> site-packages/matplotlib where would that be? >> >> >> >> Probably >> /System/Libraray/Frameworks/Python.framework/Versions/Current/share/... > > > That's where they are put by the 2.3 package > >> I always use the following setup.cfg when building matplotlib: >> >> [install] >> install-data=/usr/local >> >> You can check where the package is placing the data files by looking >> at >> matplotlib-<etc>.mpkg/Contents/Packages/matplotlib-data-<etc>.pkg/Contents/Info.plist >> under the IFPkgFlagDefaultLocation key. Note that this isn't quite the >> same as the install-data. It is usually <install-data>/share/matplotlib. >> >> At my request, matplotlib now searches /usr/local/share/matplotlib by >> default on OS X. > > > The 2.4 package is putting it in: > > /usr/local/share/share/matplotlib/ > > Note the double "share". I'm guessing that's the problem. I don't have > the time to dig into this further right now, but if someone just knows > how to fix it and can tell me, great! > > -Chris > > |
From: Robert K. <rk...@uc...> - 2005-06-17 18:58:36
|
Chris Barker wrote: > The 2.4 package is putting it in: > > /usr/local/share/share/matplotlib/ > > Note the double "share". I'm guessing that's the problem. I don't have > the time to dig into this further right now, but if someone just knows > how to fix it and can tell me, great! Use --install-data=/usr/local not /usr/local/share . That's probably a bug in matplotlib's setup.py somewhere. Pretty much every other package expects --install-data=/usr/local/share or the like. /usr/local/<etc> is the place to put these things. /System/Library/<etc> is just inaccessible. -- Robert Kern rk...@uc... "In the fields of hell where the grass grows high Are the graves of dreams allowed to die." -- Richard Harter |
From: Chris B. <Chr...@no...> - 2005-06-17 19:51:05
|
Robert Kern wrote: > Chris Barker wrote: >> /usr/local/share/share/matplotlib/ >> >> Note the double "share". I'm guessing that's the problem. > Use --install-data=/usr/local not /usr/local/share. I didn't use --install-data anything! However, perhaps Py2App is. > That's probably a > bug in matplotlib's setup.py somewhere. Pretty much every other package > expects --install-data=/usr/local/share or the like. OK, then that would explain why Py2App is appending the extra "share". If the convention is to expect the "share" to be part of install-data, then it shouldn't be in the setup.py. However, I'm a little confused, as then the default would be to put it straight into the python root directory. With a straight "setup.py install" it now goes into: /Library/...../Versions/2.4/share/matplotlib so without the share, it would go into: /Library/...../Versions/2.4/matplotlib Which really doesn't seem right. Maybe we could check for a "share" at the end of the given path and only add it if it's not there, but that really feels like a kludge. > /usr/local/<etc> is the place to put these things. /System/Library/<etc> > is just inaccessible. /System/Library is not good, but /Library/... is no less accessible. For another take: Bob Ippolito wrote: > Using data_files in this manner at all is usually the wrong thing to > do anyway. Python packages should really put the files they need > into the package, not some semi-random location on the filesystem. I tend to trust Bob in these matters. What is the logic for putting all that stuff outside of the package directory? -Chris -- Christopher Barker, Ph.D. Oceanographer NOAA/OR&R/HAZMAT (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception Chr...@no... |
From: John H. <jdh...@ac...> - 2005-06-17 20:10:32
|
>>>>> "Chris" == Chris Barker <Chr...@no...> writes: > Using data_files in this manner at all is usually the wrong thing > to do anyway. Python packages should really put the files they > need into the package, not some semi-random location on the > filesystem. Chris> I tend to trust Bob in these matters. What is the logic for Chris> putting all that stuff outside of the package directory? I was just following the lead of the distutils documentation circa 2003 which is when this section of setup.py written. Since distutils had a slot for data_files, I put my data files there, which seems reasonable even in hindsight. I'm not opposed to putting them somewhere else, especially if someone explains the why and how. I do try and preserve compatibility with older python versions, so 2.4 only solutions are not a good choice at the moment. JDH |
From: Bob I. <bo...@re...> - 2005-06-17 20:20:27
|
On Jun 17, 2005, at 4:09 PM, John Hunter wrote: >>>>>> "Chris" == Chris Barker <Chr...@no...> writes: >>>>>> > > >> Using data_files in this manner at all is usually the wrong thing >> to do anyway. Python packages should really put the files they >> need into the package, not some semi-random location on the >> filesystem. >> > > Chris> I tend to trust Bob in these matters. What is the logic for > Chris> putting all that stuff outside of the package directory? > > I was just following the lead of the distutils documentation circa > 2003 which is when this section of setup.py written. Since distutils > had a slot for data_files, I put my data files there, which seems > reasonable even in hindsight. I'm not opposed to putting them > somewhere else, especially if someone explains the why and how. I do > try and preserve compatibility with older python versions, so 2.4 only > solutions are not a good choice at the moment. Python 2.4 distutils has the functionality built-in, otherwise you can get it from setuptools (in the Python CVS sandbox, or from <http://peak.telecommunity.com/DevCenter/PythonEggs>). There have been various other hacks throughout the years to do it, but setuptools is the standard now. py2app uses setuptools when building itself, and it is certainly Python 2.3 compatible. -bob |
From: John H. <jdh...@ac...> - 2005-07-05 22:47:24
|
>>>>> "Bob" == Bob Ippolito <bo...@re...> writes: Bob> On Jun 17, 2005, at 4:09 PM, John Hunter wrote: >>>>>>> "Chris" == Chris Barker <Chr...@no...> writes: >>>>>>> >> >>> Using data_files in this manner at all is usually the wrong >>> thing to do anyway. Python packages should really put the >>> files they need into the package, not some semi-random >>> location on the filesystem. >>> >> Chris> I tend to trust Bob in these matters. What is the logic for Chris> putting all that stuff outside of the package directory? >> I was just following the lead of the distutils documentation >> circa 2003 which is when this section of setup.py written. >> Since distutils had a slot for data_files, I put my data files >> there, which seems reasonable even in hindsight. I'm not >> opposed to putting them somewhere else, especially if someone >> explains the why and how. I do try and preserve compatibility >> with older python versions, so 2.4 only solutions are not a >> good choice at the moment. Bob> Python 2.4 distutils has the functionality built-in, Bob> otherwise you can get it from setuptools (in the Python CVS Bob> sandbox, or from Bob> <http://peak.telecommunity.com/DevCenter/PythonEggs>). There Bob> have been various other hacks throughout the years to do it, Bob> but setuptools is the standard now. Bob> py2app uses setuptools when building itself, and it is Bob> certainly Python 2.3 compatible. Hi Bob, Sorry for the delay getting back on this. I am starting to look at setuptools and have read over (quickly) http://peak.telecommunity.com/DevCenter/PythonEggs A couple of questions: * Are you recommending using the full PythonEggs suite, or just the parts in the default setuptools that comes with python2.4 ? I notice for example, that pkg_resources is not available in Python 2.4.1 setuptools. This is not a huge problem, since it is fairly easy to install/upgrade. Just wondering. * It is not clear to me what the "right" way is to distribute/install data files (eg fonts). You suggest above that the data_files directive is not the right way and that the data files should be placed in the package. I naively tried package_data with from setuptools import setup setup(name="matplotlib", ...snip... package_data = { 'matplotlib.fonts' : glob.glob('fonts/afm/*.afm'), }, package_dir = {'': 'lib'}, ) where fonts/afm in the relative path has a bunch of *.afm fonts, but no files were added to site-packages/matplotlib/fonts/ when I did a 'sudo python setup.py install'. I read over the py2app setup at http://svn.red-bean.com/bob/py2app/trunk/setup.py but still was unsure how to proceed. The PythonEgg resource documentation spends a fair amount of space on how to "access" resources, but I missed how to specify them for the distribution (http://peak.telecommunity.com/DevCenter/PythonEggs#accessing-package-resources) So that is a long-winded way of asking "how should data files be placed in the package for distribution?" Thanks, JDH |