weeheavy
weeheavy

Reputation: 255

Django: determine actually used pip packages

I got a Django project that was started without virtualenv. Now migrating to virtualenv and my requirements.txt created before is huge and not installable in the virtualenv (many errors as shown below). How can i generate a minimal list of required packages? Or is there some reference anywhere?

Could not find any downloads that satisfy the requirement PIL==1.1.7 (from -r requirements.txt (line 8))
Some externally hosted files were ignored (use --allow-external PIL to allow).
Cleaning up...
No distributions at all found for PIL==1.1.7 (from -r requirements.txt (line 8))

it's not only PIL that throws errors, if I comment it another package shows and i can't know what's really used for my application to work.

Thanks in advance!

Upvotes: 1

Views: 1457

Answers (2)

Mick T
Mick T

Reputation: 387

I've had the same problem and there are issues getting PIL to install using PIP as there's no PIL 1.7 in the default Python repos.

The easiest fix is this to add these options to the pip:

--allow-external PIL --allow-unverified PIL

For example:

pip install -r requirements.txt --allow-external PIL --allow-unverified PIL

The problem with this it is a potential security issue and you don't want to do this on a production server! :)

Your options are to use Pillow which is a fork of PIL:

Comments from the Pillow author, and you should verify that it works with you code.

Or try PIL 1.1.6 which is the Python Repos:

Or create your own repo and include the PIL 1.1.7 sources.

Or, if your on a Linux system install PIL using your distro's package management tool and remove PIL from your requirements file, and then rebuild your virutalenv.

You can this on Debian based distros like this:

sudo apt-get install python-imaging

Red Hat distros like this:

sudo yum install python-imaging

Upvotes: 0

madzohan
madzohan

Reputation: 11798

You can run pip freeze (related to system python used before virtualenv), this give you list of installed packages;

Then filter that list using following:

1) INSTALLED_APPS in settings

2) also check all from and import statement (search through the project)

Upvotes: 5

Related Questions