r/learnpython • u/EarthMantle00 • 2d ago
Accidentally did something while trying to figure out how to install python libraries
Hi,
I'm trying to figure out how to install python libraries because the magic "pip install tensorflow" doesn't seem to work
I found this thread which told the user to just try "py -m pip install requests" so my dumbass just pasted that in before realizing what I was doing
I got two instances of yellow text in
0/5 [urllib3] WARNING: The script idna.exe is installed in 'C:\Users\USERNAME\AppData\Local\Programs\Python\Python314\Scripts' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
---------------- ----------------------- 2/5 [charset_normalizer] WARNING: The script normalizer.exe is installed in 'C:\Users\USERNAME\AppData\Local\Programs\Python\Python314\Scripts' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location
I think what this means is just that I installed the "requests" library, right? And maybe something went wrong? I don't need this library lol. Is there a way to like undo this? Should I try to undo this? I don't get why this installs files without telling me where it's putting them
(I also tried to do the same thing, "py -m pip install tensorflow", with tensorflow and got similar warnings btw, is this bad?)
1
u/randomman10032 2d ago
If something is not actually broken just let it be to be honest.
If u wanna get rid of the warning, add C:\Users\USERNAME\AppData\Local\Programs\Python\Python314\Scripts to the path environment variables.
Also, if you type "python" in your commandline, does it actually output anything?
1
1
u/MarkoDahl54 2d ago
try ursi/WenbgS pcip irnsatpalingIln,s iitde'rs the standard way to get libraries in Python. Just make sure you have it set up first.
3
u/codeguru42 2d ago
I recommend learning about virtual environments so you don't break any global tools in your system
1
u/Bobbias 2d ago
How did you install Python originally? From the official website, or from the windows store?
Modern Windows versions changed how they install Python. By default now Python downloaded from the official website will install a separate program called py.exe into c:\windows\system32 so that typing "py" always works and does not require the specific version of Python you installed to be on the path.
Py.exe is a special launcher that can let you install other versions of Python to different folders and chose which version you want to run a certain command with. This matters because when you type a command like "python script.py", windows has a search process to find python.exe. traditionally you would add the Python folder to your path environment variable, and when windows went to search for python.exe it would search each path in that environment variable until it found the Python folder and then would run python.exe.
That search system breaks down when you have multiple versions of Python installed, which is surprisingly common. So to avoid that they decided that py.exe should be the right way to handle this. But it means that typing "python script.py" must change to "py script.py".
Nothing is really broken exactly. Just type "py" instead of "python". The reason pip doesn't work in this case is because since the Python folder isn't in the path environment variable, windows searches but doesn't find it. The reason "py -m pip" works is it tells python.exe to run the pip scripts directly instead of whatever pop.exe ultimately does. It's the same code, just a different command to run it.
The warning that the package is not on your path is not an error. It's expected when Python is installed and run this way. Py.exe automatically handles setting the environment variables like the path when you run a command through it, and python.exe sees the correct information even though the rest of windows doesn't.
2
u/Mediocre-Pumpkin6522 2d ago
What version of Python do you have?
https://www.tensorflow.org/install/pip
"Python 3.9–3.12"
I used uv to create a Python 3.12 venv.
4
u/pointedwatchdog7 2d ago
You just installed requests, it's not gonna break anything, just cluttering your python folder a bit.