Hello all,
I just upgraded to OSX 10.6 XCode, and I ran into a multitude of
problems with running and setting up TG2. As is typical of something
I would do, I upgraded knowing that I would need my laptop working for
a flight tomorrow and so spent much of the day (and night) trying to
figure out how I screwed everything up. Hopefully my adventures will
help someone out.
The main challenge in 10.6 seems to be the mix of 32 and 64-bit
python, gcc, and mysql that are now possible. I went with the 32-bit
approach, but maybe someone can come up with a 64-bit method. MySQLdb
proved especially painful, and failure to get it working in 64-bit is
why everything is done with 32-bits.
Again, SL comes with 64-bit Python 2.6. You may also have the 64-bit
version of mysql. You need to be sure everything is 32-bit for these
instructions to work! Also, you need the virtualenv package installed
(just easy_install it).
1) To install the virtual environment, you will need a 2.5 32-bit
Python. I used MacPort
(python-2.5.4-macosx.dmg) and installed it so that there are both a
2.6 64-bit and 2.5 32-bit
version.
Now, install the VE wherever you want, but force the 32-bit Python
version. Even if
/usr/bin/python -> python2.5 so that "python" brings up 2.5,
virtualenv will still use the 2.6
version (Why??). The --no-site-packages means that no packages are
taken from the base install of
the Python2.5 into the VE.
virtualenv -p python2.5 --no-site-packages ~/tg2env
Check that within the lib/ of the virtualenv, you have Python2.5 32-
bit and not 2.6
(or something else).
2) Now, make sure that the correct mysql is installed. Make sure to
set the -s link
in usr/local/mysql to the correct 32-bit version. I used mysql-5.1.38-
osx10.5-x86.dmg. Also, set
you mysql root and user password and permissions correctly. You can
also update the locate db with:
sudo /usr/libexec/locate.updatedb
This may help to find things in the next few steps.
3) Switch to the tg2env environment and install tg2
cd tg2env
source bin/activate
easy_install -i http://www.turbogears.org/2.0/downloads/current/index
tg.devtools
This should install TG2 and all of its dependencies.
===== Now, to get mysqldb working (The biggest pain by far) =====
4) Download MySQL-python-1.2.3c1.tar.gz and unzip into the tg2env.
Make sure you are working in the tg2env here! There are also
easy_install instructions, but I never got any of them to work.
5) Edit the site.cfg file and make threadsafe false. Also, if
mysql_config is not
in the path then you will need to tell setup where to look.
[options]
# embedded: link against the embedded server library
# threadsafe: use the threadsafe client
# static: link against a static library (probably required for
embedded)
embedded = False
==> threadsafe = False
static = False
# The path to mysql_config.
# Only use this if mysql_config is not on your PATH, or you have some
weird
# setup that requires it.
==> mysql_config = /usr/local/mysql/bin/mysql_config
# The Windows registry key for MySQL.
# This has to be set for Windows builds to work.
# Only change this if you have a different version.
registry_key = SOFTWARE\MySQL AB\MySQL Server 5.0
6) Now build mysqdb, but you will have to force it to use gcc-4.0. SL
has both gcc 4.0 and 4.2,
but I couldn't get 4.2 (probably 64-bit mix-up again) to work, so:
CC=/usr/bin/gcc-4.0 python setup.py build
CC=/usr/bin/gcc-4.0 python setup.py install
7) This should put a mysqldb into the Python2.5 site packages. Test
it with:
import MySQLdb
8) Finally, reportlab setup. Don't use the easy_install; instead,
download and unzip the tarball
into the tg2env. Again, using gcc-4.2 will cause problems, so set CC:
CC=/usr/bin/gcc-4.0 python setup.py build
CC=/usr/bin/gcc-4.0 python setup.py install
It should load correctly with "import reportlab"
You are done! If you get errors (library or headers not found,
cannot load library, etc) look first to a 32/64 bit mismatch!
That's it! Bedtime!!!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---