Python3 pip3 install broken on Ubuntu












4















I installed python3 and pip3 successfully on my Ubuntu16.04, but pip3 install is broken. How can I fix this problem? The error information of pip3 install is as follows:



# pip3 install xlwt
Traceback (most recent call last):
File "/usr/bin/pip3", line 9, in <module>
from pip import main
File "/usr/lib/python3/dist-packages/pip/__init__.py", line 21, in <module>
from pip._vendor.requests.packages.urllib3.exceptions import DependencyWarning
ModuleNotFoundError: No module named 'pip._vendor.requests'


Output of sudo -H pip3 install --upgrade pip



sudo -H pip3 install --upgrade pip  
Traceback (most recent call last):
File "/usr/bin/pip3", line 9, in <module>
from pip import main
File "/usr/lib/python3/dist-packages/pip/__init__.py", line 21, in <module>
from pip._vendor.requests.packages.urllib3.exceptions import DependencyWarning
ModuleNotFoundError: No module named 'pip._vendor.requests'


Output of which pip3 and pip3 --version:



# which pip3
/usr/bin/pip3

# pip3 --version
Traceback (most recent call last):
File "/usr/bin/pip3", line 9, in <module>
from pip import main
File "/usr/lib/python3/dist-packages/pip/__init__.py", line 21, in <module>
from pip._vendor.requests.packages.urllib3.exceptions import DependencyWarning
ModuleNotFoundError: No module named 'pip._vendor.requests'


P.S. Python2 pip runs successfully. Output of "which pip" and "pip --version":



# which pip
/usr/bin/pip

# pip --version
pip 1.5.4 from /usr/local/lib/python2.7/dist-packages/pip-1.5.4-py2.7.egg (python 2.7)


And python and python3 installation information:



# which python
/usr/bin/python
# which python3
/usr/bin/python3

# python -V
Python 2.7.14
# python3 -V
Python 3.6.3









share|improve this question

























  • You said 16.04 in your post but used the 14.04 tag. Which version is correct?

    – edwinksl
    Oct 26 '17 at 11:21








  • 1





    16.04 is correct. I couldn't find the 16.04 tag just now. Sorry.

    – mlpy
    Oct 26 '17 at 11:28


















4















I installed python3 and pip3 successfully on my Ubuntu16.04, but pip3 install is broken. How can I fix this problem? The error information of pip3 install is as follows:



# pip3 install xlwt
Traceback (most recent call last):
File "/usr/bin/pip3", line 9, in <module>
from pip import main
File "/usr/lib/python3/dist-packages/pip/__init__.py", line 21, in <module>
from pip._vendor.requests.packages.urllib3.exceptions import DependencyWarning
ModuleNotFoundError: No module named 'pip._vendor.requests'


Output of sudo -H pip3 install --upgrade pip



sudo -H pip3 install --upgrade pip  
Traceback (most recent call last):
File "/usr/bin/pip3", line 9, in <module>
from pip import main
File "/usr/lib/python3/dist-packages/pip/__init__.py", line 21, in <module>
from pip._vendor.requests.packages.urllib3.exceptions import DependencyWarning
ModuleNotFoundError: No module named 'pip._vendor.requests'


Output of which pip3 and pip3 --version:



# which pip3
/usr/bin/pip3

# pip3 --version
Traceback (most recent call last):
File "/usr/bin/pip3", line 9, in <module>
from pip import main
File "/usr/lib/python3/dist-packages/pip/__init__.py", line 21, in <module>
from pip._vendor.requests.packages.urllib3.exceptions import DependencyWarning
ModuleNotFoundError: No module named 'pip._vendor.requests'


P.S. Python2 pip runs successfully. Output of "which pip" and "pip --version":



# which pip
/usr/bin/pip

# pip --version
pip 1.5.4 from /usr/local/lib/python2.7/dist-packages/pip-1.5.4-py2.7.egg (python 2.7)


And python and python3 installation information:



# which python
/usr/bin/python
# which python3
/usr/bin/python3

# python -V
Python 2.7.14
# python3 -V
Python 3.6.3









