using pip3: module "importlib._bootstrap" has no attribute "SourceFileLoader"

103,850

Solution 1

Tried to install Tensorflow in venv on Windows 10 machine with python 3.8 and got the same issue.

What helped for me was:

pip install setuptools --upgrade

Solution 2

I had the same problem on my ubuntu 18.04 with python 3.6. None of the above methods helped, but this one solved the problem:

pip3 uninstall setuptools

Solution 3

I had the same error whatever I asked to pip. I gave a look to this page: https://packaging.python.org/tutorials/installing-packages/

That line is the one that solved my problem:

python3 -m pip install --upgrade pip setuptools wheel

Solution 4

pip install setuptools --upgrade

This command fixed my problem

Solution 5

If you face this issue in anaconda environment, simply upgrade setuptools using the following:

conda install -c conda-forge setuptools
Share:
103,850
Arsenal591
Author by

Arsenal591

Updated on July 05, 2022

Comments

  • Arsenal591
    Arsenal591 almost 2 years

    I have installed pip for python 3.6 on Ubuntu 14. After I run

    sudo apt-get install python3-pip
    

    to install pip3, it works very well. However, after installation, when I am trying to run

    pip3 install packagename
    

    to install a new package, something strange occurs:

    File "/usr/lib/python3/dist-packages/pkg_resources.py", line 1479, in <module>
     register_loader-type(importlib_bootstrap.SourceFileLoader, DefaultProvider)
    AttributeError: module "importlib._bootstrap" has no attribute "SourceFileLoader"
    

    It seems that I did nothing wrong, and I really cannot figure out the reason.

  • DtechNet
    DtechNet almost 4 years
    Still get same error - Ubuntu 14: AttributeError: module 'importlib._bootstrap' has no attribute 'SourceFileLoader'
  • Okw
    Okw over 3 years
    I had issues with fs-uae-launcher not starting on Debian Buster because: AttributeError: module 'importlib._bootstrap' has no attribute 'SourceFileLoader' Uninstalling setuptools fixed it.
  • rkachach
    rkachach over 3 years
    Thanks for the solution, none of the above solution worked and this issue was annoying my day :)
  • Stanislav Ivanov
    Stanislav Ivanov over 3 years
    Also helps for Ubuntu 18.04
  • wrkyle
    wrkyle over 3 years
    After upgrading from Ubuntu 19.10 to 20.04 I had this problem with pip3. Nothing I'd found worked. This finally solved it.
  • Mrinal Kamboj
    Mrinal Kamboj almost 3 years
    I have Pop!_OS 20.10 based on Ubuntu and this helped
  • bm13kk
    bm13kk almost 3 years
    pip3 uninstall setuptools make it worse pip3 install setuptoolssame error as in topick
  • Paul P M
    Paul P M over 2 years
    helped also on Pop!_OS 21.10 as well