When installing ERPNext, you may run into an issue that displays the message:
ERROR: There was a problem while creating karani
This error message is then followed by the following message:
Do you want to rollback these changes? [y/N]:
See below screenshot:

This can be a frustrating feeling especially because there isn’t a clear reason why your installation is failing. This is the reason I put up this brief article to help.
The issue here is squarely a pip issue, and it can most of the time be solved by running the following command.
pip3 install --upgrade --user pip
If that doesn’t seem to save the day, run the following command:
pip3 install --user "setuptools<45"