Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I be sure I installed pip correctly on Mac OSX?

Tags:

python

macos

pip

This might seem like a silly question, but I was flying through the installation of pip as described here:

https://pip.pypa.io//en/latest/installing/

And then read the following warning after I installed it:

Be cautious if you are using a Python install that is managed by your operating system or another package manager. get-pip.py does not coordinate with those tools, and may leave your system in an inconsistent state.

Python I believe was part of OSX. I didn't have to install it. How can I ensure that I haven't inadvertently left my system in an inconsistent state?

No obvious errors. All seemed to install fine.

like image 301
user1447679 Avatar asked Sep 27 '17 16:09

user1447679


People also ask

How do you check if pip is installed properly?

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.

Is pip automatically installed on Mac?

Usually, pip is automatically installed if you are: working in a virtual environment. using Python downloaded from python.org. using Python that has not been modified by a redistributor to remove ensurepip.

Why is pip not working Mac?

Sometimes when you are installing packages, you might face the error: pip: command not found . 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.

Where does pip install look?

pip looks for packages in a number of places: on PyPI (if not disabled via --no-index ), in the local filesystem, and in any additional repositories specified via --find-links or --index-url .


1 Answers

A pip installation and a Python installation are very tightly connected for a very simple reason: pip modifies libraries located in either PYTHONPATH or if you are using user installations PYTHONUSERBASE. Running get-pip with the appropriate Python installation successfully means that it should work properly. In fact, pip is a Python module in your PATH: if pip --version works and points to the correct Python installation, you did install it correctly.

The warning on pip's website has nothing to do with leaving the system in an inconsistent state after the installation per se.

In fact, screwing other things up during the pip installation would be a very rare event, since it has no dependencies. The warning has to do with coordinating package versions between pip and the system:

  • pip install may upgrade a package (directly, or when installing dependencies), while your system expects an older version of that package
  • your system may upgrade a package, while pip expects an older version
  • your system may overwrite all site-packages and even delete pip

P.S. sorin's suggestion to install pip with --user is good. pip and the packages that pip installs will be located in your user home directory and they won't interfere with your system's site packages.

However, keep in mind that when importing packages, Python will prefer system packages over user packages. So if your system has requests==2.18.1 and you did pip install requests==2.18.4, your project will import the older version when doing import requests. You have to tweak your project environment to fix this.

like image 141
Filip Dimitrovski Avatar answered Oct 19 '22 22:10

Filip Dimitrovski