#๐Ÿ”’ How to use pip?

38 messages ยท Page 1 of 1 (latest)

abstract iron
#

I've been racking my head trying to figure out why pip isn't working (need it for pytest and pygame)

Python states that pip is not defined
HELP! (I'm a beginner to programming and this is for my university)

civic frigateBOT
#

@abstract iron

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

supple granite
#

What command exactly are you running?

abstract iron
#

pip install pygame

supple granite
#

And on what OS are you? (Windows I assume?)

abstract iron
supple granite
#

Try: py -m pip install pygame

abstract iron
#

File "<python-input-4>", line 1
py -m pip install pygame
^^^
SyntaxError: invalid syntax

supple granite
#

You're in the REPL

#

Not in a terminal

abstract iron
#

Ah

#

I thought i had to run the command on the Python app

#

I did just get an error though

supple granite
abstract iron
# abstract iron I did just get an error though

should i send every line for this?

it states note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

ร— Getting requirements to build wheel did not run successfully.
โ”‚ exit code: 1
โ•ฐโ”€> See above for output.

supple granite
#

What command did you run exactly?

abstract iron
#

simply copy pasted it

supple granite
#

Let me try it out myself

supple granite
# abstract iron this^^

This is the output I get:

(.venv) PS C:\Users\samur\PycharmProjects\PythonProject1> py -m pip install pygame
Collecting pygame
  Obtaining dependency information for pygame from https://files.pythonhosted.org/packages/7e/11/17f7f319ca91824b86557e9303e3b7a71991ef17fd45286bf47d7f0a38e6/pygame-2.6.1-cp313-cp313-win_amd64.whl.metadata
  Downloading pygame-2.6.1-cp313-cp313-win_amd64.whl.metadata (13 kB)
Downloading pygame-2.6.1-cp313-cp313-win_amd64.whl (10.6 MB)
   โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” 10.6/10.6 MB 25.5 MB/s eta 0:00:00
Installing collected packages: pygame
Successfully installed pygame-2.6.1

[notice] A new release of pip is available: 23.2.1 -> 25.2
[notice] To update, run: python.exe -m pip install --upgrade pip
(.venv) PS C:\Users\samur\PycharmProjects\PythonProject1> 

What did you get?

abstract iron
#

a massive mess of lines, not at all what you get

supple granite
#

a little more precise please?

abstract iron
civic frigateBOT
supple granite
abstract iron
#

I have no idea what that is o_o

We just started covering python and I was meaning to install it now

supple granite
#

What IDE are you using?

abstract iron
#

I downloaded vscode but all we've done so far is porting over things from Pyret to Python, not at all began messing with venv

#

I really wish i could specify more

#

Should i install venv?

supple granite
# abstract iron I downloaded vscode but all we've done so far is porting over things from Pyret ...

Hmm. I think the by far easiest way for you would be to go with PyCharm: https://www.jetbrains.com/pycharm/. It's a very powerful IDE and - at least I'd assume it - the status quo for Python development. The advantage for you as a beginner is that it takes care of all those venv (virtual environment) related things, as well as actually running the code.

If you insist on using VS Code there's a series of commands you'll need:
These steps you'll need to do once per project:

  1. cd into your project's directory
  2. py -m venv .venv to create the virtual environment for this project in a folder .venv (. is a prefix for hidden files)
    These steps you need to repeat every time you open the project:
  3. .\.venv\Scripts\activate
  4. py -m pip installs as required
abstract iron
#

I'll download PyCharm then, how would I go around with pytest and pygame?

supple granite
abstract iron
#

got it! thanks!

#

!close

civic frigateBOT
#
Python help channel closed with !close

This help channel has been closed. Feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.