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

Paul Moore p.f.moore at gmail.com
Thu Sep 28 03:40:34 EDT 2017


Are you aware of pipsi? If you do `pipsi install somepackage` it
creates a new virtualenv in ~/.local/.venvs, populates it with
somepackage and its dependencies, and then puts the entry point
scripts for somepackage into ~/.local/bin. It may be a useful way of
delivering your program, rather than building the virtualenv
management in yourself.

(On the other hand "download this file and run it" is a much easier
installation process than "install pipsi, do pipsi install myprogram,
then run the program", so it may not suit your use case...)

Paul

On 27 September 2017 at 19:03, Irmen de Jong <irmen at nospam.xs4all.nl> wrote:
> 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
> --
> https://mail.python.org/mailman/listinfo/python-list



More information about the Python-list mailing list