Please help me learn how to run PIP INSTALL.

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
henvu50
Veteran
Posts: 337
Joined: Wed Aug 22, 2018 1:22 am
Contact:

Please help me learn how to run PIP INSTALL.

#1 Post by henvu50 »

This is from the Ren'py documentation: https://www.renpy.org/doc/html/python.html

"Ren'Py can import pure-Python modules and packages. First-party modules and packages – ones written for the game – can be placed directly into the game directory. Third party packages can be placed into the game/python-packages directory. For example, to install the requests package, one can change into the game's base directory, and run the command:"

Code: Select all

pip install --target game/python-packages requests
This is my scripts.rpy

Code: Select all

label start:

    init python:
        build.name = "test"
        
        pip install --target game/python-packages testPackage
No matter what variation of pip install I try, it always gives an invalid syntax error?

EDIT:
I've learned Pip is something you run from Python, but don't know how yet.
I think it means I need Python installed.
I've installed python-2.7.18.msi from here: https://www.python.org/downloads/release/python-2718/
I've run python.exe from c:\python27 and now I have a >>> prompt open. From here, I think I'm supposed to follow the instructions:
one can change into the game's base directory, and run the command: pip install --target game/python-packages requests
This is where I'm confused. I'm at the >>> prompt and have no idea how to change into a game's base directory to run the pip command.

User avatar
felix
Regular
Posts: 56
Joined: Sat Feb 11, 2006 1:50 am
Completed: Before the Faire
Organization: No Time To Play
Tumblr: no-time-to-play
Github: notimetoplay
itch: notimetoplay
Contact:

Re: Please help me learn how to run PIP INSTALL.

#2 Post by felix »

You got confused. :) pip is a command-line tool, use it from a command prompt or terminal, not from within Python.

(It can also be used from within Python because it's really just a Python module, but that's more complicated and another story.)

But what are you even doing with pip in the context of Ren'Py? Ren'Py has its own embedded Python interpreter, you can't add extra modules to it that way. Even if you could, it would have to be its own private pip, not the one that comes with your system-wide interpreter.

henvu50
Veteran
Posts: 337
Joined: Wed Aug 22, 2018 1:22 am
Contact:

Re: Please help me learn how to run PIP INSTALL.

#3 Post by henvu50 »

felix wrote: Thu Apr 22, 2021 2:02 am You got confused. :) pip is a command-line tool, use it from a command prompt or terminal, not from within Python.
I eventually figured this out. I ended up copying pip.exe to my game folder and using it from there.
But what are you even doing with pip in the context of Ren'Py? Ren'Py has its own embedded Python interpreter, you can't add extra modules to it that way. Even if you could, it would have to be its own private pip, not the one that comes with your system-wide interpreter.
Certain software requires I use pip to install a WHL file for use in python language environment. I think because Ren'py has embedded Python interpreter, that's the only reason I'm able to use this WHL installed via PIP.

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot]