16
votes

I downloaded anaconda and when try to launch jupyter notebook using cmd, the error appear as AttributeError: '_NamespacePath' object has no attribute 'sort'. I am launching jypyter by typing jupyter notebook in cmd in windows os. Thanks for solving my error

4
try launching it from anaconda shell - alDiablo
I run it using anaconda shell but the same thing happened - Lim Ken Sian

4 Answers

37
votes

I recommend you try this:

pip install --upgrade pip setuptools

Based on https://github.com/GoogleCloudPlatform/google-cloud-python/issues/2990.

9
votes

This worked for me on Ubuntu 16.04.

  1. Uninstall pip3

    sudo apt-get purge --auto-remove python3-pip
    
  2. Go to your home directory

    cd $HOME
    
  3. Search for any other pip3 links

    sudo find . -name 'pip3'
    
  4. Delete all the links using rm if any were found

  5. Download/Clone pip from here (via git for example)

    git clone https://github.com/pypa/pip
    
  6. Go to the downloaded directory

    cd pip
    
  7. Install pip3 (you might need to add sudo in front of it)

    python3 setup.py install
    

This will install the latest version of pip and remove the error without loss of any packages.

4
votes

upgrading setuptools didn't work for me. I did reinstall pip,

git clone https://github.com/pypa/pip.git
cd pip
python setup.py install
3
votes

Had the same issue with pip install. The following worked for me.

easy_install pip
easy_install setuptools

https://github.com/pypa/setuptools/issues/885