How to fix ‘setup.py –no-user-cfg install’ error for pip on macOS
macOS comes with Python installed out-of-the-box which is great. Unfortunately, the version of Python that is installed is an outdated one. In fact, you cannot do an in-place update of the language and move to a higher, supported version. Installing Python 3 on macOS is a manual task.
Install pip
Since Python 2 is no longer supported, the latest tools that work with Python are also built to work with the new supported version. If you’ve installed Python 3, or you’re sticking to Python 2 but want to install pip, you can do so with a simple Terminal command, provided you have Homebrew installed.
brew postinstall python3
If you’re getting the ‘setup.py –no-user-cfg install’ error though, your installation is failing.
Fix ‘setup.py –no-user-cfg install’ error
In order to fix the ‘setup.py –no-user-cfg install’ error, and install pip on macOS, you need to use a different command. Open Terminal, and run the following command.
sudo easy_install pip
You will be prompted to enter the admin or the current user’s password but once you do, pip will be installed.
To check if it has been installed, run the following command in Terminal.
pip --version
Why use pip?
If you’re new to Python, chances are you’ve been advised to install pip. If you’re trying to build a Python app from Github, the build or installation command probably starts with ‘pip’.
pip is the package manager for Python. It is an almost essential tool if you plan on working in Python. There are other package managers available but you won’t find too many developers using them, or recommending them. pip is the standard and it’s also cross-platform meaning you can use it on a Windows 10 system as well as on a Mac.
macOS comes with Python installed by default but it doesn’t come with pip installed. For novice users who are learning Python or trying to build their first app from a Github repo, this can be confusing. As far as they know, they have Python installed on their system so the pip command, which appears with everything to do with Python projects, should work.
We can’t exactly fault Apple for this since it’s part of the learning curve to know which tools you need to work with a particular language. The company is at fault for not updating the version of Python it gives users with macOS. Even with Python 3 installed on macOS, Python 2 still exists and runs alongside it. You have to modify the command a bit to use Python 3.