help-guix
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Replicable environment with Python packages missing from Guix


From: wolf
Subject: Re: Replicable environment with Python packages missing from Guix
Date: Mon, 9 Oct 2023 15:13:36 +0200

On 2023-10-05 15:00:13 +0200, Lasse Schlör wrote:
> Hello,
> 
> I am in the process of setting up a replicable environment (OS & software 
> versions) for a research project using Guix. This includes an installation of 
> the Python package PsychoPy.
> 
> As far as I understand, the ideal way to do this is to use a `manifest.scm` 
> file that includes a `python-psychopy` package together with a `channels.scm` 
> to pin/freeze the exact software versions.
> 
> Currently, no PsychoPy package exists for Guix, and so I attempted to write 
> my own Guix packages for PsychoPy and those of its dependencies that don't 
> exist as Guix packages either.
> 
> However, while I was able to successfully wrap a few Python packages as Guix 
> packages, the number of build and test dependencies turns out to be quite 
> large, and I am not sure I have the knowledge and time to write Guix packages 
> for all of them.

You could try to use output of `guix import'[0] as a base.

0: 
https://guix.gnu.org/manual/en/manual/devel/en/html_node/Invoking-guix-import.html

> 
> As a workaround, I have instead written a manifest file that provides a fixed 
> version of Python, Pip, and some of PsychoPy's dependencies. I can use this 
> to start a container with `guix time-machine […] -- shell --container 
> --share=path/to/persistent/.local=/home/username/.local […]`, which has a 
> persistent `~/.local` directory, into which the correct version of PsychoPy 
> can be installed via `python3 -m pip install -r path/to/requirements.txt`. 
> Making `~/.local` persistent allows to start new instances of this container 
> without having to re-install PsychoPy every time.
> 
> Of course, this doesn't feel as elegant as the purely functional Guix way of 
> doing things. I am sure others before me have had similar situations. Thus, 
> my question is: Is there a known/preferred/elegant way of creating replicable 
> Guix environments with fixed versions of Python packages when these packages 
> do not exist as Guix packages?

Maybe someone will correct me and provide a better way, but I am afraid the
correct approach here is to indeed create the packages in the manifest file.

Hm, maybe there is an ugly solution, which however might work.  You could do the
pip install and then archive and package the resulting directory.  That will be
messy, but it might work.

However, I would recommend just trying to make the packages, possibly using guix
import.

> 
> I'd appreciate any insight on this.
> 
> Thanks and best regards,
> Lasse Schlör
> 
>

W.

-- 
There are only two hard things in Computer Science:
cache invalidation, naming things and off-by-one errors.

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]