AttributeError: module ‘pkg_resources‘ has no attribute ‘declare_namespace‘

Record a problem. Anaconda3 CONDA version 4.6.7 is installed NB_ CONDA failed and damaged the original environment, resulting in an error as shown in the title.

It is speculated that there is a problem with the dependency. First, check the piptree and find that all dependencies are satisfied. However, I manually updated setuptools during the process of CONDA update CONDA. Although the update of CONDA update CONDA failed, the version of setuptools has been updated to 58.0.0,

– setuptools [required: >=36, installed: 58.0.0]

The highest requirement is only 36. It is suspected that the version is too new and the old version is not compatible. Then I tried the degraded version

pip uninstall setuptools

pip install setuptools==36.0.2

Problem solving.

Read More: