[BangPypers] setuptools and distutils confusion

Noufal Ibrahim noufal at gmail.com
Wed Aug 24 08:44:43 CEST 2011


Amit Sethi <amit.pureenergy at gmail.com> writes:

> Hi all,
> I am really confused as to how setuptools and distutils work.
> Basically what i want to achieve is be able to install packages in my
> local environment and not globally ( just a preference ) . I know I
> can use virtualenv and distribute but i just want to do some simple
> testing and don't really want to setup a virtualenv for that.

The first question is why. Virtualenv is designed for exactly this and
trying to not use it will create more problems than it solves.

distribute *is* setuptools (a fork which is more featureful) so there's
no difference there. 

> The usual practice I adopted for this was that in setup.py I would
> change the lines
> from setuptools import setup
> to
> from distutils.core import setup
> this way i can use
>
> python setup.py develop instead of python setup.py install
> and it will install the package in the same directory
>
> but it turns out when i use python setup.py develop in this fashion
> while this particular package is installed locally all other packages
> acquired from pypi are installed in the usual way . Is there any way i
> can solve that make it install all packages locally ..

The "develop" command installs all dependencies and make some other
changes so that you can use your existing copy directly without having
to "install" it. 

I suppose you could manually download/unpack all your dependencies into
the right places and then fix your PYTHONPATH to pick them up
properly. You could also automate this but it would be a pain. So, my
basic question is - why not use virtualenv. 


[...]


-- 
~noufal
http://nibrahim.net.in

Evil isn't all bad.


More information about the BangPypers mailing list