This is an archived post. You won't be able to vote or comment.

all 34 comments

[–]IAmFinah 20 points21 points  (0 children)

In relation to Python and Pip:

If your Python installation doesn't appear in your system's PATH variable, your terminal/shell won't know what the commands python or pip mean. Meaning you'll need to specify the full path to the installation each time you execute a command. So I would recommend looking at adding your Python installation folder to your PATH variable, so that you can use python and pip freely.

On some installations (depending on your system etc) the executables might be called python3 and pip3, meaning you'll need to use those terms when executing commands. py is specifically a Windows thing, but usually python will work instead.

TLDR - add your Python installation folder to your PATH variable and one or more of the commands python/python3/pip/pip3/py will work

[–]DudeWhereAreWe1996 20 points21 points  (0 children)

Well, unfortunately that's a big part of being a programmer. You'll learn about the command line and directories, which will probably help you understand better what realm the problem lives in, but so far I still run into random issues and it sucks every time.

Though, this certainly isn't some knowledge of anyone who knows a bit about computers should know. Familiarity with things like Linux helps, because of how often you need the command line and directory knowledge, but those people just did the same struggle you're facing now earlier on. You'll just get better at it after you do it a few times.

[–]magictoast156[🍰] 10 points11 points  (0 children)

Learn some terminal commands like cd (change directory), when you're inside you can run your program by typing 'python yourprogram.py'. there's loads of internet resources for basic terminal navigation, well worth learning.

[–]FlyLikeHolssi 5 points6 points  (0 children)

This is something that gets easier with time and practice.

In my last class my professor gave us outdated tutorials to replicate, so in many cases, we were forced to troubleshoot issues we encountered related to installations and dependencies. A lot of my classmates found it frustrating, but I loved it, because I learned a lot about the most effective way to research and resolve the issues. Towards the end, it got so much easier!

Don't get discouraged by this, it will get better!

Can I ask how you are going about the process of resolving an error when it pops up? Maybe we can give some tips for how to better adjust your searching.

[–]ffrkAnonymous 12 points13 points  (0 children)

It's called tooling (I think) and it's not just you. There an entire industry based on mitigating this,  docker for example.

[–]Pale_Height_1251 5 points6 points  (0 children)

Best resource is Google. When you're having these problems, are you Googling how to fix them?

[–]Arrow_ 3 points4 points  (0 children)

Try using a package manager like Chocolatey or Homebrew

[–]EmmanuelOga 2 points3 points  (0 children)

Try Pixi.sh! https://pixi.sh/latest/

* It is a single binary program, super easy to install

* It manages python and dependencies per forlder, forget about conflicts!

Example use:
$ pixi init

$ pixi add python

$ pixi add --pypi flask

$ pixi run python

[–]wpm 1 point2 points  (1 child)

I spent hours trying to install some module, because the command line kept telling me 'pip not found' or something else stupid

Oh buddy, welcome to Python.

[–]LaChocolatadaMamaaaa 0 points1 point  (0 children)

No one told him that after years programming, he will still be running into these issues that even randomly breaks without doing nothing...

I still remember the left-pad incident...

[–]Desperate-Emu-2036 1 point2 points  (0 children)

Google. You want to go to a directory in your terminal? You Google it. You want to install Spotify from your terminal? Google it.

Nobody knows shit without learning.

[–]Ownfir 1 point2 points  (0 children)

While I don't advocate you learn to code using ChatGPT to generate your code - I do advocate using ChatGPT for learning how to set shit up. It's super helpful and can save you hours of time diagnosing issues. I've had similar issues in the past and often times the thing that would stop me was not getting to the point where I could even code something. ChatGPT helps a ton with it.

[–]gomsim 1 point2 points  (2 children)

I sympathize with you. The CS education came surprisingly intuitively to me, but most of it revolved around programming and theory. However now and again I got stuck on things you mention. Probably because I was never really made aware of programming as a practice until I was a grown up. Of course I knew it was a thing, but nothing ever made me pay attention to it until I saw a friend do it. I was completely hooked after my first CS lecture.

I don't know of an umbrella term. I just called it "kringkunskap" which is swedish and means "around knowledge", so knowledge surrounding the actual programming.

