user10443608
user10443608

Reputation:

Is it possible set Ubuntu Environment Variable from jupyter notebook cell?

This post gives a way to check CUDNN version.

CUDNN_H_PATH=/usr/include/cudnn.h
cat ${CUDNN_H_PATH} | grep CUDNN_MAJOR -A 2

I am trying to use this approach on colab

Actually, I've got the CUDNN version of colab.

cat /usr/include/cudnn.h | grep CUDNN_MAJOR -A 2

And then I am trying to find out if it is possible set Ubuntu Environment Variable from jupyter notebook cell.

From terminal, following command is working well

$ export abc=1
$ echo $abc 
1

run this inside a jupyter notebook (https://colab.research.google.com) cell gets nothing

enter image description here

echo an Ubuntu Environment Variable is working well

enter image description here

So, is it possible set Ubuntu Environment Variable from jupyter notebook cell?

Upvotes: 0

Views: 201

Answers (1)

Tomas Farias
Tomas Farias

Reputation: 1343

Have you considered using the %env magic command?

%env abc=1

Should accomplish what you want to do.

Upvotes: 1

Related Questions