auto installing dependencies with pip to run a python zip application ?

Irmen de Jong irmen at NOSPAM.xs4all.nl
Wed Sep 27 14:03:04 EDT 2017


On 09/27/2017 09:50 AM, Paul Moore wrote:

>>> What you could do is pip install your binary dependencies into a
>>> directory in $TEMP using --target, then add that directory to
>>> sys.path. Probably easier than building a full virtualenv. Bundle pip
>>> with your app if you can't assume your users will have pip available.
>>
>> Interesting idea, although like this wouldn't I have to download the
>> dependencies every time I launch my game? (unless I re-use the same
>> temporary directory every time)
> 
> Ah, I'd assumed that's what you were doing with the virtualenv, I
> hadn't realised you were talking about a one-off setup step. Yeah,
> re-using a temporary directory doesn't buy you much compared to using
> a virtualenv (particularly if you can target versions of Python that
> have the built in venv module).

Well, I was planning on using a fixed name/location for the virtualenv.
That way when you request pip to install the dependencies again at next
launch, it will detect them already satisfied and not download/reinstall
everything. I could even test for their existence first myself in my
application (which is what I'm already doing now, to give the user a
clear error message) and only invoke pip when a dependency is missing.


-irmen



More information about the Python-list mailing list