Hi.
Some of my python scripts use the psycopg2 module, which existed before but seems to be gone now on willow:
kayd@willow:~/parkingicons$ which python /opt/ts/python/2.7/bin/python kayd@willow:~/parkingicons$ python Python 2.7.1 (r271:86832, Jan 4 2011, 13:57:14) [GCC 4.5.2] on sunos5 Type "help", "copyright", "credits" or "license" for more information.
import psycopg2
Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: No module named psycopg2
or on nightshade:
kayd@nightshade:~/parkingicons$ which python /opt/ts/python/2.7/bin/python kayd@nightshade:~/parkingicons$ python Python 2.7.1 (r271:86832, Jan 4 2011, 13:57:14) [GCC 4.5.2] on sunos5 Type "help", "copyright", "credits" or "license" for more information.
import psycopg2
Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: No module named psycopg2
Could you please re-install it, or could I do that myself?
psycopg2 is used for postrges interfacing: http://www.initd.org/psycopg/ If there is a (better) alternative I should use instead, I would be pleased to use it :-)
Kind regards, Kay
Kay Drangmeister wrote:
Could you please re-install it, or could I do that myself?
You can install modules locally fairly easily. The process is pretty much:
$ python setup.py install --prefix=$HOME
Then you need to make sure that $PYTHONPATH includes your site-packages directory. You can check $PYTHONPATH with echo. To change it, edit .bashrc or .bash_profile to include something like...
export PYTHONPATH="/home/user:/home/user/lib/python2.6/site-packages"
You can also run export from the command line to set $PYTHONPATH for your current session. You may have trouble with scripts run from the web (via cgi-bin), but those problems are easy enough to work around generally, especially if you've ever used shared hosting elsewhere.
If you want the modules installed globally, you can file a ticket in JIRA: https://jira.toolserver.org. River mentioned something about some modules being unavailable for a short period on this list recently. Dunno what the status of that is.
If you learn (or have) some new tricks or tips, feel free to update http://wiki.toolserver.org/view/Python.
MZMcBride
toolserver-l@lists.wikimedia.org