Learn Python: pipenv -> M1 MBP pip not installed by default as video assumes. No luck trying to figure it out on google

I spent forever trying to figure out how to install python3 to MacOS last week. Went through some rabbit hole of Anaconda (which i didn’t want) , homebrew install, etc.

Now this assignment is assuming we have pip installed (could never get it to work).

Entered this from youtube video into terminal. seemed to have worked:

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

then entered this and gave me some errors because I suppose I installed it previously:

python3 get-pip.py

Installing collected packages: pip
Attempting uninstall: pip
Found existing installation: pip 21.3.1
Uninstalling pip-21.3.1:
Successfully uninstalled pip-21.3.1
/opt/homebrew/lib/python3.9/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
WARNING: The scripts pip, pip3 and pip3.9 are installed in ‘/opt/homebrew/opt/python@3.9/Frameworks/Python.framework/Versions/3.9/bin’ which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
/opt/homebrew/lib/python3.9/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.

Then entered:

pip --version

Result:

zsh: command not found: pip

FML!

Python3.9 would already come with pip, there’s no need for curl or otherwise. Having the pip library included is different to being able to use just pip on the command line though.

I’d highly suggest learning a bit more about the command line, there’s a CC course on it or look around elsewhere if you prefer. This line notes part of the issue-

“WARNING: The scripts pip, pip3 and pip3.9 are installed in ‘/opt/homebrew/opt/python@3.9/Frameworks/Python.framework/Versions/3.9/bin’ which is not on PATH.”

Things that aren’t on your PATH cannot be used as unadorned commands in your terminal. A command like python for example really runs a binary or scipt from a location like /bin/python or similar. If there’s no pip script on your PATH then it wouldn’t work easily either.

But you do seem to have python3 on the PATH (make sure you know which install that actually refers to though). You should be able to use python3 -m pip --version to make use of the python3 pip library.

I’d be careful with installing multiple versions from different places and making too many changes that you can’t keep track of. Having several sets of Python libraries directly on your PATH risks the wrong ones being used with the wrong python version. Learning even the basics of the command line at least demystifies a lot of this.

2 Likes

python3 -m pip --version

worked

pip 22.0.3 from /opt/homebrew/lib/python3.9/site-packages/pip (python 3.9)

thank you sensei
i’m trying to learn python atm, not command line
i enjoy being able to google myself out of things, but this one i couldn’t because of my small knowledge
i suggest cc updates the lesson
thanks, again

1 Like

You don’t have to drop what you’re doing but I’d still suggest looking into it at some point, it’s one of those things that just makes programming life a little easier (or remains a thorn in your side).

python3 -m pip install --user pipenv

worked

for the people that come to this thread in the future. The problem from what I’ve learned is that macos on m1, or since some recent macos update, assumes that python is python2. I read multiple articles about the correct way to install python3 so that it doesn’t f up your whole ■■■■. DATA OVERLOAD. I have no idea what i’m doing, but tried to follow youtube videos that claimed that you need to do this the right way or you’ll have multiple libraries that will ■■■■ your whole ■■■■ up. I believe this is a beginner course. Apple ■■■■■■ us with their reliance on libraries that default to python 2. I hope you don’t go chasing the dragon in the rabbit holes like i have. Use commands provided earlier from sensei.

make sure you add the -m i tried without it and it didn’t recognize