# Import software from CVMFS

**URL:** <https://swan-community.web.cern.ch/t/import-software-from-cvmfs/203>\
**Category:** Software\
**Created:** [March 9, 2020, 3:13pm UTC](https://swan-community.web.cern.ch/t/import-software-from-cvmfs/203 "2020-03-09T15:13:08Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![pie](https://swan-community.web.cern.ch/letter_avatar_proxy/v4/letter/p/f9ae1b/32.png) [@pie](https://swan-community.web.cern.ch/u/pie)\
**Post date:** [March 9, 2020, 3:13pm UTC](https://swan-community.web.cern.ch/t/import-software-from-cvmfs/203/1 "2020-03-09T15:13:08Z")

</div>

Dear SWAN team,

I am probably missing something, but I didn’t find a way in order to use some software located under CVMFS. On lxplus I used to set un an environment, and work with that, but I am not able to do that on SWAN.  
I also try to use the startup script to set up the environment but it seems to fails.

Thank you for your patience

---

<div class="post-metadata">

**Author:** ![etejedor](https://swan-community.web.cern.ch/letter_avatar_proxy/v4/letter/e/e79b87/32.png) [@etejedor](https://swan-community.web.cern.ch/u/etejedor)\
**Post date:** [March 9, 2020, 4:39pm UTC](https://swan-community.web.cern.ch/t/import-software-from-cvmfs/203/2 "2020-03-09T16:39:17Z")

</div>

Dear Piero,

Where is that software located on CVMFS and how do you usually set your environment on lxplus to use it?

---

<div class="post-metadata">

**Author:** ![pie](https://swan-community.web.cern.ch/letter_avatar_proxy/v4/letter/p/f9ae1b/32.png) [@pie](https://swan-community.web.cern.ch/u/pie)\
**Post date:** [March 9, 2020, 5:07pm UTC](https://swan-community.web.cern.ch/t/import-software-from-cvmfs/203/3 "2020-03-09T17:07:20Z")

</div>

Dear Enric,

Thank you for the response. I would like to use some packages located at:

`/cvmfs/lhcb.cern.ch/lib/lhcb/GAUDI/GAUDI_v32r2/Gaudi/python/Gaudi`

Usually, after logging on lxplus, after the automatic group login, I set up the environment with

`lb-run -c best LHCb/v50r6p1 bash --norc`

Now I am able to perform the group login in the swan startup script, but not to set the environment.  
However those command run without errors in the swan terminal.  
Is there any way to use that modules in the notebooks?

Thank you again

---

<div class="post-metadata">

**Author:** ![etejedor](https://swan-community.web.cern.ch/letter_avatar_proxy/v4/letter/e/e79b87/32.png) [@etejedor](https://swan-community.web.cern.ch/u/etejedor)\
**Post date:** [March 9, 2020, 5:33pm UTC](https://swan-community.web.cern.ch/t/import-software-from-cvmfs/203/4 "2020-03-09T17:33:08Z")

</div>

Dear Piero,

The way the SWAN startup script works is by exporting new values for the variables you would like to set, for example:

`export PYTHONPATH=/cvmfs/lhcb.cern.ch/lib/lhcb/GAUDI/GAUDI_v32r2/Gaudi/python:$PYTHONPATH`

Do the commands you run inside your SWAN startup script do such kind of export?

---

<div class="post-metadata">

**Author:** ![pie](https://swan-community.web.cern.ch/letter_avatar_proxy/v4/letter/p/f9ae1b/32.png) [@pie](https://swan-community.web.cern.ch/u/pie)\
**Post date:** [March 9, 2020, 6:03pm UTC](https://swan-community.web.cern.ch/t/import-software-from-cvmfs/203/5 "2020-03-09T18:03:10Z")

</div>

Dear Enric,

Yes I tried to export manually the variables in my script, but it seems that I am not able to achieve the same result as

`lb-run -c best LHCb/v50r6p1 bash --norc`

Actually running it in the SWAN terminal, will correctly load the environment. I would like to have the same environment in the notebooks. Also in a notebook:

`%%bash`  
`lb-run -c best LHCb/v50r6p1 bash --norc`

works, but the environment is only available in the current cell.

Thank you again

---

<div class="post-metadata">

**Author:** ![etejedor](https://swan-community.web.cern.ch/letter_avatar_proxy/v4/letter/e/e79b87/32.png) [@etejedor](https://swan-community.web.cern.ch/u/etejedor)\
**Post date:** [March 10, 2020, 7:38am UTC](https://swan-community.web.cern.ch/t/import-software-from-cvmfs/203/6 "2020-03-10T07:38:24Z")

</div>

Dear Piero,

My guess is that

`lb-run -c best LHCb/v50r6p1 bash --norc`

creates a new bash process that has the desired environment, so it works from the SWAN terminal. Running it from a bash cell of a notebook only affects that cell, because a new process is spawned to run it and dies right after.

In the SWAN env script things work differently, since what we do is spawn a new process that sources your script, gets all the environment variables that have been set by it and then records them to configure the environment of the notebook.

Can you share what `lb-run` actually does?

---

<div class="post-metadata">

**Author:** ![bursche](https://swan-community.web.cern.ch/letter_avatar_proxy/v4/letter/b/a88e57/32.png) [@bursche](https://swan-community.web.cern.ch/u/bursche)\
**Post date:** [March 10, 2020, 8:38am UTC](https://swan-community.web.cern.ch/t/import-software-from-cvmfs/203/7 "2020-03-10T08:38:14Z")

</div>

Dear Enric,  
lb-run sets the environment (PATH, PYTHONPATH, LD\_LIBRARYPATH etc) for a specific part of the LHCb software and then executes a program. That’s why it usually comes with many arguments. It is put in the path by the aforementioned login script.  
source /cvmfs/lhcb.cern.ch/group\_login.sh  
which lb-run  
/cvmfs/lhcb.cern.ch/lib/lhcb/LBSCRIPTS/LBSCRIPTS\_v9r2p6/InstallArea/scripts/lb-run  
Hope this helps,  
Albert

---

<div class="post-metadata">

**Author:** ![pie](https://swan-community.web.cern.ch/letter_avatar_proxy/v4/letter/p/f9ae1b/32.png) [@pie](https://swan-community.web.cern.ch/u/pie)\
**Post date:** [March 10, 2020, 9:13am UTC](https://swan-community.web.cern.ch/t/import-software-from-cvmfs/203/8 "2020-03-10T09:13:56Z")

</div>

Thank you Albert

Anyway I managed to set up the environment by manually exporting the variables needed in the startup script, and for now it seems to work. I am just worried about the fact the I am probably missing some variable and it will not work anymore for other module related to LHCb software, but for now it is ok.

By the way thank you all for your support 🙂  
Piero

---

<div class="post-metadata">

**Author:** ![etejedor](https://swan-community.web.cern.ch/letter_avatar_proxy/v4/letter/e/e79b87/32.png) [@etejedor](https://swan-community.web.cern.ch/u/etejedor)\
**Post date:** [March 10, 2020, 10:23am UTC](https://swan-community.web.cern.ch/t/import-software-from-cvmfs/203/9 "2020-03-10T10:23:11Z")

</div>

From what I see in:

/cvmfs/lhcb.cern.ch/lib/lhcb/LBSCRIPTS/LBSCRIPTS\_v9r2p6/InstallArea/scripts/lb-run

`lb-run` will just spawn a new python process, set the environment there and execute. That explains why it has no effect when running it inside a SWAN environment script (the python script does not leave any trace in its parent process).

Unfortunately, I don’t see any other solution right now that manually exporting the variables as you do, so that the notebook python process is configured with them by SWAN.

---

<div class="post-metadata">

**Author:** ![pie](https://swan-community.web.cern.ch/letter_avatar_proxy/v4/letter/p/f9ae1b/32.png) [@pie](https://swan-community.web.cern.ch/u/pie)\
**Post date:** [March 10, 2020, 1:05pm UTC](https://swan-community.web.cern.ch/t/import-software-from-cvmfs/203/10 "2020-03-10T13:05:29Z")

</div>

Ok I will do it manually then.  
Thank you again 🙂

---

<div class="post-metadata">

**Author:** ![saiola](https://swan-community.web.cern.ch/letter_avatar_proxy/v4/letter/s/c0e974/32.png) [@saiola](https://swan-community.web.cern.ch/u/saiola)\
**Post date:** [April 17, 2020, 4:30pm UTC](https://swan-community.web.cern.ch/t/import-software-from-cvmfs/203/11 "2020-04-17T16:30:16Z")

</div>

Hi all,  
there is an option in lb-run to set the environment variables in the current shell without spawning a new one:

```
eval $(lb-run --sh -A LHCb/v50r6p1)

```

There is still a pending issue which is that for some (yet unknown) reason this command unset an environment variable that’s used by SWAN to configure some jupyter extensions. The name of the variable is KERNEL\_PROFILEPATH. I sent an email asking the LHCb computing experts whether they know why this happens. For now, the workaround is to reset the original value of the variable after running the lb-run command. I will report back if any news.

Hope this helps!
