Monday, September 2, 2013

Re: Warning about old install when upgrading via pip


On Mon, Sep 2, 2013 at 5:23 PM, Darren Spruell <phatbuckett@gmail.com> wrote:
Running Django in a virtualenv, have another instance of Django
installed system-wide on the system

When upgrading the virtualenv Django using 'pip install -U', I see
that the old version is uninstalled and the new version installed. At
the end of the upgrade, the package reports having been installed over
the top of a previous installation. The path to the previous
installation shows up as the installation of the system-wide Django.

[...]
Installing collected packages: Django
  Found existing installation: Django 1.4.5
    Uninstalling Django:
      Successfully uninstalled Django
  Running setup.py install for Django
    changing mode of build/scripts-2.7/django-admin.py from 644 to 755

    warning: no previously-included files matching '__pycache__' found
under directory '*'
    warning: no previously-included files matching '*.py[co]' found
under directory '*'
    changing mode of
/home/dspruell/venv.d/django-home/bin/django-admin.py to 755


    ========
    WARNING!
    ========

    You have just installed Django over top of an existing
    installation, without removing it first. Because of this,
    your install may now include extraneous files from a
    previous version that have since been removed from
    Django. This is known to cause a variety of problems. You
    should manually remove the

    /usr/local/lib/python2.7/site-packages/django

    directory and re-install Django.

Successfully installed Django
Cleaning up...


Is this an expected warning when upgrading Django via pip? And any
reason I'd be seeing references to the system-wide install (outside of
virtualenv) when I'm doing this upgrade within an active virtualenv?

It depends how your virtualenv was set up. 

virtualenv has a "--no-site-packages" option. On recent versions of virtualenv, this option is enabled by default. In older versions, --system-site-packages (the inverse of --no-site-packages) was the default.

This option controls whether the system's site packages should have an effect on your virtualenv -- that is, if you've installed something in your system python, should it be available in your virtualenv.

By the sounds of it, your virtualenv has been set up with --system-site-packages, and I suspect that's why you got the error message. When Django goes looking for certain management commands, or does app discovery for templates, it might get confused with *which* Django install it needs to be looking at.

If you were in a --no-site-packages virtualenv, pip should have done (and looks like it did do) a full uninstall before it installs the update, and you shouldn't get the error message you describe.

So - I suspect you may need to rebuild your virtualenv (possibly updating your version of virtualenv, too). pip freeze will help you determine what needs to be installed in your rebuilt virtualenv.

Yours,
Russ Magee %-)

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment