I installed two versions of python in pyenv, python3.7.5 and 3.8.6.
I usually use python3.8.6, so it is globally activated (pyenv global 3.8.6
).
I also installed pipx by pip install pipx
within python3.8.6 to install jupyter lab globally (pipx install jupyterlab
), which is located in ~/.local/pipx/venvs/jupyterlab
.
It seems that there is one jupyter kernel pre-installed.
$ jupyter kernelspec list
Available kernels:
python3 ~/.pyenv/versions/3.8.6/share/jupyter/kernels/python3
When I execute jupyter lab
, this kernel is automatically selected.
However, in jupyter lab, I cannot import numpy, which is installed in python3.8.6.
[1]: import numpy as np
[1]: ---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-1-0aa0b027fcb6> in <module>
----> 1 import numpy as np
ModuleNotFoundError: No module named 'numpy'
This may be due to a PATH setting.
[2]: import sys
sys.path
[2]: ['~/',
'~/.pyenv/versions/3.8.6/lib/python38.zip',
'~/.pyenv/versions/3.8.6/lib/python3.8',
'~/.pyenv/versions/3.8.6/lib/python3.8/lib-dynload',
'',
'~/.local/pipx/venvs/jupyterlab/lib/python3.8/site-packages',
'~/.local/pipx/shared/lib/python3.8/site-packages',
'~/.local/pipx/venvs/jupyterlab/lib/python3.8/site-packages/IPython/extensions',
'~/.ipython']
~/.pyenv/versions/3.8.6/lib/python3.8/site-packages
should be in sys.path
. Why is not this path included?