pip3 install keyboard command not working

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
Nightmarecool2
Newbie
Posts: 10
Joined: Thu Aug 11, 2022 5:38 pm
Contact:

pip3 install keyboard command not working

#1 Post by Nightmarecool2 »

This is the traceback:

```
I'm sorry, but errors were detected in your script. Please correct the
errors listed below, and try again.


File "game/script.rpy", line 4: expected statement.
pip3 install keyboard
^

Ren'Py Version: Ren'Py 8.0.1.22070801
Thu Sep 22 21:19:28 2022
```
How do I install this library to my project?

enaielei
Veteran
Posts: 293
Joined: Fri Sep 17, 2021 2:09 am
Organization: enaielei
Tumblr: enaielei
Deviantart: enaielei
Github: enaielei
Skype: enaielei
Soundcloud: enaielei
itch: enaielei
Discord: enaielei#7487
Contact:

Re: pip3 install keyboard command not working

#2 Post by enaielei »

Some steps you need to consider.
1. Identify the python version that your renpy sdk is using. You can check the python version of your renpy sdk by going to the renpy launcher then hitting shift + o and entering the following.

Code: Select all

import sys; print(sys.version)
2. Install the python version that your renpy sdk is using. To check if installed, launch a new terminal then enter the following.

Code: Select all

python --version
3. Install pip. This usually gets installed alongside python. To check if installed, launch a new terminal then enter the following.

Code: Select all

pip --version
4. Create a python-packages folder inside your project's game folder (<your_project_path>/game/python-packages).
5. Launch a new terminal then enter the following.

Code: Select all

pip install --target=<your_project_path>/game/python-packages <package_name>
6. Import it into your renpy scripts.

Code: Select all

init python:
    import <package_name>
Reference: https://www.renpy.org/doc/html/python.h ... d-packages

Nightmarecool2
Newbie
Posts: 10
Joined: Thu Aug 11, 2022 5:38 pm
Contact:

Re: pip3 install keyboard command not working

#3 Post by Nightmarecool2 »

The 5th step is not working for some reason, it says access denied?

I don't know if this helps but my python is version 3.9.10 and pip is version 21.2.4

enaielei
Veteran
Posts: 293
Joined: Fri Sep 17, 2021 2:09 am
Organization: enaielei
Tumblr: enaielei
Deviantart: enaielei
Github: enaielei
Skype: enaielei
Soundcloud: enaielei
itch: enaielei
Discord: enaielei#7487
Contact:

Re: pip3 install keyboard command not working

#4 Post by enaielei »

Try launching a terminal with elevated permissions.
A note also that if your whole path contains spaces or weird characters then enclose it with double quotes.

Nightmarecool2
Newbie
Posts: 10
Joined: Thu Aug 11, 2022 5:38 pm
Contact:

Re: pip3 install keyboard command not working

#5 Post by Nightmarecool2 »

Sorry I might not be that good with command prompt, but when I wrote the same thing it still says access denied(With administrative properties)

enaielei
Veteran
Posts: 293
Joined: Fri Sep 17, 2021 2:09 am
Organization: enaielei
Tumblr: enaielei
Deviantart: enaielei
Github: enaielei
Skype: enaielei
Soundcloud: enaielei
itch: enaielei
Discord: enaielei#7487
Contact:

Re: pip3 install keyboard command not working

#6 Post by enaielei »

Worked fine for me, didn't even have to elevate the command prompt.
Make sure that your root directory is writable, in the attached picture, my project exists under my user/username folder, so that should be safe. In short, try placing your project in the most common folders such as Documents, etc.
pip install
pip install
import.png
importing
(9.44 KiB) Not downloaded yet

Nightmarecool2
Newbie
Posts: 10
Joined: Thu Aug 11, 2022 5:38 pm
Contact:

Re: pip3 install keyboard command not working

#7 Post by Nightmarecool2 »

Oh I see my mistake was that I used "<" instead of quotation marks it worked now thanks a lot!

Post Reply

Who is online

Users browsing this forum: No registered users