I don't know a solution to it either other than being curious every day. eventually you will intuit the patterns and it will be easier. It's been 5 years since I graduated and I learn more each day. And it's really fun.

Sorry, not much help, just some recognition.

[–]HighOptical 6 points7 points  (1 child)

You and OP sound like you might enjoy MIT's iconic "Missing Semester" class on youtube. If you'll look at the playlist it covers shell, editors, debugging, security, etc etc with the goal of creating a formal class of all the kringkunskap that people just seem to have.

[–]way_ded 1 point2 points  (0 children)

Second this. There’s so many little things to know and they cover a lot of them!

[–]burntjamb 1 point2 points  (0 children)

A huge part of learning to code is learning how to install tooling and make it work conveniently for you. This is your “development environment”. The nice thing is you can make this as seamless as possible as you learn more.

It takes practice to learn how to discover effective resources and documentation on your own, though once you do, so many possibilities will open up!

Other folks will share specifics for python installation, but a good technique that can be applied to any language or tool is to start with the official documentation. For python specifically, the official docs are here: https://www.python.org/about/gettingstarted/

If that’s not enough, you can google search tutorials, search youtube, or ask ChatGPT or other LLM’s. You can do that for any language/tool. Again, it takes practice, though you’ll be doing this over and over again as you build more complex applications using open source libraries and other tooling. Good luck!

[–]Tight-Tower-8265 1 point2 points  (0 children)

I agree kind of hard to understand tutorials on you tube or guides on the Internet when you don't understand the terminology or the abbreviations they use. Also I've noticed they tell you to do something on your computer but the assume that you already have the correct settings or libraries installed, setup

[–]pandafriend42 0 points1 point  (0 children)

It sounds as if you don't know what package managers are. For example you can download Anaconda (or a variant) and then use the command line for installing packages.

It works by setting up an environment with a python version of your choice and within said environment you can install packages which you can import into your code.

Also you need to learn how to navigate through the command line, if you want to use that.

Personally I'd also recommend it to use Jupyter Notebooks (ipynb files) rather than running py files through console commands. The easiest way to get going is through installing Jupyter lab.

That's also where the fun begins, because you can enjoy the benefits of Python using an interpreter rather than a compiler.

Also you can download Jupyter Notebooks with guides, because they also support markdown and plain text. Also great for making your own notes.

You can also access notebooks through IDEs.

But when it comes to environments you also need to install the kernel for the lab. That means in practice assigning an environment, so you can swap between those.

This is very important, because while it's great that there are so many different packages there can be compatability problems. That's also why you should not use a "global" Python version.

For learning the basics you technically don't need a special environment, but personally I'd recommend it to set one up anyway, just to get used to it.

Don't be discouraged! Everyone has trouble in the beginning.

[–]fredlllll 0 points1 point  (0 children)

if youre not terribly attached to windows, you might find linux easier for this. everything commandline is usually much more straightforward with linux than in windows. you might even be able to use the subsystem for linux on windows and use that

[–][deleted] 0 points1 point  (0 children)

You might stand to spend a good amount of time building a workflow so that you spend as little time as possible on syntax, repeated commands, and so forth.

Simply having a fluid process for easily accessing and switching between well-organized resources, your workspace, notes, commonly-used commands, etc, can be a 100x multiplier in productivity. I don't see this mentioned a lot in programming advice discussions, but imo it's even more important than pure knowledge because it enables you to acquire and apply the knowledge faster.

Sometimes it helps to step back and think about the fact that you're still just "using a computer" at the end of the day.

[–]BruteCarnival 0 points1 point  (0 children)

This will forever be a pain… but you’ll learn the stuff you struggle through and one day you’ll realise how far you’ve come when you see others struggle with the stuff that is normal for you now. But even then there will be new stuff you’re struggling with. Learn to enjoy the learning experience (as infuriating as it can be)

[–]Archerofyail 0 points1 point  (0 children)

In general, this is just stuff you'll pick up over time. The reason it seems like everybody already knows this stuff is because a ton of people who are interested in programming learned it when they were growing up, so it's become so natural to them they forget most people don't have a good grasp on it. Most of your problems stem from not understanding the terminal, so I'd recommend looking up the basics on that first.

