* Use of python pip packages and python virtual environments in guix
@ 2023-09-18 15:07 Timothee Mathieu
2023-09-21 7:12 ` Hartmut Goebel
0 siblings, 1 reply; 2+ messages in thread
From: Timothee Mathieu @ 2023-09-18 15:07 UTC (permalink / raw)
To: help-guix
Hello,
I am new to guix, and I would like to use the containers in order to have reproducible development environments for python.
A lot of the packages that I use are not on guix yet and it would be too long and a lot of work to actually put them as packages, hence I want to
use both guix shell -C for container in order to be able to fix the C libraries and a python virtual environment inside the container to fix the python versions.
However, if I do that, I need to set the LD_LIBRARY_PATH to /lib and use guix shell -F otherwise the python libraries do not find the shared libraries.
I saw here: https://issues.guix.gnu.org/25072 that my solution was not good (they say it is a hacking) and I was wondering what is good practice to use python virtual environments in guix.
I think having a way to handle this would be a great tool for producing reproducible article by providing a middle ground between full guix packages (which is time consuming) and what is done actually with python pip.
Thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Use of python pip packages and python virtual environments in guix
2023-09-18 15:07 Use of python pip packages and python virtual environments in guix Timothee Mathieu
@ 2023-09-21 7:12 ` Hartmut Goebel
0 siblings, 0 replies; 2+ messages in thread
From: Hartmut Goebel @ 2023-09-21 7:12 UTC (permalink / raw)
To: Timothee Mathieu, help-guix
Am 18.09.23 um 17:07 schrieb Timothee Mathieu:
> I am new to guix, and I would like to use the containers in order to have reproducible development environments for python.
I'm using python virtual env on top of guix, automated using direnv.
Anyhow I did not yet try to setup containers for this.
Anyhow, my .envrc might be a starting point:
strict_env
# Colors constants
__NONE="$(tput sgr0)"
__GREEN="$(tput setaf 2)"
__BOLD=$(tput bold)
use_guix --ad-hoc glibc-locales python-wrapper python-pip
python-virtualenv \
python-pyyaml # add whatever you need
__has_pyenv=no
if [ $(ls $(direnv_layout_dir) 2>/dev/null | grep --count python ||
true) != 0 ] ; t
hen
__has_pyenv=yes
fi
if [ $__has_pyenv != yes ] ; then
echo "${__GREEN}${__BOLD}Setting up virtual environment${__NONE}"
layout_python3
python -m pip install -U pip
else
path_add PATH $(ls -d $(direnv_layout_dir)/python-*/bin)
fi
# more setup
if [ $__has_pyenv != yes ] ; then
# do this after cloning debops
echo "${__GREEN}${__BOLD}Installing packages${__NONE}"
python -m pip install -r requirements.txt
fi
--
Regards
Hartmut Goebel
| Hartmut Goebel |h.goebel@crazy-compilers.com |
|www.crazy-compilers.com | compilers which you thought are impossible |
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-09-21 7:12 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-18 15:07 Use of python pip packages and python virtual environments in guix Timothee Mathieu
2023-09-21 7:12 ` Hartmut Goebel
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.