tyrs icon indicating copy to clipboard operation
tyrs copied to clipboard

Unable to install on OSX.

Open kezabelle opened this issue 14 years ago • 4 comments

The setup build/install script seems to be heavily opinionated in ways that make it hard to install tyrs on OSX. Specifically:

  • When doing pip install tyrs the build will fail because the build tries to call out to intltool-update, which isn't part of the OSX toolchain - this can be circumvented by using mxcl/homebrew to do brew install intltool.
  • Once that is overcome, it seems the setup expects site-packages to be at a certain location:
running build_i18n
intltool-update -p -g tyrs
msgfmt po/es.po -o build/mo/es/LC_MESSAGES/tyrs.mo
msgfmt po/fr.po -o build/mo/fr/LC_MESSAGES/tyrs.mo
running install_lib
creating /usr/lib/python2.6/site-packages
error: could not create '/usr/lib/python2.6/site-packages': Permission denied

The default version of Python on a mac doesn't have site-packages in that directory, and I suspect those installed by fink/macports/homebrew may have different opinions on where it should be, too.

Running python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()" yields /Library/Python/2.6/site-packages rather than /usr/lib/python2.6/site-packages.

Similarly, attempting to install in a virtualenv (virtualenv {anything} --no-site-packages) provides the same error, indicating that it may be a problem for more than just the default Python installed on Macs.

kezabelle avatar Nov 08 '11 21:11 kezabelle

Thank you for all those details,

As I don't own anything else that Linux, I haven't try to install on OSX (or even Windows), and I'm a beginner with packaging for Python as well. I'll try to google for some more information about packaging for OSX, but I won't even be able to test it, and it won't be so easy for me then.

I'll see what I can do thought, and sorry

Thanks

Nic0 avatar Nov 09 '11 11:11 Nic0

I've never packaged anything for Python, so you're already doing better than I :)

I have, however, pip installed all manner of stuff over the years, and none has ever required intltool, or distutils extra. Many other packages that provide .po files for translations seem to get by without said requirement, presumably by building the translations before packaging? This is mostly speculation - I don't even know how to package things.

I think that testing you can pip install tyrs into a throwaway virtualenv (probably something like below)

virtualenv throwaway --no-site-packages
source throwaway/bin/activate
pip install tyrs

would at least fix the site-packages issue I've documented, which may be the only outstanding issue (as intltool can at least be installed via homebrew)

kezabelle avatar Nov 10 '11 19:11 kezabelle

To further this issue, with this small diff, I am able to install to a virtualenv successfully via python setup.py develop && python setup.py build && python setup.py install (each run separately to verify they work).

diff --git a/setup.cfg b/setup.cfg
index abefc9a..0f910b3 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -1,6 +1,3 @@
-[install]
-prefix=/usr
-
 [build]
 i18n = True

Basically, the prefix in the setup.cfg seems to take precedence in lieu of an --install-option="--prefix=?", and removing it leaves it, presumably, up to distutils, setuptools or whatever.

That still leaves the Distutils-extra/intltool part, which ideally I'd like to get around (because I've never encountered another package requiring it, which is indicitive of there being some workaround (I also can't find any documentation for it on Canonical's Launchpad)), but at least it installs.

kezabelle avatar Jan 03 '12 21:01 kezabelle

Thanks for this, and sorry, I didn't really take time to look at this issue. About the distutils-extra, it was required for the build_i18n stuff, but haven't look deeply into it. Thanks by the way for your nice and clean bug repport.

Nic0 avatar Jan 04 '12 09:01 Nic0