Alex Cam
Alex Cam

Reputation: 115

AttributeError: module 'importlib._bootstrap' has no attribute 'SourceFileLoader'

Im new to programming, so I have met this trouble. I ve upgraded my pip and then used pip list, ipython notebook, jupyter notebook to use anaconda, so after all this commands I got one answer :

Traceback (most recent call last):
  File "/home/bakhytgul/anaconda3/bin/pip", line 7, in <module>
    from pip._internal import main
  File "/home/bakhytgul/anaconda3/lib/python3.6/site-packages/pip/_internal/__init__.py", line 40, in <module>
    from pip._internal.cli.autocompletion import autocomplete
  File "/home/bakhytgul/anaconda3/lib/python3.6/site-packages/pip/_internal/cli/autocompletion.py", line 8, in <module>
    from pip._internal.cli.main_parser import create_main_parser
  File "/home/bakhytgul/anaconda3/lib/python3.6/site-packages/pip/_internal/cli/main_parser.py", line 12, in <module>
    from pip._internal.commands import (
  File "/home/bakhytgul/anaconda3/lib/python3.6/site-packages/pip/_internal/commands/__init__.py", line 6, in <module>
    from pip._internal.commands.completion import CompletionCommand
  File "/home/bakhytgul/anaconda3/lib/python3.6/site-packages/pip/_internal/commands/completion.py", line 6, in <module>
    from pip._internal.cli.base_command import Command
  File "/home/bakhytgul/anaconda3/lib/python3.6/site-packages/pip/_internal/cli/base_command.py", line 19, in <module>
    from pip._internal.download import PipSession
  File "/home/bakhytgul/anaconda3/lib/python3.6/site-packages/pip/_internal/download.py", line 15, in <module>
    from pip._vendor import requests, six, urllib3
  File "/home/bakhytgul/anaconda3/lib/python3.6/site-packages/pip/_vendor/requests/__init__.py", line 97, in <module>
    from pip._vendor.urllib3.contrib import pyopenssl
  File "/home/bakhytgul/anaconda3/lib/python3.6/site-packages/pip/_vendor/urllib3/contrib/pyopenssl.py", line 46, in <module>
    import OpenSSL.SSL
  File "/home/bakhytgul/anaconda3/lib/python3.6/site-packages/OpenSSL/__init__.py", line 8, in <module>
    from OpenSSL import rand, crypto, SSL
  File "/home/bakhytgul/anaconda3/lib/python3.6/site-packages/OpenSSL/crypto.py", line 13, in <module>
    from cryptography.hazmat.primitives.asymmetric import dsa, rsa
  File "/home/bakhytgul/anaconda3/lib/python3.6/site-packages/cryptography/hazmat/primitives/asymmetric/rsa.py", line 14, in <module>
    from cryptography.hazmat.backends.interfaces import RSABackend
  File "/home/bakhytgul/anaconda3/lib/python3.6/site-packages/cryptography/hazmat/backends/__init__.py", line 7, in <module>
    import pkg_resources
  File "/home/bakhytgul/anaconda3/lib/python3.6/site-packages/pkg_resources.py", line 1435, in <module>
    register_loader_type(importlib_bootstrap.SourceFileLoader, DefaultProvider)
AttributeError: module 'importlib._bootstrap' has no attribute 'SourceFileLoader'

Can u help me to solve this issue, please? Thank u very much. Im using: - Ubuntu 16.04. (64bit) - Python 2.7.12 - Python 3.6.0 :: Anaconda 4.3.1 (64-bit)

P.S: Ive tried to fix with dotenv, ensurepip(this got me answer that I dont have this package).

Upvotes: 6

Views: 3112

Answers (1)

Mario Chapa
Mario Chapa

Reputation: 65

Not a full answer because I cannot tell you why this is happening, but hopefully this will help you find a solution.

I had been running into this problem with an venv. When I started from scratch trying to build rjsmin, everything went all right, that is when I noticed that the reason was that the venv that was failing was using Python 3.6, whereas the new venv was using Python 3.7.

According to your console output the anaconda you have is using 3.6, I think you might have break your install by manually upgrading packages using pip. You could try getting the newer version of anaconda, or go with a new, fresh install.

Upvotes: 1

Related Questions