[Tutor] Installing modules with easy_install

eryksun eryksun at gmail.com
Tue Aug 28 21:52:26 CEST 2012


On Tue, Aug 28, 2012 at 2:39 PM, Ray Jones <crawlzone at gmail.com> wrote:
>
>> Do you have multiple python installations on your machine? Do you run
>> easy_install in one and ipython in another?
>
> Perhaps. But the module is not accessible from the 'python' shell, from
> 'idle', or from iPython.
>
> As I peruse Synaptic I find I have active installations of Ubuntu's
> basic python, python2.7, and python2.7-minimal. But are these separate
> installations? Virtually every system package thinks it's dependent on
> each one of these python packages.
>
> Suggestions?

Those are not separate installations. The python package depends on
python2.7 and python-minimal. The latter depends on python2.7-minimal.
You should be able to install pytz from the Ubuntu repository. Search
for the package python-tz. If you install from the repository, be sure
to manually delete the old installation in the local dist-packages
directory.

http://packages.ubuntu.com/search?searchon=names&keywords=python-tz

That said, in Debian Wheezy, pytz installs and runs fine from
/usr/local/lib/python2.7/dist-packages. You could hack a temporary fix
with a .pth file or using the PYTHONPATH environment variable, but
it's better to figure out the problem.

To help debug your problem, first check which Python installation
you're running. Run "ls -Hl `which python`". Is it /usr/bin/python?

Next check whether the latter path is actually in sys.path. In Debian,
on which Ubuntu is based, it gets added in /usr/lib/python2.7/site.py:

        elif os.sep == '/':
            sitepackages.append(os.path.join(prefix, "local/lib",
                                        "python" + sys.version[:3],
                                        "dist-packages"))
            sitepackages.append(os.path.join(prefix, "lib",
                                        "python" + sys.version[:3],
                                        "dist-packages"))

Next check /usr/local/lib/python2.7/dist-packages/easy_install.pth.
Does it have a line with "./pytz-2012d-py2.7.egg" to include the
latter directory on the path (ignore the wonky code to modify the
path's insertion point) ? Check inside that directory for a pytz
directory that has an __init__.py.


More information about the Tutor mailing list