title: Running jupyter notebook in a virtualenv (with permission issue)
body: <p>I am trying to run jupyter notebook in a virtualenv on a cloud computing platform running Linux, but I am unable to install a ipykernel for jupyter notebook.</p>
  
  <p>Here are the steps that I have done:</p>
  
  <ol>
  <li><p>Install a virtual environment for python 3 at my local storage space. The tag <code>--system-site-packages</code> has been used, to minimize the size of the virtual environment folder. So it should inherit the global python 3.6 and libraries.</p></li>
  <li><p>Activated the virtual environment, installed sympy, started <code>python3</code>, <code>import sympy</code> and it worked. (Note that without the virtualenv, pip does not work as we have no permission to write to the global version of python)</p></li>
  <li><p>Tried to run <code>jupyter notebook</code> in the same virtual environment, but trying to <code>import sympy</code> returns <code>No module named 'sympy'</code>. Using <code>print(sys.executable)</code> reveals that it is running on the global python3.6. (When running <code>python3</code> in virtualenv and printing executable, it prints the path of python3 in <code>myvirtualenv/bin/python3</code>)</p></li>
  <li><p>Tried to follow <a href="https://stackoverflow.com/questions/33496350/execute-python-script-within-jupyter-notebook-using-a-specific-virtualenv?utm_medium=organic&amp;utm_source=google_rich_qa&amp;utm_campaign=google_rich_qa">these instructions.</a> <code>pip install jupyter</code> and <code>pip install ipykernel</code> worked properly, saying requirement already satisfied. But <code>python -m ipykernel install --user --name testenv --display-name "MyEnv"</code> does not work, returning </p></li>
  </ol>
  
  <p><code>[Errno 13] Permission denied: '/tmp/tmpc2ebdyp9_kernels/python3/kernel.json'
  Perhaps you want `sudo` or `--user`?</code> </p>
  
  <p>which really confuses me, as I thought the --user tag should make it install at my local directory already. I also tried specifying the path of my virtualenv by using <code>--prefix</code>, but it is still saying I have no permission to access the system's <code>kernel.json</code>.</p>
  
  <p>I also tried <code>ipython kernel install --name "xx" --user</code> and specifying path with <code>--prefix</code> but it returns the same error.</p>
  
  <p><strong>So my question is:</strong></p>
  
  <ol>
  <li><p>Did this error arise because even though the ipython kernel was installed locally, the <code>kernel.json</code> at the system directory still needs to be changed? Or did the tags <code>--user</code> or <code>--prefix</code> not work for some reason?</p></li>
  <li><p>How can I create a kernel truly locally? I suppose after that I can create my own <code>kernel.json</code> as in <a href="https://ocefpaf.github.io/python4oceanographers/blog/2014/09/01/ipython_kernel/" rel="nofollow noreferrer">here</a> or <a href="https://stackoverflow.com/questions/35561126/jupyter-using-the-wrong-version-of-python?utm_medium=organic&amp;utm_source=google_rich_qa&amp;utm_campaign=google_rich_qa">here</a> to direct the jupyter notebook to use my own kernel?</p></li>
  </ol>
  
  <p>Thanks a lot in advance!</p>