title: Set permanent environment variables in Google Colab
body: <p>How do you set environment variables in Colab that persist after a runtime restart?</p>
  
  <p>I have tried:</p>
  
  <ol>
  <li>Changing <code>~/.bashrc</code></li>
  </ol>
  
  <pre><code>!echo "LD_LIBRARY_PATH=/usr/local/nvidia/lib:/usr/local/nvidia/lib64:/opt/ros/melodic/lib" &gt;&gt; /etc/environment
  
  </code></pre>
  
  <ol start="2">
  <li>Adding line to <code>/etc/environment</code></li>
  </ol>
  
  <pre><code>!echo "source /opt/ros/melodic/setup.bash" &gt;&gt; ~/.bashrc
  </code></pre>
  
  <p>Questions that don't have the answer:</p>
  
  <p><a href="https://stackoverflow.com/questions/53306150/setting-environment-variables-in-google-colab">Setting environment variables in Google Colab</a> : All methods listed here do not persist after runtime restart</p>