Developing a Django web app, I have a list of packages I need to install in a virtualenv. Say:
Django==1.3.1 --extra-index-url=http://dist.pinaxproject.com/dev/ Pinax==0.9b1.dev10 git+git://github.com/pinax/pinax-theme-bootstrap.git@cff4f5bbe9f87f0c67ee9ada9aa8ae82978f9890 # and other packages
Initially I installed them manually, one by one, along the development. This installed the required dependencies and I finally used pip freeze
before deploying the app.
Problem is, as I upgraded some packages, some dependencies are no longer used nor required but they keep being listed by pip freeze
.
Now, I'd like to set up a new virtualenv this way:
manual-requirements.txt
pip install -r manual-requirement.txt
(← problem, this does not install the dependencies)pip freeze -r manual-requirements.txt > full-requirements.txt
Any way to do this without manually re-installing the packages in a new virtualenv to get their dependencies ? This would be error-prone and I'd like to automate the process of cleaning the virtualenv from no-longer-needed old dependencies.
edit: actually, pip does install dependencies not explicitly listed in the requirement file, even if the documentation tells us that such files are flat. I was wrong about which dependencies i expected to be installed. I'll let this question for anyone in doubt about pip not installing all dependencies.
Pip relies on package authors to stipulate the dependencies for their code in order to successfully download and install the package plus all required dependencies from the Python Package Index (PyPI). But if packages are installed one at a time, it may lead to dependency conflicts.
In this case, you have two options: Use the pipdeptree utility to gather a list of all dependencies, create a requirements. txt file listing all the dependencies, and then download them with the pip download command. Get the list of dependencies for a package from the setup.py file.
Simply use:
pip install -r requirements.txt
This installs all dependencies listed in requirements.txt file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With