Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

pip command not found after installed it

I'm stuck with an issue. I have a Python script that I would like to run on my OSX but seems that I crossed on many issues.

To run the script I should have both Python and Moviepy installed.

To install Moviepy I used this command:

sudo pip install moviepy

The response was:

sudo: pip: command not found

So I tried to install pip, with the command:

sudo easy_install pip

And got this answer:

Searching for pip
Best match: pip 9.0.1
Processing pip-9.0.1-py2.7.egg
pip 9.0.1 is already the active version in easy-install.pth

Using /Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg
Processing dependencies for pip
Finished processing dependencies for pip

I tried to run again the

sudo pip install moviepy

but I still got that issue. What I should do?

UPDATE:

not sure on OSX, but can u try pip3 – Rehan Azher 23 mins ago

sudo pip3 install moviepy
Password:
sudo: pip3: command not found

It seems that pip is not in your path, but as long as Python can find it: sudo python -m pip install moviepy should do it. Check your $PATH env. variable, tho. – zwer 14 mins ago

sudo python -m pip install moviepy
/usr/bin/python: No module named pip

UPDATE2

A good option for you is to consider installing pip using one of OSX's sources, like the apt program in Debian-based distributions, rather than easy_install. – Shiva 4 hours ago

sudo apt install moviepy
Password:
Unable to locate an executable at "/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/bin/apt" (-1)

No idea why everyone keeps getting stuck on this. You have a fundamental decision to make when using Python. You either run Python 2.7 that Apple ships and which is ancient and doesn't have pip or you use homebrew and install Python3 and pip3 and put /usr/local/bin at the start of your PATH. But don't try a mixture of the two. – Mark Setchell 3 hours ago

Tried to install homebrew but it cannot find the package moviepy that I am looking for.

like image 313
Andrew Avatar asked Apr 03 '18 10:04

Andrew


People also ask

Why is my pip install not working?

The most common reasons for issues with PIP installations is either that an incorrect PIP path is added to the PATH system variable, or the PIP path isn't added at all. This often happens because users forget or don't know to include PIP during the Python installation.

How do I make sure pip is installed?

To check if PIP is already installed on Windows, we should open the command line again, type pip , and press Enter . If PIP is installed, we will receive a long notification explaining the program usage, all the available commands and options.

Why is pip not working Linux?

This error could be due to the following reasons: Pip is not installed. Pip is installed, but it is not compatible with the current environment.


2 Answers

Try with this:

pip3 install package-name

This works for me!

like image 107
guillerey Avatar answered Oct 19 '22 02:10

guillerey


Yes, it's a mess. Today, your best option is to leave the ageing, OS-provided version of Python (all the stuff in /Library/Python and similar) alone and start fresh.

It looks like you've already done this (since you have an executable at /usr/bin/python) but if not, the easiest way to get Python 2 is to use Homebrew. Install Homebrew using the instructions on the website and then use it to install Python:

brew install python@2

Python 2.7.9+ comes with pip already, but if you've ended up with an older version then use python itself and get-pip.py to install pip (instead of easy_install, which is deprecated):

curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python get-pip.py

Note that get-pip.py includes a copy of pip in order to install pip effectively. Yes, things are that bad.

Finally, note that Python 2 will be end of life in less than 6 months. If you have the luxury, consider skipping straight to Python 3. Then it's as easy as:

brew install python

because pip3 comes with python3 since version 3.4. Homebrew manages to handle the installation of both Python 2 and Python 3 without conflict.

Note this procedure is different on every operating system and every month or two. But at least it should get you going for the foreseeable future.

like image 1
Heath Raftery Avatar answered Oct 19 '22 04:10

Heath Raftery