Search code examples
pythonpython-3.xjupyter-notebookpython-traitlets

ipykernel (Jupyter notebook/labs) cannot import name ''filefind" from traitlets.utils


I installed Jupyter notebook and labs on and EC2 instance and for some reason I get the following error:

ImportError: cannot import name 'filefind' from 'traitlets.utils' (/usr/lib/python3/dist-packages/traitlets/utils/init.py)

Jupyter opens fine in the browser but I can't seem to be able to work in an python notebook.


Solution

  • I disencourage the solution of op. Downloading and overwriting python libraries is not the way of keeping your system stable and clean!

    What I found out is that while installing Jupyter notebook it had found four significant errors which resulted from python3 packages that were not installed correctly within that installation itself.

    ERROR: ipykernel 6.6.0 has requirement traitlets<6.0,>=5.1.0, but you'll have traitlets 4.3.3 which is incompatible. ERROR: jupyterlab-pygments 0.1.2 has requirement pygments<3,>=2.4.1, but you'll have pygments 2.3.1 which is incompatible. ERROR: nbconvert 6.3.0 has requirement pygments>=2.4.1, but you'll have pygments 2.3.1 which is incompatible. ERROR: nbconvert 6.3.0 has requirement traitlets>=5.0, but you'll have traitlets 4.3.3 which is incompatible.

    The solution is to just patch the packages to the newest version with:

    pip3 install traitlets==5.1.1
    
    pip3 install pygments==2.4.1
    

    This applies to all similar cases where outdated packages prevent you from your installation