Regarding of Jupyter lab
Closed this issue ยท 12 comments
Bug description
Expected behaviour
Actual behaviour
[I 20:36:06.448 LabApp] KernelRestarter: restarting kernel (4/5), new random ports
Traceback (most recent call last):
File "/Users/brandon/miniconda3/envs/ancestry/lib/python3.7/runpy.py", line 193, in _run_module_as_main
"main", mod_spec)
File "/Users/brandon/miniconda3/envs/ancestry/lib/python3.7/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/Users/brandon/miniconda3/envs/ancestry/lib/python3.7/site-packages/ipykernel_launcher.py", line 16, in
app.launch_new_instance()
File "/Users/brandon/miniconda3/envs/ancestry/lib/python3.7/site-packages/traitlets/config/application.py", line 844, in launch_instance
app.initialize(argv)
File "/Users/brandon/miniconda3/envs/ancestry/lib/python3.7/site-packages/traitlets/config/application.py", line 87, in inner
return method(app, *args, **kwargs)
File "/Users/brandon/miniconda3/envs/ancestry/lib/python3.7/site-packages/ipykernel/kernelapp.py", line 582, in initialize
self.init_kernel()
File "/Users/brandon/miniconda3/envs/ancestry/lib/python3.7/site-packages/ipykernel/kernelapp.py", line 452, in init_kernel
user_ns=self.user_ns,
File "/Users/brandon/miniconda3/envs/ancestry/lib/python3.7/site-packages/traitlets/config/configurable.py", line 537, in instance
inst = cls(*args, **kwargs)
File "/Users/brandon/miniconda3/envs/ancestry/lib/python3.7/site-packages/ipykernel/ipkernel.py", line 86, in init
appnope.nope()
File "/Users/brandon/miniconda3/envs/ancestry/lib/python3.7/site-packages/appnope/_nope.py", line 90, in nope
"Because Reasons"
File "/Users/brandon/miniconda3/envs/ancestry/lib/python3.7/site-packages/appnope/_nope.py", line 60, in beginActivityWithOptions
NSProcessInfo = C('NSProcessInfo')
File "/Users/brandon/miniconda3/envs/ancestry/lib/python3.7/site-packages/appnope/_nope.py", line 38, in C
assert ret is not None, "Couldn't find Class %s" % classname
AssertionError: Couldn't find Class NSProcessInfo
How to reproduce
- Go to '...'
- Click on '....'
- Scroll down to '....'
- See error
Your personal set up
- OS:
- Version: OS X 11.0.1
jupyter --version
jupyter core : 4.7.0
jupyter-notebook : 6.1.5
qtconsole : not installed
ipython : 5.8.0
ipykernel : 5.3.4
jupyter client : 6.1.7
jupyter lab : 2.2.9
nbconvert : 6.0.7
ipywidgets : not installed
nbformat : 5.0.8
traitlets : 5.0.5
Hi!
Could you check the issue please?
(I just found the appnode repository e.g here.)
@hmkim - can you fill out the rest of the bug report, like how to reproduce, etc.?
I have managed to bypass the bug by modifying the /opt/anaconda3/envs/DES37/lib/python3.7/site-packages/appnope/init.py
from:
_if sys.platform != "darwin" or V(platform.mac_ver()[0]) < V("10.9"):
from ._dummy import *
else: from ._nope import *
from .dummy import *
to:
from .dummy import *
This is a Python issue. Python must be rebuilt with patches to work properly on macOS 11 (ctypes and thereby appnope is specifically affected by a change to how dyld libraries are found). I believe the latest conda-forge builds have fixed this (I know 3.9 has). CPython itself hasn't released a fix yet, but 3.9.1 will fix it. I'm not sure what the backport plan is, so it may not come all the way back to 3.7
Also make sure you have appnope >= 0.1.2.
FWIW, I'm also on macOS 11 and have envs working with Python 3.8 and 3.9 (from conda-forge). Python 3.7 is not getting updates, I think.
Python 3.8
$ conda list
# packages in environment at ~/conda/envs/nb38:
#
# Name Version Build Channel
appnope 0.1.2 py38h50d1736_0 conda-forge
argon2-cffi 20.1.0 py38h7e3306e_2 conda-forge
async_generator 1.10 py_0 conda-forge
attrs 20.3.0 pyhd3deb0d_0 conda-forge
backcall 0.2.0 pyh9f0ad1d_0 conda-forge
backports 1.0 py_2 conda-forge
backports.functools_lru_cache 1.6.1 py_0 conda-forge
bleach 3.2.1 pyh9f0ad1d_0 conda-forge
ca-certificates 2020.12.5 h033912b_0 conda-forge
certifi 2020.12.5 py38h50d1736_0 conda-forge
cffi 1.14.4 py38h979bc6b_1 conda-forge
decorator 4.4.2 py_0 conda-forge
defusedxml 0.6.0 py_0 conda-forge
entrypoints 0.3 pyhd8ed1ab_1003 conda-forge
importlib-metadata 3.1.1 pyhd8ed1ab_0 conda-forge
importlib_metadata 3.1.1 hd8ed1ab_0 conda-forge
ipykernel 5.3.4 py38h9bb44b7_1 conda-forge
ipython 7.19.0 py38h9bb44b7_0 conda-forge
ipython_genutils 0.2.0 py_1 conda-forge
jedi 0.17.2 py38h50d1736_1 conda-forge
jinja2 2.11.2 pyh9f0ad1d_0 conda-forge
jsonschema 3.2.0 py_2 conda-forge
jupyter_client 6.1.7 py_0 conda-forge
jupyter_core 4.7.0 py38h50d1736_0 conda-forge
jupyterlab_pygments 0.1.2 pyh9f0ad1d_0 conda-forge
libcxx 11.0.0 h4c3b8ed_1 conda-forge
libffi 3.3 h046ec9c_2 conda-forge
libsodium 1.0.18 hbcb3906_1 conda-forge
markupsafe 1.1.1 py38h94c058a_2 conda-forge
mistune 0.8.4 py38h7e3306e_1002 conda-forge
nbclient 0.5.1 py_0 conda-forge
nbconvert 6.0.7 py38h50d1736_3 conda-forge
nbformat 5.0.8 py_0 conda-forge
ncurses 6.2 h2e338ed_4 conda-forge
nest-asyncio 1.4.3 pyhd8ed1ab_0 conda-forge
notebook 6.1.5 py38h50d1736_0 conda-forge
openssl 1.1.1h haf1e3a3_0 conda-forge
packaging 20.7 pyhd3deb0d_0 conda-forge
pandoc 2.11.2 hc929b4f_0 conda-forge
pandocfilters 1.4.2 py_1 conda-forge
parso 0.7.1 pyh9f0ad1d_0 conda-forge
pexpect 4.8.0 pyh9f0ad1d_2 conda-forge
pickleshare 0.7.5 py_1003 conda-forge
pip 20.3.1 pyhd8ed1ab_0 conda-forge
prometheus_client 0.9.0 pyhd3deb0d_0 conda-forge
prompt-toolkit 3.0.8 pyha770c72_0 conda-forge
ptyprocess 0.6.0 py_1001 conda-forge
pycparser 2.20 pyh9f0ad1d_2 conda-forge
pygments 2.7.3 pyhd8ed1ab_0 conda-forge
pyparsing 2.4.7 pyh9f0ad1d_0 conda-forge
pyrsistent 0.17.3 py38h7e3306e_1 conda-forge
python 3.8.6 h3b7b5d6_1_cpython conda-forge
python-dateutil 2.8.1 py_0 conda-forge
python_abi 3.8 1_cp38 conda-forge
pyzmq 20.0.0 py38h9b3f83f_1 conda-forge
readline 8.0 h0678c8f_2 conda-forge
send2trash 1.5.0 py_0 conda-forge
setuptools 49.6.0 py38h5347e94_2 conda-forge
six 1.15.0 pyh9f0ad1d_0 conda-forge
sqlite 3.34.0 h17101e1_0 conda-forge
terminado 0.9.1 py38h50d1736_1 conda-forge
testpath 0.4.4 py_0 conda-forge
tk 8.6.10 hb0a8c7a_1 conda-forge
tornado 6.1 py38h7e3306e_0 conda-forge
traitlets 5.0.5 py_0 conda-forge
wcwidth 0.2.5 pyh9f0ad1d_2 conda-forge
webencodings 0.5.1 py_1 conda-forge
wheel 0.36.1 pyhd3deb0d_0 conda-forge
xz 5.2.5 haf1e3a3_1 conda-forge
zeromq 4.3.3 h74dc148_3 conda-forge
zipp 3.4.0 py_0 conda-forge
zlib 1.2.11 h7795811_1010 conda-forge
Python 3.9
$ conda list
# packages in environment at /Users/minrk/conda/envs/nb39:
#
# Name Version Build Channel
appnope 0.1.2 py39h6e9494a_0 conda-forge
argon2-cffi 20.1.0 py39hb5aae12_2 conda-forge
async_generator 1.10 py_0 conda-forge
attrs 20.3.0 pyhd3deb0d_0 conda-forge
backcall 0.2.0 pyh9f0ad1d_0 conda-forge
backports 1.0 py_2 conda-forge
backports.functools_lru_cache 1.6.1 py_0 conda-forge
bleach 3.2.1 pyh9f0ad1d_0 conda-forge
ca-certificates 2020.12.5 h033912b_0 conda-forge
certifi 2020.12.5 py39h6e9494a_0 conda-forge
cffi 1.14.4 py39h7786acb_1 conda-forge
decorator 4.4.2 py_0 conda-forge
defusedxml 0.6.0 py_0 conda-forge
entrypoints 0.3 py39hde42818_1002 conda-forge
importlib-metadata 3.1.1 pyhd8ed1ab_0 conda-forge
importlib_metadata 3.1.1 hd8ed1ab_0 conda-forge
ipykernel 5.3.4 py39h71a6800_1 conda-forge
ipython 7.19.0 py39h71a6800_0 conda-forge
ipython_genutils 0.2.0 py_1 conda-forge
jedi 0.17.2 py39hde42818_1 conda-forge
jinja2 2.11.2 pyh9f0ad1d_0 conda-forge
jsonschema 3.2.0 py_2 conda-forge
jupyter_client 6.1.7 py_0 conda-forge
jupyter_core 4.7.0 py39h6e9494a_0 conda-forge
jupyterlab_pygments 0.1.2 pyh9f0ad1d_0 conda-forge
libcxx 11.0.0 h4c3b8ed_1 conda-forge
libffi 3.3 h046ec9c_2 conda-forge
libsodium 1.0.18 hbcb3906_1 conda-forge
markupsafe 1.1.1 py39h66d5b7b_2 conda-forge
mistune 0.8.4 py39hb5aae12_1002 conda-forge
nbclient 0.5.1 py_0 conda-forge
nbconvert 6.0.7 py39h6e9494a_3 conda-forge
nbformat 5.0.8 py_0 conda-forge
ncurses 6.2 h2e338ed_4 conda-forge
nest-asyncio 1.4.3 pyhd8ed1ab_0 conda-forge
notebook 6.1.5 py39h6e9494a_0 conda-forge
openssl 1.1.1h haf1e3a3_0 conda-forge
packaging 20.7 pyhd3deb0d_0 conda-forge
pandoc 2.11.2 hc929b4f_0 conda-forge
pandocfilters 1.4.2 py_1 conda-forge
parso 0.7.1 pyh9f0ad1d_0 conda-forge
pexpect 4.8.0 pyh9f0ad1d_2 conda-forge
pickleshare 0.7.5 py39hde42818_1002 conda-forge
pip 20.3.1 pyhd8ed1ab_0 conda-forge
prometheus_client 0.9.0 pyhd3deb0d_0 conda-forge
prompt-toolkit 3.0.8 pyha770c72_0 conda-forge
ptyprocess 0.6.0 py_1001 conda-forge
pycparser 2.20 pyh9f0ad1d_2 conda-forge
pygments 2.7.3 pyhd8ed1ab_0 conda-forge
pyparsing 2.4.7 pyh9f0ad1d_0 conda-forge
pyrsistent 0.17.3 py39hb5aae12_1 conda-forge
python 3.9.1 h1d169a7_1_cpython conda-forge
python-dateutil 2.8.1 py_0 conda-forge
python_abi 3.9 1_cp39 conda-forge
pyzmq 20.0.0 py39h07c395c_1 conda-forge
readline 8.0 h0678c8f_2 conda-forge
send2trash 1.5.0 py_0 conda-forge
setuptools 49.6.0 py39h2c36a5b_2 conda-forge
six 1.15.0 pyh9f0ad1d_0 conda-forge
sqlite 3.34.0 h17101e1_0 conda-forge
terminado 0.9.1 py39hde42818_1 conda-forge
testpath 0.4.4 py_0 conda-forge
tk 8.6.10 hb0a8c7a_1 conda-forge
tornado 6.1 py39h5a22ff9_0 conda-forge
traitlets 5.0.5 py_0 conda-forge
tzdata 2020d h516909a_0 conda-forge
wcwidth 0.2.5 pyh9f0ad1d_2 conda-forge
webencodings 0.5.1 py_1 conda-forge
wheel 0.36.1 pyhd3deb0d_0 conda-forge
xz 5.2.5 haf1e3a3_1 conda-forge
zeromq 4.3.3 h74dc148_3 conda-forge
zipp 3.4.0 py_0 conda-forge
zlib 1.2.11 h7795811_1010 conda-forge
You can also disable appnope in the IPython kernel by setting:
# ~/.ipython/profile_default/ipython_kernel_config.py
c.Kernel._darwin_app_nap = False
Thank you @minrk
After upgrade of python (3.7.9 to 3.8.5), I solved the issue.
In my custom conda env (name: ancestry),
(ancestry) $ conda install -c anaconda python=3.8
(ancestry) $ conda update --all
@hmkim - can you fill out the rest of the bug report, like how to reproduce, etc.?
I solved the issue.
Same, this fixed my issue. Thanks @hmkim!
Unfortunately I have packages that require Python 3.7. Is there another way to get jupyterlab to work with python 3.7 and BigSur 11.2?
Did you try disabling appnope like mentioned above?
For anyone else hitting this thread... I had this and issue, did the fix above (disable appnope) .. and then had another issue (jupyter/notebook#5888). So I simply deleted my Python virtualenv (I used pyenv) and created a new one... both problems completely disappeared.
@jasongrout I didn't have the configuration file set up, so I created one and disabled appnope and it appears to now be working. Thanks!
Right now the issue specifically applies to 3.6
... super annoying especially when one needs to work across diff virtual conda envs
I'm experiencing this issue on MacOS Big Sur, but not on MacOS Catalina.
The underlying cause is that ctypes.util.find_library returns None. A simple test to see if you are affected:
python -c "import ctypes.util; assert ctypes.util.find_library('Foundation') is not None"
I'm able to reproduce using Python 3.6, 3.7, 3.8 and 3.9 from nixpkgs. I haven't tested with other versions.
$ nix-shell --run 'python -c "import ctypes.util; assert ctypes.util.find_library(\"Foundation\") is not None"' -p python36
Traceback (most recent call last):
File "<string>", line 1, in <module>
AssertionError
$ nix-shell --run 'python -c "import ctypes.util; assert ctypes.util.find_library(\"Foundation\") is not None"' -p python37
Traceback (most recent call last):
File "<string>", line 1, in <module>
AssertionError
$ nix-shell --run 'python -c "import ctypes.util; assert ctypes.util.find_library(\"Foundation\") is not None"' -p python38
Traceback (most recent call last):
File "<string>", line 1, in <module>
AssertionError
$ nix-shell --run 'python -c "import ctypes.util; assert ctypes.util.find_library(\"Foundation\") is not None"' -p python39
Traceback (most recent call last):
File "<string>", line 1, in <module>
AssertionError