[IPython-User] making notebook aware of environmental variables
Zoltán Vörös
zvoros@gmail....
Fri Jan 27 02:19:38 CST 2012
On 01/27/2012 01:59 AM, Fernando Perez wrote:
> 2012/1/26 Zoltán Vörös<zvoros@gmail.com>:
>> Even if I explicitly issue
>>
>> os.system('export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH')
>> or
>> os.putenv('LD_LIBRARY_PATH','/usr/local/cuda/lib64')
>>
>> in the notebook, that doesn't change the situation.
>>
>> Given this, should I just open an issue?
> Hold on, let's try to figure out what's going on in your system,
> because it's kind of odd. In the notebook, I see my env. variables
> perfectly fine.
>
> In what exact file are you setting your environment variables? And
> what OS are you using?
Right, I was going a bit too fast. So, the system is ubuntu 11.10,
64-bit. First, I put the export commands into my .bashrc, and when that
did not work, I tried to do the same from the command line like this
In [1]: os.putenv('LD_LIBRARY_PATH','/usr/local/cuda/lib64')
I thought that that would take care of that, although, the docstring of
putenv says that this would effect processes that are started later by
popen or something similar.
When I do this in the notebook
In [5]: print os.getenv('LD_LIBRARY_PATH')
the output is None, even if there was a specific
In [4]: os.putenv('LD_LIBRARY_PATH','/usr/local/cuda/lib64')
before. As I said, exporting does not help either. On the other hand, the output of the same command in the ipython console is
In [13]: print os.getenv('LD_LIBRARY_PATH')
/usr/local/cuda/lib64:
and that is what I expect. I also tried to start ipython notebook from the bash shell, and I exported the variables in the shell itself. But that does not solve the problem. That works only, if I run ipython console. Somehow, the notebook is detached from what initialised it in the first place.
Any comments on how to shoot the trouble?
Cheers,
Zoltán
More information about the IPython-User
mailing list