Learn Python:Pipenv problem installing pip

I was watching the walkthrough and the guy does not explain how to install pip if it isn’t already on your computer. I typed in pip --version and got this message: “zsh: command not found: pip”. I then tried to install pip by typing “pip install” but that didn’t work either. What should I do?

Also if anyone from codecademy’s team reads this I really wish your video walkthroughs were more detailed and explained this type of thing.

1 Like

Did you update to Catalina (which uses zsh rather than bash shell)?

Check this out:

and this:
https://pypi.org/project/pip/

Also, macs have Python 2.7 pre-installed on them. You will have to update to the latest version of Python.

I found this article that might help you:
https://blog.adafruit.com/2020/05/29/installing-the-latest-version-of-python-on-mac-os-catalina-python-mac-apple-catalina-letsbsocial1/

Or this one:
https://medium.com/towards-artificial-intelligence/how-to-run-jupyter-notebook-on-macos-catalina-in-four-steps-f7cc4e2cc270

Perhaps I’m mistaken but that first link seems to suggest changing the path for system Python (I might be wrong as I only nosed through it quickly). That sounds like it could come back to bite you. If you do install it, it would better to do so alonside the system python and avoid altering the path overmuch (just invoke the correct one when needed). The other one with anaconda should be a little less troublesome as conda keeps things separated nicely. A separste install from the system version and a separate environment to work in would probably be the way to go.

I think the walkthroughs are a little out of date now. Things just move a little too quickly. Perhaps the suggestions category would be a good shout if it has caused you trouble, I think it’s more likely to be spotted there.

2 Likes

@tgrtim You know, you’re right about that first one.

Awhile back I did follow the directions for the second link (the Medium post) and that did work for me. (I was relieved)

1 Like

Thanks I’ll check those articles out

I installed python 3.8 but when I type “python --version” into terminal it keeps telling me I have python 2.7 installed. It doesn’t seem to recognize that python 3.8.

I still can’t figure out how to install pip. I tried the links you sent, thanks. I just don’t really know what I’m doing yet with all these different programs and whatnot

I understand. It can become confusing.
You have to install pip

https://ahmadawais.com/install-pip-macos-os-x-python/

1 Like

Will pip be installed in the right place given that terminal doesn’t seem to realize I have installed python 3 already? It still returns python 2.7 when I type in “python --version”

Depending on your OS and the settings you used it may be linked with the name python3 instead. Try python3 -V (shorter flag for --version).

Sometimes the name is kept like this to avoid masking the system python alias. It’s possible pip (for python3, not your 2.7) would be linked with pip3 instead.

You could run it with the absolute path if necessary. The equivalent of the which command in your shell should give you the full path for the version you’re using or you could just hunt down the actual file if you had to and run it that way. A little knowledge on aliasing and you could get it set up in a fairly usable way and learn a little about the command line while you’re at it. That might be worth looking into.

2 Likes

I don’t know how to run it with the absolute path or what the “which” command is. It seems like I need to know a lot more about the command line to get through the walkthrough video.

Should I just skip this and continue with the computer science course? None of this has been explained in the course and I don’t know what I’m doing

It’s your call but learning at least the basics of the command line is very useful. It’s almost a requirement for just so many things that it can be hard to do without.

Did you try running python3? Most additional installs of python come with pip already installed but this may be aliased to pip3 for the python3 install.

If I’m not mistaken from the rest of this thread you’re using mac osx. Installing python 3.x probably should be named aliased under python3 in the command line.

Long term you’d want to look into setting up individual virtual environments for this (it’s more straightforward than it might sound).

2 Likes

I’m using mac osCatalina. The course did cover some command line but not enough to do all this. Thanks for your help I’m going to move onto the next part of the course because it really hasn’t taught me how to do any of this.

If you’re on a roll with that course at the minute then by all means carry on. At some point you will need to come back to it though.

2 Likes

The thing is I really can’t figure it out. I’ve tried the different things the articles suggest but whatever I’m doing just isn’t working. Do you think it would be easier if I did the command line course on codecademy first?

It can be frustrating and overwhelming.
My .02, yes I think it will help.
But I’d also supplement it with other resources online. Knowing UNIX commands is helpful too.

Update: If I’m not mistaken that course has you navigate around your bash profile.
If you’ve updated to Catalina, it’s now zsh (which is also UNIX based) but different. You might see a “Relocated Items” folder on your desktop, that’s where they put files that aren’t compatible any longer (configuration files). There should be a pdf description in that folder as well telling you what they are.

2 Likes

You might find this helpful:
https://ohmyz.sh/

It’s open source and it makes it a bit easier to update plugins, etc.

I have this and it helped me with fixing access to Jupyter Notebook bc Anaconda Navigator doesn’t work with Catalina.

Anyway, it’s a thought. Read up on it.

2 Likes

At some point you’d need to learn your way around so it’s not a bad idea. Chances are once you’re accustomed to it you’ll prefer using it for many tasks as it’ll be faster and easier that way (in addition to the fact many tools just don’t have a graphical equivalent).

The codecademy course is fairly basic but it should give you enough to invoke your own python programs with the command line (amongst other things). You’ll understand a whole lot more about how many things work once you’re done and you could consider a more advanced course if you then see the worth. I can’t see you ever regretting the time spent.

3 Likes

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.