tags:

views:

361

answers:

3

I can see from the latest 8.2 (almost 1200 lines of code) twisted that I am missing something: http://twistedmatrix.com/trac/browser/trunk/twisted/words/protocols/jabber/xmlstream.py

My copy (697 lines from 3 years ago) is in: /System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/twisted/words/protocols/jabber/xmlstream.py

I ran the mac installer found on the website, all looked like it installed fine, but obviously something I am missing: http://twistedmatrix.com/trac/wiki/Downloads

Can someone tell me how to update twisted properly on my mac?

A: 

You can download that file you mentioned by scrolling to the bottom and click "Download in other formats"

Otherwise just do svn update.

Unknown
I'd like to not only update that file but the entire twisted framework
Anthony Webb
Then use svn update.
Unknown
If I do that would I just remove the existing twisted directory? Is there any sort of an install process for twisted or is it just as simple as placing the stuff from SVN into a directory?
Anthony Webb
It would be best if you just delete and update with SVN. Otherwise just install the file normally.
Unknown
A: 

The answer was hidden away here: http://twistedmatrix.com/trac/wiki/FrequentlyAskedQuestions#WhyamIgettingImportErrorsforTwistedsubpackagesonOSX10.5

Not really clear on exactly how/where to fix the issue though.

After some digging I was able to solve it with this:

From the command prompt type: pico ~/.bash_profile Add to the top of that file: export PYTHONPATH=~/Library/Python/2.5/site-packages/

Save and exit the file and you will finally be running the latest and greatest version twisted. (assuming that you have already downloaded and installed it from the twisted site)

Anthony Webb
+2  A: 

Try using virtualenv and pip (sudo easy_install virtualenv pip), which are great ways to avoid the dependency hell that you are experiencing.

With virtualenv you can create isolated Python environments, and then using pip you can directly install new packages into you virtualenvs.

Here is a complete example:


#create fresh virtualenv, void of old packages, and install latest Twisted
virtualenv --no-site-packages twisted_env
pip -E twisted_env install -U twisted

#now activate the virtualenv
cd twisted_env
source bin/activate

#test to see you have latest Twisted:
python -c "import twisted; print twisted.__version__"
clemesha