'Unable to install pika using pip install

Getting the following after launching : pip install pika
(I have shorted the exception to first line in trace and last line)

Collecting Pika
  using cahced pika-0.10.0-py2.py3-none-any.whl
Installing collected packages : pika
Exception:
Traceback 
File" /usr/local/lib/python2.7/site-packages/pup/basecommand.py line 223 in main status = self.run(options, args)
.
.
.
File "/usr/local/lib/python2.7/os.py" line 157 in makedirs
mkdir(name ,mode)
OSError [Errno13] Permission denied: '/usr/local/lib/python2.7/site-packages/pika'

Also tried with sudo before but I got sudo pip,command not found.



Solution 1:[1]

it's better to use virtualenv and run your application within a python sandbox but if you still want to install on your system packages I guess you should reinstall pip. if you're on ubuntu or debian just run sudo apt-get update and sudo apt-get install python-pip and then retry pip install pika with sudo: sudo pip install pika

Solution 2:[2]

By this way, you are trying to install pika under global python installation, turning it available to whole system.

Permitions for global python installation is granted for root, by default. If you want to really install as global, you should use "sudo" or some other way to run as root, by example, "su".

To install using sudo, you can run like:

sudo apt-get install python-pika

or, using pip:

sudo pip install pika

By suggestion, If you don't need a global installation of pika, it is really recommended to install it under virtualenv, isolating this installations between each environment. For more information: http://docs.python-guide.org/en/latest/dev/virtualenvs/

Solution 3:[3]

python3 -m pip install pika worked for me.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 mehdy
Solution 2 Andre Pastore
Solution 3 Juda Rostub