• Register
1 vote

Problem :

I have installed the pip for python 3.6 on my Ubuntu 14. By using below command :

sudo apt-get install python3-pip

Now to install pip3, it works very well. But after doing the installation, when I want to run it by using below command :

pip3 install packagename

When I try to install the new package, something strange occurs as below :

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 appears that I did nothing wrong but I am really unable to figure out the reason behind the above error.

6 5 3
7,540 points

Please log in or register to answer this question.

1 Answer

1 vote

Solution :

I had faced the similar problem in the recent past. I think this is happening simply because the  python3.6 and pip3 were installed from the different sources. So I suggest you to use the python's inbuilt facility to install the pip as follows :

python3 -m ensurepip --upgrade

This should help you in installing your pip3 and pip3.x where x in python3.x. Same works for the python2 also.



I had the same problem in the recent past on my ubuntu 18.04 with the python 3.6. None of the above methods really helped, but below one solved my problem:

pip3 uninstall setuptools


9 7 4
38,600 points
The first method worked on my linux, thank you.
glad u found it useful kumpas, it worked for me as well

Related questions

0 votes
1 answer 681 views
Problem : I am new to HTMLParser my terminal showing me below error :- from django.utils.html import format_html, format_html_join, escape File "/usr/local/lib/python3.5/dist-packages/django/utils/html.py", line 16, in from .html_parser import HTMLParser, HTMLParseError ... I replace the HTMLParser with some other similar? Or should I try to downgrade the python ? Can someone help on this issue?
asked Mar 2, 2020 mphil 2.3k points
1 vote
1 answer 47 views
Problem: I want to install one package named speech_tools-2.1-release.tar.gz. After I run the command ./configure in this package, it shows me a message:\ Configure: error: no acceptable C compiler found in $PATH See 'config.log' for more details Any solution would be much appreciated. Thanks.
asked Mar 10, 2020 Gavin 15.3k points
0 votes
1 answer 880 views
Problem : I run sudo pip install git-review, and get the following error cannot fetch index base url https://pypi.python.org/simple/
asked Oct 22, 2019 peterlaw 6.9k points
0 votes
1 answer 18 views
I have tried to follow the documentation but was not able to use urlparse.parse.quote_plus() in Python 3: from urllib.parse import urlparse params = urlparse.parse.quote_plus({'username': 'administrator', 'password': 'xyz'}) I get AttributeError: 'function' object has no attribute 'parse'
asked Oct 25, 2020 psandprop 2.4k points
0 votes
1 answer 81 views
This line: sift = cv2.xfeatures2d.SIFT_create() return error: Traceback (most recent call last): File "C:/Python27/openCVskrypty/GUI/SOLUTION2.py", line 11, in <module> sift = cv2.xfeatures2d.SIFT_create() AttributeError: 'module' object has no attribute 'xfeatures2d' I ... ) and I haven't got xfeatures2d module. Does anyone know why? Can I download it separately? Thanks for help how fix this.
asked Oct 24, 2020 psandprop 2.4k points
0 votes
1 answer 37 views
0 votes
1 answer 1.1K views
Problem: I have only fundamental knowledge related to python, pandas and dataframe.I have tried to write the below code: df = pd.DataFrame(np.random.rand(12,2), columns=['Apples', 'Oranges'] ) df['Categories'] = pd.Series(list('AAAABBBBCCCC')) pd.options.display. ... I will be more than glad to get more ideas on the above error regarding why it is occurring and also how to fix this error?
asked Aug 24, 2020 Raphael Pacheco 4.9k points
0 votes
1 answer 273 views
Problem: I have currently started learning about using the pandas in ipython notebook: import pandas as pd But I have encountered the below error on my above line of code: AttributeError  Traceback (most recent call last) <ipython-input-17-c7ecb2b0a99d> in <module>() ----> 1 from ... ' I have no knowledge on how to fix the above error, what is a problem here? My python's version is currently 3.6
asked Aug 10, 2020 Raphael Pacheco 4.9k points
0 votes
1 answer 536 views
Problem: I have recently started learning Python so I have only fundamental knowledge in Python. Please find below my Transaction class for your reference: class Transaction(object):     def __init__(self, company, num, price, date, is_buy):         self.company = company         ... Python and because of lockdown I am unable to find any help to fix this issue. So I am posting my question here.
asked Aug 10, 2020 Raphael Pacheco 4.9k points
0 votes
1 answer 387 views
Problem: If I try to execute the command sess = tf.Session() in the Tensorflow 2.0 environment then I am facing below error message: Traceback (most recent call last): File "<stdin>", line 1, in <module> AttributeError: module 'tensorflow' has no attribute ' ... install numpy==1.16.2 Command Execution as below: Execute the command: import tensorflow as tf Execute the command: sess = tf.Session()
asked Jul 21, 2020 Raphael Pacheco 4.9k points