2

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.

Here are the steps that I have done:

  1. Install a virtual environment for python 3 at my local storage space. The tag --system-site-packages has been used, to minimize the size of the virtual environment folder. So it should inherit the global python 3.6 and libraries.

  2. Activated the virtual environment, installed sympy, started python3, import sympy 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)

  3. Tried to run jupyter notebook in the same virtual environment, but trying to import sympy returns No module named 'sympy'. Using print(sys.executable) reveals that it is running on the global python3.6. (When running python3 in virtualenv and printing executable, it prints the path of python3 in myvirtualenv/bin/python3)

  4. Tried to follow these instructions. pip install jupyter and pip install ipykernel worked properly, saying requirement already satisfied. But python -m ipykernel install --user --name testenv --display-name "MyEnv" does not work, returning

[Errno 13] Permission denied: '/tmp/tmpc2ebdyp9_kernels/python3/kernel.json' Perhaps you want `sudo` or `--user`?

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 --prefix, but it is still saying I have no permission to access the system's kernel.json.

I also tried ipython kernel install --name "xx" --user and specifying path with --prefix but it returns the same error.

So my question is:

  1. Did this error arise because even though the ipython kernel was installed locally, the kernel.json at the system directory still needs to be changed? Or did the tags --user or --prefix not work for some reason?

  2. How can I create a kernel truly locally? I suppose after that I can create my own kernel.json as in here or here to direct the jupyter notebook to use my own kernel?

Thanks a lot in advance!

Matthew
  • 369
  • 3
  • 17
  • Any suggestion/advice is highly appreciated! – Matthew May 11 '18 at 15:39
  • Note that I am running this on a public cluster, so I don't really have permission to the files at /tmp. I tried to chmod the specific files, but then it seems like it didn't actually change the permission, and that a new temp files is generated every time I run the python -m ipykernel install xxx ... – Matthew May 16 '18 at 15:17

0 Answers0