Search code examples
djangovirtualenvpipdjango-nonrel

Setting up django-nonrel using pip


I'm trying to install django-nonrel the correct way - and to be able to reproduce the process.

I've installed django-nonrel using pip - as following:

pip install git+https://github.com/django-nonrel/django-nonrel.git
pip install git+https://github.com/django-nonrel/django-dbindexer.git
pip install git+https://github.com/django-nonrel/django-permission-backend-nonrel
pip install hg+https://bitbucket.org/wkornewald/djangoappengine
pip install hg+https://bitbucket.org/wkornewald/djangotoolbox
pip install hg+https://bitbucket.org/twanschik/django-autoload
pip install hg+https://bitbucket.org/twanschik/nonrel-search/src

After installation, I got this req.txt file (pip freeze > req.txt):

Django==1.3.1
django-autoload==0.01
django-dbindexer==0.3
djangoappengine==1.0
djangotoolbox==0.9.2
nonrel-search==0.1
permission-backend-nonrel==0.1
wsgiref==0.1.2

But I can't use my req.txt file to get the same stuff. If I uninstall a package (e.g. django-autoload) and try to get it again using the requirements file

(gae-first)bentzy@lama:~/.virtualenvs/gae-first$ pip uninstall django-autoload
Uninstalling django-autoload:
...
Successfully uninstalled django-autoload
(gae-first)bentzy@lama:~/.virtualenvs/gae-first$ pip install -r req.txt 
Requirement already satisfied (use --upgrade to upgrade): Django==1.3.1       in ./lib/python2.7/site-packages (from -r req.txt (line 1))
Downloading/unpacking django-autoload==0.01 (from -r req.txt (line 2))
Could not find any downloads that satisfy the requirement django-autoload==0.01 (from -r req.txt (line 2))
No distributions at all found for django-autoload==0.01 (from -r req.txt (line 2))
Storing complete log in /home/bentzy/.pip/pip.log

Why aren't those packages at pip repository?

It still make sense to use pip to install them?


Solution

  • The problem is that your requirements file does not have enough information.

    What pip is going to do when you request it to install django-autoload, for instance, is look at PyPI for that package (and scrap some pages after finding the PyPI entry).

    If you want to have a requirements file that downloads those packages the same way you did while installing one by one, do the same: tell pip where to find packages.

    Create a requirements file like:

    git+https://github.com/django-nonrel/django-nonrel.git
    git+https://github.com/django-nonrel/django-dbindexer.git
    git+https://github.com/django-nonrel/django-permission-backend-nonrel
    hg+https://bitbucket.org/wkornewald/djangoappengine
    hg+https://bitbucket.org/wkornewald/djangotoolbox
    hg+https://bitbucket.org/twanschik/django-autoload
    hg+https://bitbucket.org/twanschik/nonrel-search/src
    

    Or if you want to install from specific tag or commit, do:

    git+https://github.com/django-nonrel/[email protected]#egg=Django
    

    Read more about requirements file at http://www.pip-installer.org/en/latest/logic.html#requirements-file-format