That was it ! Host python seems to be working well even after renaming ~./local/lib/python2.7.Thanks Vanessa !On Tue, Jan 29, 2019 at 11:14 AM vanessa sochat <vso...@stanford.edu> wrote:I've run into this issue before with the .local folder in the $HOME on my host - to fix it I temporarily renamed it to something else (probably not the best solution) or you could try to set a dummy home somewhere else with --home . Basically, you don't want python finding that .local directory.On Tue, Jan 29, 2019 at 11:10 AM Tims Corbett <tims.c...@gmail.com> wrote:Thanks VanessaThose 2 changes didn't quite help ( removing --user and expanding $GUROBI_HOMEI do need Gurobi on the host machine as well. Is that causing the container to fail?Why does this look for python libraries on the host?singularity exec --cleanenv intelmpi-python2.7-gurobi.img/ bash -c "unset PYTHONHOME && python -v -c 'from gurobipy import *'"dlopen("/home/x/.local/lib/python2.7/site-packages/gurobipy/gurobipy.so", 2);bash: line 1: 27580 Bus error (core dumped) python -v -c 'from gurobipy import *'Bootstrap: dockerFrom: python:2.7.8%postmkdir -p /apps/gurobicd /apps/gurobitar -xvf gurobi8.1.0_linux64.tar.gzunset PYTHONHOMEcd /apps/gurobi/gurobi810/linux64#mv license/gurobi_client.lic license/gurobi.licpython setup.py install%environmentGUROBI_HOME=/apps/gurobi/gurobi810/linux64export PATH=$PATH:/apps/gurobi/gurobi810/linux64/binexport LD_LIBRARY_PATH=/apps/gurobi/gurobi810/linux64/lib:$LD_LIBRARY_PATHexport GUROBI_HOME LD_LIBRARY_PATHexport GRB_LICENSE_FILE=/apps/gurobi/gurobi810/linux64/license/gurobi.licOn Tue, Jan 29, 2019 at 10:01 AM vanessa sochat <vso...@stanford.edu> wrote:Hey Tims,I think your issue is that you are calling gurobi from the container, but grabbing a library on the path in the host (via LD_LIBRARY_PATH). I *don't* have gurobi (or it's libraries) anywhere on my host, and I was able to get the container working with the following recipe:Bootstrap: docker
From: python:2.7.8
%post
mkdir -p /apps/gurobi
cd /apps/gurobi
wget https://packages.gurobi.com/8.1/gurobi8.1.0_linux64.tar.gz
tar -xvf gurobi8.1.0_linux64.tar.gz
unset PYTHONHOME
cd /apps/gurobi/gurobi810/linux64
#mv license/gurobi_client.lic license/gurobi.lic
python setup.py install
%environment
GUROBI_HOME=/apps/gurobi/gurobi810/linux64
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/apps/gurobi/gurobi810/linux64/lib
export GUROBI_HOME LD_LIBRARY_PATHChanges include:- installing not as a user (we don't need to, building the container we are root)- adding the correct LD_LIBRARY_PATH and exporting itAnd then your command works as expected :)Best,VanessaOn Tue, Jan 29, 2019 at 12:44 PM Tims Corbett <tims.c...@gmail.com> wrote:All paths lead to core dumpsingularity exec --cleanenv intelmpi-python2.7-gurobi.img/ bash -c "unset PYTHONHOME && python -v -c 'from gurobipy import *'"import gurobipy # precompiled from /home/x/.local/lib/python2.7/site-packages/gurobipy/__init__.pycdlopen("/home/x/.local/lib/python2.7/site-packages/gurobipy/gurobipy.so", 2);bash: line 1: 16403 Bus error (core dumped) python -v -c 'from gurobipy import *'singularity exec --cleanenv intelmpi-python2.7-gurobi.img/ which python/usr/local/bin/pythonsingularity exec intelmpi-python2.7-gurobi.img/ which python/usr/local/bin/python$ singularity shell --cleanenv intelmpi-python2.7-gurobi.img/Singularity: Invoking an interactive shell within container...Singularity intelmpi-python2.7-gurobi.img:~> echo $PYTHONPATHSingularity intelmpi-python2.7-gurobi.img:~> pythonPython 2.7.8 (default, Nov 26 2014, 22:28:51)[GCC 4.9.1] on linux2Type "help", "copyright", "credits" or "license" for more information.>>>>>> from gurobipy import *Bus error (core dumped)python -c "import os"OKHere's the recipe:Bootstrap: dockerFrom: python:2.7.8%postmkdir -p /apps/gurobicd /apps/gurobitar -xvf gurobi8.1.0_linux64.tar.gzunset PYTHONHOMEcd /apps/gurobi/gurobi810/linux64#mv license/gurobi_client.lic license/gurobi.licpython setup.py install --user%environmentexport GUROBI_HOME="/apps/gurobi/gurobi810/linux64"
export PATH=$PATH:${GUROBI_HOME}/binexport LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${GUROBI_HOME}/lib"export GRB_LICENSE_FILE="$GUROBI_HOME/license/gurobi.lic"
On Tue, Jan 29, 2019 at 9:04 AM vanessa sochat <vso...@stanford.edu> wrote:Hey Tims,Let's try two things. First, make sure to not include the environment from the host:singularity exec --cleanenv gurobi.img bash -c "unset PYTHONHOME && python -v -c 'from gurobipy import *'"Try doing this command with and without cleanenv to see what python you are hitting:singularity exec --cleanenv gurobi.img which python
singularity exec gurobi.img which pythonThen try looking at PYTHONPATH for both those cases:singularity exec --cleanenv gurobi.img env | grep PYTHONPATH
singularity exec gurobi.img env | grep PYTHONPATHFinally, try shelling into the container and trying to import gurobi:singularity shell --cleanenv gurobi.imgecho $PYTHONPATHpythonfrom gutobipy import *When you get something working (and please show me the output of the above) we would want to write the full set of commands into a script to execute via the runscript in the container.On Tue, Jan 29, 2019 at 11:16 AM Tims Corbett <tims.c...@gmail.com> wrote:Thanks Vanessa. I tried this trick.singularity exec gurobi.img bash -c "unset PYTHONHOME && python -v -c 'from gurobipy import *'"TRace shows that container is looking for library on the host machine. What to do?import gurobipy # precompiled from /home/x/.local/lib/python2.7/site-packages/gurobipy/__init__.pycdlopen("/home/x/.local/lib/python2.7/site-packages/gurobipy/gurobipy.so", 2);bash: line 1: 13345 Bus error (core dumped) python -v -c 'from gurobipy import *'On Mon, Jan 28, 2019, 4:51 PM vanessa sochat <vso...@stanford.edu wrote:Try seeing if you can shell into the container and see the gurobi stuffs as your regular use, maybe you need to change permissions for the entire directory?
--
You received this message because you are subscribed to the Google Groups "singularity" group.
To unsubscribe from this group and stop receiving emails from it, send an email to singularity...@lbl.gov.
--Vanessa Villamia Sochat
Stanford University--Vanessa Villamia Sochat
Stanford University--Vanessa Villamia Sochat
Stanford University--Vanessa Villamia Sochat
Stanford University