share|improve this question

























  • You said 16.04 in your post but used the 14.04 tag. Which version is correct?

    – edwinksl
    Oct 26 '17 at 11:21








  • 1





    16.04 is correct. I couldn't find the 16.04 tag just now. Sorry.

    – mlpy
    Oct 26 '17 at 11:28
















4












4








4


1






I installed python3 and pip3 successfully on my Ubuntu16.04, but pip3 install is broken. How can I fix this problem? The error information of pip3 install is as follows:



# pip3 install xlwt
Traceback (most recent call last):
File "/usr/bin/pip3", line 9, in <module>
from pip import main
File "/usr/lib/python3/dist-packages/pip/__init__.py", line 21, in <module>
from pip._vendor.requests.packages.urllib3.exceptions import DependencyWarning
ModuleNotFoundError: No module named 'pip._vendor.requests'


Output of sudo -H pip3 install --upgrade pip



sudo -H pip3 install --upgrade pip  
Traceback (most recent call last):
File "/usr/bin/pip3", line 9, in <module>
from pip import main
File "/usr/lib/python3/dist-packages/pip/__init__.py", line 21, in <module>
from pip._vendor.requests.packages.urllib3.exceptions import DependencyWarning
ModuleNotFoundError: No module named 'pip._vendor.requests'


Output of which pip3 and pip3 --version:



# which pip3
/usr/bin/pip3

# pip3 --version
Traceback (most recent call last):
File "/usr/bin/pip3", line 9, in <module>
from pip import main
File "/usr/lib/python3/dist-packages/pip/__init__.py", line 21, in <module>
from pip._vendor.requests.packages.urllib3.exceptions import DependencyWarning
ModuleNotFoundError: No module named 'pip._vendor.requests'


P.S. Python2 pip runs successfully. Output of "which pip" and "pip --version":



# which pip
/usr/bin/pip

# pip --version
pip 1.5.4 from /usr/local/lib/python2.7/dist-packages/pip-1.5.4-py2.7.egg (python 2.7)


And python and python3 installation information:



# which python
/usr/bin/python
# which python3
/usr/bin/python3

# python -V
Python 2.7.14
# python3 -V
Python 3.6.3









share|improve this question
















I installed python3 and pip3 successfully on my Ubuntu16.04, but pip3 install is broken. How can I fix this problem? The error information of pip3 install is as follows:



# pip3 install xlwt
Traceback (most recent call last):
File "/usr/bin/pip3", line 9, in <module>
from pip import main
File "/usr/lib/python3/dist-packages/pip/__init__.py", line 21, in <module>
from pip._vendor.requests.packages.urllib3.exceptions import DependencyWarning
ModuleNotFoundError: No module named 'pip._vendor.requests'


Output of sudo -H pip3 install --upgrade pip



sudo -H pip3 install --upgrade pip  
Traceback (most recent call last):
File "/usr/bin/pip3", line 9, in <module>
from pip import main
File "/usr/lib/python3/dist-packages/pip/__init__.py", line 21, in <module>
from pip._vendor.requests.packages.urllib3.exceptions import DependencyWarning
ModuleNotFoundError: No module named 'pip._vendor.requests'


Output of which pip3 and pip3 --version:



# which pip3
/usr/bin/pip3

# pip3 --version
Traceback (most recent call last):
File "/usr/bin/pip3", line 9, in <module>
from pip import main
File "/usr/lib/python3/dist-packages/pip/__init__.py", line 21, in <module>
from pip._vendor.requests.packages.urllib3.exceptions import DependencyWarning
ModuleNotFoundError: No module named 'pip._vendor.requests'


P.S. Python2 pip runs successfully. Output of "which pip" and "pip --version":



# which pip
/usr/bin/pip

# pip --version
pip 1.5.4 from /usr/local/lib/python2.7/dist-packages/pip-1.5.4-py2.7.egg (python 2.7)


And python and python3 installation information:



# which python
/usr/bin/python
# which python3
/usr/bin/python3

# python -V
Python 2.7.14
# python3 -V
Python 3.6.3






16.04 python python3 python-2.7 pip






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Oct 26 '17 at 15:40