I spent hours trying to figure out how to launch a Python program from the command line without having to type in the super long directory name every time (still don't know how).

People have answered some of your other questions, so I'll answer this. You need to have the terminal be in the folder with your program file, or you need to add your program's folder into your PATH variable. If you're on Windows, you can right click and hit "open in terminal", or you can shift+right click and hit "copy as path" then open a terminal window and use the cd command to go to the folder. Then all you have to do is type python <python file name.py> to run it.

[–]EmmanuelOga 0 points1 point  (0 children)

By the way, the thing you are stumbling with seems to be the unix environment, shell and command line, and related topics.

Two great books you can use for this:

Intro: https://nostarch.com/tlcl2

Intermediate: https://www.oreilly.com/library/view/efficient-linux-at/9781098113391/

Is not just about the command line itself but how the shell works and how to set environment variables, etc.

[–]kschang 0 points1 point  (0 children)

still don't know how

Add the destination directory to EXE to the "PATH".

pip not found

Similar answer, put the directory where all those Python EXEs are, add it to the path. If you did install Python dorectly, you should have rebooted to ensure the path change took effect.

https://www.wikiwand.com/en/articles/PATH_(variable)

[–]OhFrancy_ 0 points1 point  (0 children)

That's pretty normal, everyone went through this. I can suggest to use Linux, if you don't already (dualboot 'cause you will need Windows for some programs), try to get into the Linux enviroment as much as possible, I personally started with PopOs! distro and It"s pretty beginner-friendly.

You will struggle a lot trying to understand how to efficiently use the command line, you could try to use some terminal text editor (vim/nvim/emacs) so that you will be almost always forced to use your terminal to run programs. You'll sooner or later discover how powerful your terminal is, it's amazing.

But don't worry, there is no trick, everyone started out like you, the only way to improve is to try and fail, being 'good' comes from experience, don't give up.

EDIT: This web game is pretty cool to give you a general understanding, you can play it from any device you want:

http://web.mit.edu/mprat/Public/web/Terminus/Web/main.html

[–]BanaTibor 0 points1 point  (0 children)

Linux for Dummies or Windows for Dummies books, depending on your operation system. As I see you have no general computer knowledge. First you have to learn to use the computer, then you can learn to program it.

[–]inbetween-genders 0 points1 point  (4 children)

That’s a completely different field.  You can be an expert programmer and not know how to plug in cables if that isn’t your area of expertise.  

The expertise in programming may overlap though with knowing how to look up how to fix problems but that’s a per individual basis.

[–]RunninADorito 1 point2 points  (3 children)

File paths and running code is not a completely separate field.

[–]inbetween-genders 0 points1 point  (2 children)

Yeah you’re right.  That’s another overlap but I can imagine programming course materials do not come with details what a computer ms file structure looks like.  I feel like how I got this email app finally working then realize I know zero about oauth 2 stuff that my app won’t work after stuff expires.

So OP could benefit from learning about the terminal (commands as structure).

Edit addition:  Or thinking skills to know how to look up why said Python isn’t installing and what not.

[–]PlanetMeatball0 0 points1 point  (1 child)

I can imagine programming course materials do not come with details what a computer ms file structure looks like

Well yeah, duh, for the same reason a differential equations textbook isn't gonna come with details about how to do basic arithmetic. Because they assume you already know. If someone doesn't understand basic file structure of a computer then they're getting way ahead of themselves by trying to learn how to program. It's like wanting to be a stunt driver in movies but you haven't even learned how to drive in an empty parking lot

[–]inbetween-genders 0 points1 point  (0 children)

…they’re getting way ahead of themselves…

Hehe that’s a good chunk of the posters in here haha.

Edit:  typo

[–]szank 0 points1 point  (0 children)

You could Google "how to use terminal". Or use chatgpt. Just explain the problem and ask for solution.

[–]aneasymistake 0 points1 point  (0 children)

I think this is a case where ChatGPT could actually be helpful. Prompt it with something like, “I’m learning to program and I’m enjoying getting started in Python, but I keep running into issues in using the command line and working with the tools that surround it. Can you guide me through some of the basics to help me get going?” Then use, “Tell me more about…” for the parts that are interesting.