You are not logged in.

#1 2016-06-06 21:54:47

chiiidog
Member
From: Florida
Registered: 2016-06-04
Posts: 11

[SOLVED]Python ImportError: No module named 'pip'.

Trying to install python modules i.e.

pip3 install requests

Getting the following error:

Traceback (most recent call last):
  File "/usr/bin/pip3", line 9, in <module>
    load_entry_point('pip==7.1.0', 'console_scripts', 'pip3')()
  File "/usr/lib/python3.5/site-packages/setuptools-18.1-py3.5.egg/pkg_resources/__init__.py", line 558, in load_entry_point
  File "/usr/lib/python3.5/site-packages/setuptools-18.1-py3.5.egg/pkg_resources/__init__.py", line 2682, in load_entry_point
  File "/usr/lib/python3.5/site-packages/setuptools-18.1-py3.5.egg/pkg_resources/__init__.py", line 2355, in load
  File "/usr/lib/python3.5/site-packages/setuptools-18.1-py3.5.egg/pkg_resources/__init__.py", line 2361, in resolve
ImportError: No module named 'pip'

So I tried

which pip

which returns

/usr/bin/pip

Checked to make sure /usr/bin is in my path, and it is.
Ran

sudo easy_install pip

and got what looks like success

Searching for pip
Best match: pip 7.1.0
Processing pip-7.1.0-py3.5.egg
pip 7.1.0 is already the active version in easy-install.pth
Installing pip script to /usr/bin
Installing pip3.5 script to /usr/bin
Installing pip3 script to /usr/bin

Using /usr/lib/python3.5/site-packages/pip-7.1.0-py3.5.egg
Processing dependencies for pip
Finished processing dependencies for pip

Very confused.

Last edited by chiiidog (2016-06-06 22:25:55)

Offline

#2 2016-06-06 22:13:52

Xyne
Administrator/PM
Registered: 2008-08-03
Posts: 6,965
Website

Re: [SOLVED]Python ImportError: No module named 'pip'.

How did you install pip? Given what you have posted and your post count, it seems that you are new to Arch so I suspect that you are not used to using Pacman and have installed things manually. This will lead to system clutter, unsatisfied dependencies, etc.

The Arch way is to create Pacman packages. Most of the time these likely exist already either in the official repos or the AUR. I recommend that you read the wiki entries for makepkg and PKGBUILDs. It is very simple to package Python modules for Pacman.

The Python 3.x pip module is in the package python-pip. The one for Python 2.x is in python2-pip.


My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#3 2016-06-06 22:16:05

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 20,334

Re: [SOLVED]Python ImportError: No module named 'pip'.

Not a direct answer to your question, but...

A more Archey way of doing this would be to install python-requests from the AUR.  Let pacman manage your packages.

Edit: $DEITY I am slow today.

Last edited by ewaller (2016-06-06 22:16:42)


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#4 2016-06-06 22:25:31

chiiidog
Member
From: Florida
Registered: 2016-06-04
Posts: 11

Re: [SOLVED]Python ImportError: No module named 'pip'.

Thanks. I actually just solved my problem by using curl to download get-pip from the python website. This upgraded my pip version and then I used sudo pip3 install requests. I guess I should definitely learn to do it the Arch way though. Seems a lot less painful once you get the hang of it. I've installed a couple things from the AUR at this point but it was on a bad wifi connection and it took forever. Now I'm wired up though which should make things easier.

Offline

#5 2016-06-06 23:09:03

TheChickenMan
Member
From: United States
Registered: 2015-07-25
Posts: 354

Re: [SOLVED]Python ImportError: No module named 'pip'.

You really should "always" use your package management system to handle packages. If a package does not exist, which is rare here, it's fast and easy to create one. This is one of the greatest things about Arch in general. Why you should always use a package management system

Last edited by TheChickenMan (2016-06-06 23:09:46)


If quantum mechanics hasn't profoundly shocked you, you haven't understood it yet.
Niels Bohr

Offline

#6 2016-06-07 01:15:55

bulletmark
Member
From: Brisbane, Australia
Registered: 2013-10-22
Posts: 681

Re: [SOLVED]Python ImportError: No module named 'pip'.

OP, you should not be installing python packages into your global environment as you are very likely to break things. That is why python does not install pip into any global namespace. You should be using a virtual environment for your application. When you create the virtual environment then python automatically installs pip into that environment. E.g using stock python on Arch:

python -m venv env
env/bin/pip install requests

Offline

#7 2016-06-07 03:23:09

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 20,334

Re: [SOLVED]Python ImportError: No module named 'pip'.

16oQL.gif

I think we have sent the message

Last edited by ewaller (2016-06-07 03:23:38)


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#8 2016-06-07 12:28:07

chiiidog
Member
From: Florida
Registered: 2016-06-04
Posts: 11

Re: [SOLVED]Python ImportError: No module named 'pip'.

bulletmark wrote:

OP, you should not be installing python packages into your global environment as you are very likely to break things. That is why python does not install pip into any global namespace. You should be using a virtual environment for your application. When you create the virtual environment then python automatically installs pip into that environment. E.g using stock python on Arch:

python -m venv env
env/bin/pip install requests

Yeah Im used to OS X where everythings more separated and idiot proof. I ended up setting up a virtual environment.

Last edited by chiiidog (2016-06-07 12:29:45)

Offline

Board footer

Powered by FluxBB