问题
After attempting to update conda packages, I am no longer able to start either Jupyter Notebook or Jupyter Lab. Most conda commands also result in an error in terminal. While each command results in a slightly different error, every one terminates in the following statement:
ImportError: dlopen(/Users/USERNAME/anaconda3/lib/python3.7/lib-dynload/_ctypes.cpython-37m-darwin.so, 2): Library not loaded: @rpath/libffi.6.dylib
Referenced from: /Users/USERNAME/anaconda3/lib/python3.7/lib-dynload/_ctypes.cpython-37m-darwin.so
Reason: image not found
For instance, attempting to run jupyter lab results in:
Traceback (most recent call last):
File "/Users/USERNAME/anaconda3/lib/python3.7/site-packages/jupyterlab_server/server.py", line 14, in <module>
from notebook.base.handlers import (
File "/Users/USERNAME/anaconda3/lib/python3.7/site-packages/notebook/base/handlers.py", line 35, in <module>
from notebook.utils import is_hidden, url_path_join, url_is_absolute, url_escape
File "/Users/USERNAME/anaconda3/lib/python3.7/site-packages/notebook/utils.py", line 10, in <module>
import ctypes
File "/Users/USERNAME/anaconda3/lib/python3.7/ctypes/__init__.py", line 7, in <module>
from _ctypes import Union, Structure, Array
ImportError: dlopen(/Users/USERNAME/anaconda3/lib/python3.7/lib-dynload/_ctypes.cpython-37m-darwin.so, 2): Library not loaded: @rpath/libffi.6.dylib
Referenced from: /Users/USERNAME/anaconda3/lib/python3.7/lib-dynload/_ctypes.cpython-37m-darwin.so
Reason: image not found
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/USERNAME/anaconda3/bin/jupyter-lab", line 5, in <module>
from jupyterlab.labapp import main
File "/Users/USERNAME/anaconda3/lib/python3.7/site-packages/jupyterlab/labapp.py", line 14, in <module>
from jupyterlab_server import slugify, WORKSPACE_EXTENSION
File "/Users/USERNAME/anaconda3/lib/python3.7/site-packages/jupyterlab_server/__init__.py", line 4, in <module>
from .app import LabServerApp
File "/Users/USERNAME/anaconda3/lib/python3.7/site-packages/jupyterlab_server/app.py", line 9, in <module>
from .server import ServerApp
File "/Users/USERNAME/anaconda3/lib/python3.7/site-packages/jupyterlab_server/server.py", line 26, in <module>
from jupyter_server.base.handlers import ( # noqa
File "/Users/USERNAME/anaconda3/lib/python3.7/site-packages/jupyter_server/base/handlers.py", line 34, in <module>
from jupyter_server.utils import is_hidden, url_path_join, url_is_absolute, url_escape
File "/Users/USERNAME/anaconda3/lib/python3.7/site-packages/jupyter_server/utils.py", line 10, in <module>
import ctypes
File "/Users/USERNAME/anaconda3/lib/python3.7/ctypes/__init__.py", line 7, in <module>
from _ctypes import Union, Structure, Array
ImportError: dlopen(/Users/USERNAME/anaconda3/lib/python3.7/lib-dynload/_ctypes.cpython-37m-darwin.so, 2): Library not loaded: @rpath/libffi.6.dylib
Referenced from: /Users/USERNAME/anaconda3/lib/python3.7/lib-dynload/_ctypes.cpython-37m-darwin.so
Reason: image not found
Attempts to use homebrew to reinstall libffi (as suggested elsewhere) have also failed.
Any assistance in getting back up and running would be hugely appreciated.
回答1:
I had a similar problem as well and needed to downgrade libffi to version 3.2.1.
I never explicitly installed libffi; it came along with the original environment creation.
Try this
% conda install libffi=3.2.1
I was able to install many packages but had failures with nb_conda_kernels and various jupyter lab extension installations.
来源:https://stackoverflow.com/questions/61388066/error-running-jupyter-lab-notebook-and-most-conda-commands-following-update