karel

58k12128146




58k12128146










asked Oct 26 '17 at 11:18









mlpymlpy

28226




28226













  • You said 16.04 in your post but used the 14.04 tag. Which version is correct?

    – edwinksl
    Oct 26 '17 at 11:21








  • 1





    16.04 is correct. I couldn't find the 16.04 tag just now. Sorry.

    – mlpy
    Oct 26 '17 at 11:28





















  • You said 16.04 in your post but used the 14.04 tag. Which version is correct?

    – edwinksl
    Oct 26 '17 at 11:21








  • 1





    16.04 is correct. I couldn't find the 16.04 tag just now. Sorry.

    – mlpy
    Oct 26 '17 at 11:28



















You said 16.04 in your post but used the 14.04 tag. Which version is correct?

– edwinksl
Oct 26 '17 at 11:21







You said 16.04 in your post but used the 14.04 tag. Which version is correct?

– edwinksl
Oct 26 '17 at 11:21






1




1





16.04 is correct. I couldn't find the 16.04 tag just now. Sorry.

– mlpy
Oct 26 '17 at 11:28







16.04 is correct. I couldn't find the 16.04 tag just now. Sorry.

– mlpy
Oct 26 '17 at 11:28












4 Answers
4






active

oldest

votes


















5














There is something wrong with your pip3 so remove it and reinstall it. Open the terminal and type:



sudo apt purge python3-pip  
sudo rm -rf '/usr/lib/python3/dist-packages/pip'
sudo apt install python3-pip
cd
cd .local/lib/python3/site-packages
sudo rm -rf pip*
cd
cd .local/lib/python3.5/site-packages
sudo rm -rf pip*
sudo pip3 install xlwt





share|improve this answer





















  • 1





    I tried but still the same error: imgur.com/a/nAdqU .

    – mlpy
    Oct 26 '17 at 15:21











  • I tried the new solution but still the same error.

    – mlpy
    Oct 27 '17 at 5:44











  • I am having the same issue too. When I do sudo apt install python3-pip, I get the following error: The following packages have unmet dependencies: python3-pip : Depends: python-pip-whl (= 8.1.1-2) but 8.1.1-2ubuntu0.4 is to be installed Recommends: build-essential but it is not going to be installed Recommends: python3-dev (>= 3.2) but it is not going to be installed Recommends: python3-wheel but it is not going to be installed E: Unable to correct problems, you have held broken packages.

    – Kristada673
    Jan 16 '18 at 8:07











  • @Kristada673 Try reading the answers to this question: askubuntu.com/questions/363200/…. DragonLord's answer worked for me.

    – karel
    Jan 16 '18 at 8:10








  • 1





    thanks, this worked for me.

    – Nikhil VJ
    2 days ago



















1














This is what I've found helpful:




  1. sudo rm -rf /usr/local/lib/python3.5/dist-packages

  2. Never run pip3 within sudo.






share|improve this answer
























  • While that maybe fixes things, can you please expand your answer ? Why to remove this directory (maybe add a caveat about the python3.5 path), why never to run it with sudo, and so on..

    – Robert Riedl
    Jan 22 '18 at 15:17











  • I am not quite an expert on this - I just wanted to share what had worked for me.

    – Jan Lachnitt
    Jan 29 '18 at 23:19











  • I really can't recommend this approach.

    – Mr. T
    Feb 25 '18 at 4:39



















1














Installing python3-pip package create a python script in file /usr/bin/pip3. In order to run, main() function need to be imported from module pip (from pip import main).
This method path is only available for packaged pip version (9.0.1 in my case).



After running pip3 install --upgrade pip, pip version become 18.1, and main() has been moved in pip._internal.



Use the command python3 -m pip --version to see if your case correspond to the same situation (pip3 is also available with this method when /usr/bin/pip3 is broken).



If so, in file /usr/bin/pip3, replace line 9:
from pip import main
with:
from pip._internal import main



The issue will be fixed.
(Tested on Ubuntu 18.04 distribution)






