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:
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.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)Tried to run
jupyter notebook
in the same virtual environment, but trying toimport sympy
returnsNo module named 'sympy'
. Usingprint(sys.executable)
reveals that it is running on the global python3.6. (When runningpython3
in virtualenv and printing executable, it prints the path of python3 inmyvirtualenv/bin/python3
)Tried to follow these instructions.
pip install jupyter
andpip install ipykernel
worked properly, saying requirement already satisfied. Butpython -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:
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?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!