Repository: spack/spack

Issue:
Jupyter: No module named ipykernel_launcher
### Steps to reproduce the issue

```console
$ spack env create my-jupyter
$ spack env activate my-jupyter
$ spack add py-jupyter
$ spack add py-ipython
$ spack add py-ipykernel
$ spack add py-notebook
$ spack install
```

### Error Message

If I try to start `jupyter notebook` now and open a Python3 Notebook I get no working Python3 kernel
```
Kernel started: af71e14f-24f7-40a4-92a8-48e79f5d621c, name: python3
/home/axel/src/spack/opt/spack/linux-ubuntu18.04-skylake/gcc-8.4.0/python-3.8.6-wuh5zypqqvf3fba4ootslwky3plqqsqw/bin/python3.8: No module named ipykernel_launcher

[I 00:55:29.178 NotebookApp] KernelRestarter: restarting kernel (1/5), new random ports
/home/axel/src/spack/opt/spack/linux-ubuntu18.04-skylake/gcc-8.4.0/python-3.8.6-wuh5zypqqvf3fba4ootslwky3plqqsqw/bin/python3.8: No module named ipykernel_launcher

# ...
```

### Information on your system

```bash
$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 18.04.5 LTS
Release:	18.04
Codename:	bionic
```

`spack debug report`:
* **Spack:** 0.15.4-1470-99ef3d11c1
* **Python:** 3.8.6
* **Platform:** linux-ubuntu18.04-skylake

### Additional information

<!-- These boxes can be checked by replacing [ ] with [x] or by clicking them after submitting the issue. -->
- [x] I have run `spack debug report` and reported the version of Spack/Python/Platform
- [x] I have searched the issues of this repo and believe this is not a duplicate
- [ ] I have run the failing commands in debug mode and reported the output


Discussion:
I ran into a very similar issue to this when using Spack environments. The problem was that I added my `.spack-env/view/bin` directory to my `PATH` but didn't add `.spack-env/view/lib/pythonX.Y/site-packages` to my `PYTHONPATH`. When I dug into it, the `jupyter` executable was hard-coded to look in the root Python prefix for `site-packages` instead of where the symlinked python command was found. Adding the `PYTHONPATH` fixed the issue for me.

If you're not using environments, I have no idea 😆 
Thank you for the hint, I am using environments :tada: 

So, should we fix upstream jupyter, patch `py-jupyter` and/or export `PYTHONPATH` in envs by default?
We do export `PYTHONPATH` in envs by default (I think). The problem was that I wasn't running `spack load env`, I was just manually setting env vars in my `.bashrc`.
Interesting, I do `spack env activate`... :thinking: 
`PYTHONPATH`:
```
/home/axel/src/spack/var/spack/environments/warpx-ascent-dev/.spack-env/view/lib64/python3.8/site-packages:/home/axel/src/spack/var/spack/environments/warpx-ascent-dev/.spack-env/view/lib/python3.8/site-packages
```

Resolving patch:
diff --git a/var/spack/repos/builtin/packages/py-ipykernel/package.py b/var/spack/repos/builtin/packages/py-ipykernel/package.py
--- a/var/spack/repos/builtin/packages/py-ipykernel/package.py
+++ b/var/spack/repos/builtin/packages/py-ipykernel/package.py
@@ -40,3 +40,9 @@ class PyIpykernel(PythonPackage):
     depends_on('py-pytest-cov', type='test')
     # depends_on('py-flaky', type='test')
     depends_on('py-nose', type='test')
+
+    phases = ['build', 'install', 'install_data']
+
+    def install_data(self):
+        """ install the Jupyter kernel spec """
+        self.spec['python'].command('-m ipykernel', ['install'])


Test patch: