Skip to content
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

Usage in Docker #63

Closed
gkze opened this issue Jan 24, 2017 · 15 comments
Closed

Usage in Docker #63

gkze opened this issue Jan 24, 2017 · 15 comments

Comments

@gkze
Copy link

gkze commented Jan 24, 2017

What's the best workflow to use Pipenv with Docker?

I am trying to accomplish this with a Django project running inside Docker / Docker Compose.

Any tips / suggestions / ideas?

P.S. also, I am using https://github.com/yyuu/pyenv to automatically activate my virtualenvs and manage local Pythons. Does that not work well with this toolchain?

@kennethreitz
Copy link
Contributor

this would be a replacement for that workflow

@gkze
Copy link
Author

gkze commented Jan 24, 2017

I see, thank you. Great work on this @kennethreitz!

@gkze gkze closed this as completed Jan 24, 2017
@neverfox
Copy link

Well, pyenv is more than just a virtualenv manager (in fact, that aspect comes only as a plugin). It's real use case is to manage multiple Python versions on a single machine, which seems orthogonal to the use case of pipenv. So I think the question remains if they play nicely together.

@jacebrowning
Copy link
Contributor

I believe that https://github.com/kennethreitz/pipenv/issues/98, which we're in the midst of debugging, is caused by a pyenv incompatibility.

@gsemet
Copy link
Contributor

gsemet commented Jun 3, 2017

So, what is the advised workflow in docker ? I have a project using pipenv that requires twisted that cannot be built into my alpine docker. I want to use the provided alpine package py-twisted. Can pipenv install the dependencies directly on the system and not on a virtualenv (it looks like pipenv install --system still creates a virtualenv) ?

@nateprewitt
Copy link
Sponsor Member

@stibbons, yes, you can use --system to install the packages directly on the system. It does create a virtualenv as part of it's initialization check but we're looking into making that more sensible. The created virtualenv won't be utilized unless you run pipenv install without --system.

@gsemet
Copy link
Contributor

gsemet commented Jun 3, 2017

Great !

@gsemet
Copy link
Contributor

gsemet commented Jun 3, 2017

Does subsequent "pipenv run" knows the latest pipenv install has been executed with --system ? I have lot of issues on travis where (like in docker) I prefere to use the system's python instead of a virtualenv's one. Can pipenv run automatically finds out it need to use system's python?

(i also prefere using exactly the same chain of command between travis/docker and manual dev, instead of having to maintain 2 build scripts) ?

@clintonb
Copy link

It would be nice if we could set the use of --system as an environment variable (e.g. PIPENV_USE_SYSTEM). This would allow most commands and scripts to stay constant while using environment variables to change specific behaviors.

@gsemet
Copy link
Contributor

gsemet commented Nov 20, 2018

Good idea :) I use pipenv like usual in my docker, simply in prepend all command by pipenv run. This forces the use of a virtualenv inside the docker, maybe it is overkill. But I like the idea of the env var :)

@clintonb
Copy link

I'm honestly only using Pipenv because I like the Pipfile format. I would be more than happy if I could decouple that from the virtualenv. Pipenv may be made for humans, but I really need it to be useful for computers (e.g. automation).

@hackedhead
Copy link

@clintonb Agreed. I really want to leverage the protection of the Pipfile.lock mechanism, but when I'm using Docker, I'd prefer to leave the virtualenv aspect aside. It'd be awesome if those two features could become usable independently.

@techalchemy
Copy link
Member

Requirementslib has interfaces to both

@techalchemy
Copy link
Member

Also as of next release I enabled auto_envvar_prefix so you might be able to do something like PIPENV_RUN_SYSTEM=1

@clintonb
Copy link

Thanks @techalchemy!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants