GNU bug report logs - #53258
Python unable to find modules within a Singularity container created with guix pack

Previous Next

Package: guix;

Reported by: Marek Felšöci <marek <at> felsoci.sk>

Date: Fri, 14 Jan 2022 16:08:01 UTC

Severity: normal

Done: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Konrad Hinsen <konrad.hinsen <at> fastmail.net>
To: 53258 <at> debbugs.gnu.org
Subject: bug#53258: Python unable to find modules within a Singularity container created with guix pack
Date: Thu, 04 Jan 2024 13:35:28 +0100
Hi everyone,

I found this issue while investigating a related one (the error
message). It looks like the core problem discussed here has been solved
in the meantime:

   Singularity> python3 -m numpy
   Error in sitecustomize; set PYTHONVERBOSE for traceback:
   ValueError: '/gnu/store/kx98dz2vc3gdpjficy4nbd7rscnkvz4s-profile/bin/../../h855kddqbay0pcbwr8a7i8m6ilz67cfn-python-3.10.7/lib/python3.10/site-packages' is not in list
   /gnu/store/kx98dz2vc3gdpjficy4nbd7rscnkvz4s-profile/bin/python3: No module named numpy.__main__; 'numpy' is a package and cannot be directly executed

This error message is to be expected, and NumPy can be imported:

   Singularity> python3
   Error in sitecustomize; set PYTHONVERBOSE for traceback:
   ValueError: '/gnu/store/kx98dz2vc3gdpjficy4nbd7rscnkvz4s-profile/bin/../../h855kddqbay0pcbwr8a7i8m6ilz67cfn-python-3.10.7/lib/python3.10/site-packages' is not in list
   Python 3.10.7 (main, Jan  1 1970, 00:00:01) [GCC 11.3.0] on linux
   Type "help", "copyright", "credits" or "license" for more information.
   >>> import numpy
   >>> 

What remains is the error message, which comes from a bug in Guix'
sitecustomize.py. It compares a raw path (sys.prefix) with paths that
have been normalized (os.path.normpath). That comparison fails if
sys.prefix contains "../", as it does when run from a Singularity
container. I will submit a patch for this.

Cheers,
  Konrad




This bug report was last modified 1 year and 116 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.