share|improve this answer































    0














    Had same issue, installing openssl fixed it for me






    share|improve this answer
























    • But openssl already install on my Ubuntu: imgur.com/a/60kIM . Maybe it's caused by another reason.

      – mlpy
      Oct 26 '17 at 12:56













    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "89"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f969463%2fpython3-pip3-install-broken-on-ubuntu%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    4 Answers
    4






    active

    oldest

    votes








    4 Answers
    4






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    5














    There is something wrong with your pip3 so remove it and reinstall it. Open the terminal and type:



    sudo apt purge python3-pip  
    sudo rm -rf '/usr/lib/python3/dist-packages/pip'
    sudo apt install python3-pip
    cd
    cd .local/lib/python3/site-packages
    sudo rm -rf pip*
    cd
    cd .local/lib/python3.5/site-packages
    sudo rm -rf pip*
    sudo pip3 install xlwt





    share|improve this answer





















    • 1





      I tried but still the same error: imgur.com/a/nAdqU .

      – mlpy
      Oct 26 '17 at 15:21











    • I tried the new solution but still the same error.

      – mlpy
      Oct 27 '17 at 5:44











    • I am having the same issue too. When I do sudo apt install python3-pip, I get the following error: The following packages have unmet dependencies: python3-pip : Depends: python-pip-whl (= 8.1.1-2) but 8.1.1-2ubuntu0.4 is to be installed Recommends: build-essential but it is not going to be installed Recommends: python3-dev (>= 3.2) but it is not going to be installed Recommends: python3-wheel but it is not going to be installed E: Unable to correct problems, you have held broken packages.

      – Kristada673
      Jan 16 '18 at 8:07











    • @Kristada673 Try reading the answers to this question: askubuntu.com/questions/363200/…. DragonLord's answer worked for me.

      – karel
      Jan 16 '18 at 8:10








    • 1





      thanks, this worked for me.

      – Nikhil VJ
      2 days ago
















    5














    There is something wrong with your pip3 so remove it and reinstall it. Open the terminal and type:



    sudo apt purge python3-pip  
    sudo rm -rf '/usr/lib/python3/dist-packages/pip'
    sudo apt install python3-pip
    cd
    cd .local/lib/python3/site-packages
    sudo rm -rf pip*
    cd
    cd .local/lib/python3.5/site-packages
    sudo rm -rf pip*
    sudo pip3 install xlwt





    share|improve this answer





















    • 1





      I tried but still the same error: imgur.com/a/nAdqU .

      – mlpy
      Oct 26 '17 at 15:21











    • I tried the new solution but still the same error.

      – mlpy
      Oct 27 '17 at 5:44











    • I am having the same issue too. When I do sudo apt install python3-pip, I get the following error: The following packages have unmet dependencies: python3-pip : Depends: python-pip-whl (= 8.1.1-2) but 8.1.1-2ubuntu0.4 is to be installed Recommends: build-essential but it is not going to be installed Recommends: python3-dev (>= 3.2) but it is not going to be installed Recommends: python3-wheel but it is not going to be installed E: Unable to correct problems, you have held broken packages.

      – Kristada673
      Jan 16 '18 at 8:07











    • @Kristada673 Try reading the answers to this question: askubuntu.com/questions/363200/…. DragonLord's answer worked for me.

      – karel
      Jan 16 '18 at 8:10








    • 1





      thanks, this worked for me.

      – Nikhil VJ
      2 days ago














    5












    5








    5







    There is something wrong with your pip3 so remove it and reinstall it. Open the terminal and type:



    sudo apt purge python3-pip  
    sudo rm -rf '/usr/lib/python3/dist-packages/pip'
    sudo apt install python3-pip
    cd
    cd .local/lib/python3/site-packages
    sudo rm -rf pip*
    cd
    cd .local/lib/python3.5/site-packages
    sudo rm -rf pip*
    sudo pip3 install xlwt





    share|improve this answer















    There is something wrong with your pip3 so remove it and reinstall it. Open the terminal and type:



    sudo apt purge python3-pip  
    sudo rm -rf '/usr/lib/python3/dist-packages/pip'
    sudo apt install python3-pip
    cd
    cd .local/lib/python3/site-packages
    sudo rm -rf pip*
    cd
    cd .local/lib/python3.5/site-packages
    sudo rm -rf pip*
    sudo pip3 install xlwt






    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Oct 27 '17 at 6:07

























    answered Oct 26 '17 at 11:52









    karelkarel

    58k12128146




    58k12128146








    • 1





      I tried but still the same error: imgur.com/a/nAdqU .

      – mlpy
      Oct 26 '17 at 15:21











    • I tried the new solution but still the same error.

      – mlpy
      Oct 27 '17 at 5:44











    • I am having the same issue too. When I do sudo apt install python3-pip, I get the following error: The following packages have unmet dependencies: python3-pip : Depends: python-pip-whl (= 8.1.1-2) but 8.1.1-2ubuntu0.4 is to be installed Recommends: build-essential but it is not going to be installed Recommends: python3-dev (>= 3.2) but it is not going to be installed Recommends: python3-wheel but it is not going to be installed E: Unable to correct problems, you have held broken packages.

      – Kristada673
      Jan 16 '18 at 8:07











    • @Kristada673 Try reading the answers to this question: askubuntu.com/questions/363200/…. DragonLord's answer worked for me.

      – karel
      Jan 16 '18 at 8:10








    • 1





      thanks, this worked for me.

      – Nikhil VJ
      2 days ago














    • 1





      I tried but still the same error: imgur.com/a/nAdqU .

      – mlpy
      Oct 26 '17 at 15:21











    • I tried the new solution but still the same error.

      – mlpy
      Oct 27 '17 at 5:44











    • I am having the same issue too. When I do sudo apt install python3-pip, I get the following error: The following packages have unmet dependencies: python3-pip : Depends: python-pip-whl (= 8.1.1-2) but 8.1.1-2ubuntu0.4 is to be installed Recommends: build-essential but it is not going to be installed Recommends: python3-dev (>= 3.2) but it is not going to be installed Recommends: python3-wheel but it is not going to be installed E: Unable to correct problems, you have held broken packages.

      – Kristada673
      Jan 16 '18 at 8:07











    • @Kristada673 Try reading the answers to this question: askubuntu.com/questions/363200/…. DragonLord's answer worked for me.

      – karel
      Jan 16 '18 at 8:10








    • 1





      thanks, this worked for me.

      – Nikhil VJ
      2 days ago








    1




    1





    I tried but still the same error: imgur.com/a/nAdqU .

    – mlpy
    Oct 26 '17 at 15:21





    I tried but still the same error: imgur.com/a/nAdqU .

    – mlpy
    Oct 26 '17 at 15:21













    I tried the new solution but still the same error.

    – mlpy
    Oct 27 '17 at 5:44





    I tried the new solution but still the same error.

    – mlpy
    Oct 27 '17 at 5:44













    I am having the same issue too. When I do sudo apt install python3-pip, I get the following error: The following packages have unmet dependencies: python3-pip : Depends: python-pip-whl (= 8.1.1-2) but 8.1.1-2ubuntu0.4 is to be installed Recommends: build-essential but it is not going to be installed Recommends: python3-dev (>= 3.2) but it is not going to be installed Recommends: python3-wheel but it is not going to be installed E: Unable to correct problems, you have held broken packages.

    – Kristada673
    Jan 16 '18 at 8:07





    I am having the same issue too. When I do sudo apt install python3-pip, I get the following error: The following packages have unmet dependencies: python3-pip : Depends: python-pip-whl (= 8.1.1-2) but 8.1.1-2ubuntu0.4 is to be installed Recommends: build-essential but it is not going to be installed Recommends: python3-dev (>= 3.2) but it is not going to be installed Recommends: python3-wheel but it is not going to be installed E: Unable to correct problems, you have held broken packages.

    – Kristada673
    Jan 16 '18 at 8:07













    @Kristada673 Try reading the answers to this question: askubuntu.com/questions/363200/…. DragonLord's answer worked for me.

    – karel
    Jan 16 '18 at 8:10







    @Kristada673 Try reading the answers to this question: askubuntu.com/questions/363200/…. DragonLord's answer worked for me.

    – karel
    Jan 16 '18 at 8:10






    1




    1





    thanks, this worked for me.

    – Nikhil VJ
    2 days ago





    thanks, this worked for me.

    – Nikhil VJ
    2 days ago













    1














    This is what I've found helpful:




    1. sudo rm -rf /usr/local/lib/python3.5/dist-packages

    2. Never run pip3 within sudo.






    share|improve this answer
























    • While that maybe fixes things, can you please expand your answer ? Why to remove this directory (maybe add a caveat about the python3.5 path), why never to run it with sudo, and so on..

      – Robert Riedl
      Jan 22 '18 at 15:17











    • I am not quite an expert on this - I just wanted to share what had worked for me.

      – Jan Lachnitt
      Jan 29 '18 at 23:19











    • I really can't recommend this approach.

      – Mr. T
      Feb 25 '18 at 4:39
















    1














    This is what I've found helpful:




    1. sudo rm -rf /usr/local/lib/python3.5/dist-packages

    2. Never run pip3 within sudo.






    share|improve this answer
























    • While that maybe fixes things, can you please expand your answer ? Why to remove this directory (maybe add a caveat about the python3.5 path), why never to run it with sudo, and so on..

      – Robert Riedl
      Jan 22 '18 at 15:17











    • I am not quite an expert on this - I just wanted to share what had worked for me.

      – Jan Lachnitt
      Jan 29 '18 at 23:19











    • I really can't recommend this approach.

      – Mr. T
      Feb 25 '18 at 4:39














    1












    1








    1







    This is what I've found helpful:




    1. sudo rm -rf /usr/local/lib/python3.5/dist-packages

    2. Never run pip3 within sudo.






    share|improve this answer













    This is what I've found helpful:




    1. sudo rm -rf /usr/local/lib/python3.5/dist-packages

    2. Never run pip3 within sudo.







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Jan 22 '18 at 14:26









    Jan LachnittJan Lachnitt

    111




    111













    • While that maybe fixes things, can you please expand your answer ? Why to remove this directory (maybe add a caveat about the python3.5 path), why never to run it with sudo, and so on..

      – Robert Riedl
      Jan 22 '18 at 15:17











    • I am not quite an expert on this - I just wanted to share what had worked for me.

      – Jan Lachnitt
      Jan 29 '18 at 23:19











    • I really can't recommend this approach.

      – Mr. T
      Feb 25 '18 at 4:39



















    • While that maybe fixes things, can you please expand your answer ? Why to remove this directory (maybe add a caveat about the python3.5 path), why never to run it with sudo, and so on..

      – Robert Riedl
      Jan 22 '18 at 15:17











    • I am not quite an expert on this - I just wanted to share what had worked for me.

      – Jan Lachnitt
      Jan 29 '18 at 23:19











    • I really can't recommend this approach.

      – Mr. T
      Feb 25 '18 at 4:39

















    While that maybe fixes things, can you please expand your answer ? Why to remove this directory (maybe add a caveat about the python3.5 path), why never to run it with sudo, and so on..

    – Robert Riedl
    Jan 22 '18 at 15:17





    While that maybe fixes things, can you please expand your answer ? Why to remove this directory (maybe add a caveat about the python3.5 path), why never to run it with sudo, and so on..

    – Robert Riedl
    Jan 22 '18 at 15:17













    I am not quite an expert on this - I just wanted to share what had worked for me.

    – Jan Lachnitt
    Jan 29 '18 at 23:19





    I am not quite an expert on this - I just wanted to share what had worked for me.

    – Jan Lachnitt
    Jan 29 '18 at 23:19













    I really can't recommend this approach.

    – Mr. T
    Feb 25 '18 at 4:39





    I really can't recommend this approach.

    – Mr. T
    Feb 25 '18 at 4:39











    1














    Installing python3-pip package create a python script in file /usr/bin/pip3. In order to run, main() function need to be imported from module pip (from pip import main).
    This method path is only available for packaged pip version (9.0.1 in my case).



    After running pip3 install --upgrade pip, pip version become 18.1, and main() has been moved in pip._internal.



    Use the command python3 -m pip --version to see if your case correspond to the same situation (pip3 is also available with this method when /usr/bin/pip3 is broken).



    If so, in file /usr/bin/pip3, replace line 9:
    from pip import main
    with:
    from pip._internal import main



    The issue will be fixed.
    (Tested on Ubuntu 18.04 distribution)






    share|improve this answer




























      1














      Installing python3-pip package create a python script in file /usr/bin/pip3. In order to run, main() function need to be imported from module pip (from pip import main).
      This method path is only available for packaged pip version (9.0.1 in my case).



      After running pip3 install --upgrade pip, pip version become 18.1, and main() has been moved in pip._internal.



      Use the command python3 -m pip --version to see if your case correspond to the same situation (pip3 is also available with this method when /usr/bin/pip3 is broken).



      If so, in file /usr/bin/pip3, replace line 9:
      from pip import main
      with:
      from pip._internal import main



      The issue will be fixed.
      (Tested on Ubuntu 18.04 distribution)






      share|improve this answer


























        1












        1








        1







        Installing python3-pip package create a python script in file /usr/bin/pip3. In order to run, main() function need to be imported from module pip (from pip import main).
        This method path is only available for packaged pip version (9.0.1 in my case).



        After running pip3 install --upgrade pip, pip version become 18.1, and main() has been moved in pip._internal.



        Use the command python3 -m pip --version to see if your case correspond to the same situation (pip3 is also available with this method when /usr/bin/pip3 is broken).



        If so, in file /usr/bin/pip3, replace line 9:
        from pip import main
        with:
        from pip._internal import main



        The issue will be fixed.
        (Tested on Ubuntu 18.04 distribution)






        share|improve this answer













        Installing python3-pip package create a python script in file /usr/bin/pip3. In order to run, main() function need to be imported from module pip (from pip import main).
        This method path is only available for packaged pip version (9.0.1 in my case).



        After running pip3 install --upgrade pip, pip version become 18.1, and main() has been moved in pip._internal.



        Use the command python3 -m pip --version to see if your case correspond to the same situation (pip3 is also available with this method when /usr/bin/pip3 is broken).



        If so, in file /usr/bin/pip3, replace line 9:
        from pip import main
        with:
        from pip._internal import main



        The issue will be fixed.
        (Tested on Ubuntu 18.04 distribution)







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Jan 2 at 17:03









        Vincent H.Vincent H.

        112




        112























            0














            Had same issue, installing openssl fixed it for me






            share|improve this answer
























            • But openssl already install on my Ubuntu: imgur.com/a/60kIM . Maybe it's caused by another reason.

              – mlpy
              Oct 26 '17 at 12:56


















            0














            Had same issue, installing openssl fixed it for me






            share|improve this answer
























            • But openssl already install on my Ubuntu: imgur.com/a/60kIM . Maybe it's caused by another reason.

              – mlpy
              Oct 26 '17 at 12:56
















            0












            0








            0







            Had same issue, installing openssl fixed it for me






            share|improve this answer













            Had same issue, installing openssl fixed it for me







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Oct 26 '17 at 11:56









            getupandgogetupandgo

            11




            11













            • But openssl already install on my Ubuntu: imgur.com/a/60kIM . Maybe it's caused by another reason.

              – mlpy
              Oct 26 '17 at 12:56





















            • But openssl already install on my Ubuntu: imgur.com/a/60kIM . Maybe it's caused by another reason.

              – mlpy
              Oct 26 '17 at 12:56



















            But openssl already install on my Ubuntu: imgur.com/a/60kIM . Maybe it's caused by another reason.

            – mlpy
            Oct 26 '17 at 12:56







            But openssl already install on my Ubuntu: imgur.com/a/60kIM . Maybe it's caused by another reason.

            – mlpy
            Oct 26 '17 at 12:56




















            draft saved

            draft discarded




















































            Thanks for contributing an answer to Ask Ubuntu!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f969463%2fpython3-pip3-install-broken-on-ubuntu%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            flock() on closed filehandle LOCK_FILE at /usr/bin/apt-mirror

            Mangá

            Eduardo VII do Reino Unido