Make used Python path available to the BGE #52655

Closed
opened 2017-09-05 21:24:15 +02:00 by Paul Maréchal · 11 comments

System Information
Windows 10

Blender Version
2.78c

Short description
The Python interpreter path should be made available to the bge module.
Currently on Windows to get the currently-used Python path we would use sys.executable, but this line returns the Blender executable, not Python's...

The bpy module does provide the path, but its not usable from the BGE (think about a standalone).

Fix
Similarly to bpy.app.binary_path_python, have an bge.app.binary_path_python available.

**System Information** Windows 10 **Blender Version** 2.78c **Short description** The Python interpreter path should be made available to the `bge` module. Currently on Windows to get the currently-used Python path we would use `sys.executable`, but this line returns the Blender executable, not Python's... The `bpy` module does provide the path, but its not usable from the BGE (think about a standalone). **Fix** Similarly to `bpy.app.binary_path_python`, have an `bge.app.binary_path_python` available.
Author

Changed status to: 'Open'

Changed status to: 'Open'
Author

Added subscriber: @WKnight02

Added subscriber: @WKnight02

Added subscriber: @JacobMerrill-1

Added subscriber: @JacobMerrill-1

when you are installing modules into blender, you must install them into blender/python

there was talk of pip install working inside blender, but I have had issues with it.

standalone module will have it's own python interpreter, which will need the same libs.

when you are installing modules into blender, you must install them into blender/python there was talk of pip install working inside blender, but I have had issues with it. standalone module will have it's own python interpreter, which will need the same libs.
Author

In #52655#457679, @JacobMerrill-1 wrote:
when you are installing modules into blender, you must install them into blender/python

there was talk of pip install working inside blender, but I have had issues with it.

standalone module will have it's own python interpreter, which will need the same libs.

Pip does works flawlessly with Blender, as there is some ensurepip module bootstrapping pip for the Python installation packed with Blender. More.

But for some test project I had to register the Python executable path from a BGE runtime (read: from a running game), but was unable to retrieve the Python executable path.

Although I do not understand the point of mentioning pip, which does works, the problem is that we can get access to the Python's path from bpy, but not from bge.

> In #52655#457679, @JacobMerrill-1 wrote: > when you are installing modules into blender, you must install them into blender/python > > there was talk of pip install working inside blender, but I have had issues with it. > > > standalone module will have it's own python interpreter, which will need the same libs. Pip does works flawlessly with Blender, as there is some `ensurepip` module bootstrapping pip for the Python installation packed with Blender. [More](https://docs.python.org/3/library/ensurepip.html). But for some test project I had to register the Python executable path from a BGE runtime (read: from a running game), but was unable to retrieve the Python executable path. Although I do not understand the point of mentioning pip, which does works, the problem is that we can get access to the Python's path from `bpy`, **but not from `bge`.**

you mean bge.logic.expandPath(path) ?

https://docs.blender.org/api/blender_python_api_2_70_5/bge.logic.html#bge.logic.expandPath

edit: try and pip install and import pyttsx or tensor flow

you mean bge.logic.expandPath(path) ? https://docs.blender.org/api/blender_python_api_2_70_5/bge.logic.html#bge.logic.expandPath edit: try and pip install and import pyttsx or tensor flow
Author

pip install pyttsx3 for Blender's Python 3.5.x is working correctly... Make sure to have admin rights if you're installing libs in your "C:\Program Files" directory... Won't test for tensorflow, as it is not the problem (it will work for sure, given you type the right commands)

Edit: tested for tensorflow just in case: it worked.

bge.logic.expandPath converts a path. It is not the problem: What should be interesting would be something like bge.app.binary_path_python returning, say: C:\Program Files\Blender Foundation\Blender\2.78\python\bin\python.exe. or any other location depending on the OS.

`pip install pyttsx3` for Blender's Python 3.5.x is working correctly... Make sure to have admin rights if you're installing libs in your `"C:\Program Files"` directory... Won't test for `tensorflow`, as it is not the problem (it will work for sure, given you type the right commands) *Edit: tested for `tensorflow` just in case: it worked.* `bge.logic.expandPath` converts a path. It is not the problem: What should be interesting would be something like `bge.app.binary_path_python` returning, say: `C:\Program Files\Blender Foundation\Blender\2.78\python\bin\python.exe`. or any other location depending on the OS.

Added subscriber: @Sergey

Added subscriber: @Sergey

Changed status from 'Open' to: 'Archived'

Changed status from 'Open' to: 'Archived'
Sergey Sharybin self-assigned this 2017-09-14 15:21:22 +02:00

Thanks for the report, but it's more a feature request than a bug which we don't accept in the bug tracker. Such requests better be addressed to bf-funboard (general functional discussion board) or bf-gamedev (BGE related discussions) mailing lists.

Thanks for the report, but it's more a feature request than a bug which we don't accept in the bug tracker. Such requests better be addressed to bf-funboard (general functional discussion board) or bf-gamedev (BGE related discussions) mailing lists.
Author

Thanks, didn't know where to address !

Thanks, didn't know where to address !
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#52655
No description provided.