Skip to content

Make it possible to freeze requirements without installing the packages #747

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
hickford opened this issue Dec 12, 2012 · 5 comments
Closed
Labels
auto-locked Outdated issues that have been locked by automation C: freeze 'pip freeze' related type: enhancement Improvements to functionality

Comments

@hickford
Copy link

I'm writing a Python app to deploy on Heroku. Per Heroku's guide, I need to list package requirements in a Pip requirements.txt file. They suggest installing the packages locally, then running pip freeze > requirements.txt.

However, one of the packages I want to use in deployment on Heroku can't be installed locally. It's incompatible with my operating system.

So how do I write a requirements.txt including this package suitable for Heroku?

The only way I can think of is to write it by hand - but this would be tedious, because the package in question has dependencies of its own. Besides, this defeats the convenience of pip.

If this isn't possible in pip, I think it should be possible. This is a real world use case and Bundler can do it (example below).


When deploying Ruby apps to Heroku, Bundler makes this easy. In my Gemfile I write

gem "pg", :group => :production
gem "sqlite3", :group => :development

The command bundle install then writes a frozen version list Gemfile.lock (analogous to requirements.txt). It doesn't install the packages listed under the 'production' group, but it still freezes a consistent list of versioned packages.

Example: Gemfile and Gemfile.lock

@sigmavirus24
Copy link
Member

@matt-hickford the answer is in that question on StackOverflow, in more than one comment/answer.

@qwcode
Copy link
Contributor

qwcode commented Dec 13, 2012

generally speaking, if you need different requirements for different environments, then maintain 2 requirements files.
you can minimize the redundancy, by using the the recursive feature:
http://www.pip-installer.org/en/latest/requirements.html#recursive-requirements

if you want to discuss solutions with pip users, feel free to use the pip mailing list.
https://groups.google.com/forum/?hl=en&fromgroups#!forum/python-virtualenv

I'm closing, since this is not a bug or feature request.

@qwcode qwcode closed this as completed Dec 13, 2012
@hickford
Copy link
Author

Hi Marcus. Sorry, my Stack Overflow question I copied wasn't very clear. My feature request concerns the second part of question - how to write the requirements.txt for Heroku, when it's impossible to install one of the packages locally (because of platform differences).

I've edited the issue description above. If it makes sense, please re-open the issue. Thanks for your patience.

@qwcode
Copy link
Contributor

qwcode commented Dec 13, 2012

ok, so a feature request to allow pip to generate an exhaustive requirements file for what pip would install (into a clean environment), given some set of top-level requirements. I can't think of a way to do that now in pip, unless I'm missing something. so I'm leaving the issue open.

@qwcode qwcode reopened this Dec 13, 2012
@xavfernandez xavfernandez added type: enhancement Improvements to functionality C: freeze 'pip freeze' related labels Oct 8, 2015
@dstufft
Copy link
Member

dstufft commented Mar 24, 2017

Closing this, I believe that this use case is best solved by pip-compile from pip-tools.

@dstufft dstufft closed this as completed Mar 24, 2017
@lock lock bot added the auto-locked Outdated issues that have been locked by automation label Jun 3, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Jun 3, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
auto-locked Outdated issues that have been locked by automation C: freeze 'pip freeze' related type: enhancement Improvements to functionality
Projects
None yet
Development

No branches or pull requests

5 participants