]> scripts.mit.edu Git - www/raw.git/blob - faq/126.mdwn
Import from TextPattern
[www/raw.git] / faq / 126.mdwn
1 [[!meta title="How can I install Python modules in my locker?"]]
2 First, note that many Python modules are already installed on
3 scripts.mit.edu, and we’re generally pretty willing to install
4 generally-useful software globally; email us at
5 [scripts@mit.edu](mailto:scripts@mit.edu) to ask. This has the
6 advantage that you won’t have to worry about keeping the packages
7 up to date; in some cases, using out-of-date modules could lead to
8 security vulnerabilities in your site.
9
10 Sometimes, however, you may want to install a specific Python
11 module from [PyPI](http://pypi.python.org/) in your locker, say
12 because you want to modify it or because you need a different
13 version than what’s installed globally. This is pretty straight
14 forward. First, you need to create the directory to install into
15 and give scripts.mit.edu permission to it. From an Athena prompt,
16 do the following, where lockername is the name of your locker:
17
18     % add consult
19     % mkdir -p /mit/lockername/.local/lib/python2.7/site-packages/
20     % fsr sa /mit/lockername/.local/lib/python2.7/site-packages/ \
21         daemon.scripts write
22
23 Then, to install a package,
24 [ssh into scripts.mit.edu as your locker](/faq/41/) and run
25
26     $ easy_install --user -Z packagename
27
28 where packagename is the package you want to install. To upgrade
29 something you already have installed, simply do:
30
31     $ easy_install --user -Z -U packagename
32
33 These packages will be automatically available to Python scripts
34 you run on scripts.mit.edu.
35
36 Note that because the modules are tied to the minor version of
37 Python they were built with, you will need to install the modules
38 again if the system Python is upgraded. Be sure to add yourself to
39 the
40 [scripts-announce mailing list](http://mailman.mit.edu/mailman/listinfo/scripts-announce)
41 so you will be notified about such transitions.
42
43
44