site not automatically imported when using external python package #31507
Labels
No Label
Interest
Animation & Rigging
Interest
Blender Cloud
Interest
Collada
Interest
Core
Interest
Documentation
Interest
Eevee & Viewport
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
Import and Export
Interest
Modeling
Interest
Modifiers
Interest
Nodes & Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds, Tests & Devices
Interest
Python API
Interest
Rendering & Cycles
Interest
Sculpt, Paint & Texture
Interest
Translations
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Meta
Good First Issue
Meta
Papercut
Module
Add-ons (BF-Blender)
Module
Add-ons (Community)
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
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender-addons#31507
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
%%%Since blender is using Python 3.2, it does not import site automatically anymore. While this is probably acceptable when using the bundled python package (because the bundled package is not registered at system level and thus its site-packages directory is not visible to external installers), this is not justified if the bundle python package is not present: blender looks in this case for a system Python package, which, if it exists, is properly setup to import site. Not importing site means that external packages that might have been installed by the user will not be visible from python scripts.
The reason why site is not imported is explained in the code:
source/blender/python/intern/bpy_interface.c:
/* Python 3.2 now looks for '2.xx/python/include/python3.2d/pyconfig.h' to
* parse from the 'sysconfig' module which is used by 'site',
* so for now disable site. alternatively we could copy the file. */
Py_NoSiteFlag = 1;
The attached patch (author: Sjoerd de Vries) fixes this problem: Py_NoSiteFlag is not set when the bundle python package is not found to give a change%%%
Changed status to: 'Open'
%%%committed r46766. with some minor changes.%%%
Changed status from 'Open' to: 'Resolved'