Blender as Python Module - OSX scripts/modules search directory #71505

Closed
opened 2019-11-12 01:23:40 +01:00 by Tyler Alden Gubala · 4 comments

System Information

Operating system: Mac OSX Catalina
Graphics card: None

Blender Version

Broken: Blender 2.82 (master)

Short description of error

When compiling Blender as a Python module on Mac OSX, an additional redundant directory is required for the Mac System to find the scripts/modules directory, called Resources. My understanding is that this is strictly for the OSX Packaging scheme for the Blender "bundle". I think that for creation as a Python module however, it should be sufficient to just place it in site-packages.

Reference here

Exact steps for others to reproduce the error

Prerequisites

  1. Install Python from python.org
  2. Install XCode

Build Steps

NOTE: Audaspace errors with various numpy array object errors, OpenMP also cannot be built on OSX

export PATH="/Applications/CMake.app/Contents/bin":"$PATH"
echo PATH="/Applications/CMake.app/Contents/bin":"\$PATH" >> ~/.profile
mkdir .blenderpy
cd .blenderpy
mkdir master
cd master
git clone http://git.blender.org/blender.git
cd blender
make update
cd ..
mkdir build_bpy_darwin_custom
cd build_bpy_darwin_custom
cmake ../blender -DWITH_PLAYER=OFF -DWITH_PYTHON_INSTALL=OFF -DWITH_PYTHON_MODULE=ON -DWITH_OPENMP=OFF -DWITH_AUDASPACE=OFF
make install

Install Steps

python3 -m venv ~/.blenderpy/venv # Or wherever you want your venv

cp bin/bpy.so ~/.blenderpy/venv/lib/python3.7/site-packages

mkdir ~/.blenderpy/venv/python3.7/Resources
- Because of an OSX packaging scheme, Blender's script directory search was changed
- This above line is what the task is about

cp -R bin/2.82 ~/.blenderpy/venv/lib/python3.7/Resources

Additional Reading

NOTE: I am working on documenting various build errors with bpy.so and caveats for using it at the blenderpy repo on GitHub. Through this I supply the bpy package also on PYPI, though if anyone has qualms with that I can take it down too.

Mac Support for bpy.so

# **System Information** Operating system: Mac OSX Catalina Graphics card: None # **Blender Version** Broken: Blender 2.82 (master) # **Short description of error** When compiling Blender as a Python module on Mac OSX, an additional redundant directory is required for the Mac System to find the `scripts/modules` directory, called `Resources`. My understanding is that this is strictly for the OSX Packaging scheme for the Blender "bundle". I think that for creation as a Python module however, it should be sufficient to just place it in `site-packages`. Reference [here](https://github.com/sobotka/blender/blob/a6a0a091978d09ffa85306dcabb671370a5bb322/source/blender/blenkernel/intern/appdir.c#L230) # **Exact steps for others to reproduce the error** ## Prerequisites 1. Install Python from python.org 2. Install XCode ## Build Steps > **NOTE**: `Audaspace` errors with various `numpy` array object errors, `OpenMP` also cannot be built on OSX ``` export PATH="/Applications/CMake.app/Contents/bin":"$PATH" echo PATH="/Applications/CMake.app/Contents/bin":"\$PATH" >> ~/.profile mkdir .blenderpy cd .blenderpy mkdir master cd master git clone http://git.blender.org/blender.git cd blender make update cd .. mkdir build_bpy_darwin_custom cd build_bpy_darwin_custom cmake ../blender -DWITH_PLAYER=OFF -DWITH_PYTHON_INSTALL=OFF -DWITH_PYTHON_MODULE=ON -DWITH_OPENMP=OFF -DWITH_AUDASPACE=OFF make install ``` ## Install Steps ``` python3 -m venv ~/.blenderpy/venv # Or wherever you want your venv cp bin/bpy.so ~/.blenderpy/venv/lib/python3.7/site-packages mkdir ~/.blenderpy/venv/python3.7/Resources - Because of an OSX packaging scheme, Blender's script directory search was changed - This above line is what the task is about cp -R bin/2.82 ~/.blenderpy/venv/lib/python3.7/Resources ``` # Additional Reading > **NOTE**: I am working on documenting various build errors with `bpy.so` and caveats for using it at the [blenderpy](https://github.com/TylerGubala/blenderpy) repo on GitHub. Through this I supply the `bpy` package also on PYPI, though if anyone has qualms with that I can take it down too. [Mac Support for bpy.so](https://github.com/TylerGubala/blenderpy/issues/2)

Added subscriber: @TylerGubala

Added subscriber: @TylerGubala
Member

Added subscriber: @JacquesLucke

Added subscriber: @JacquesLucke
Member

Changed status from 'Needs Triage' to: 'Archived'

Changed status from 'Needs Triage' to: 'Archived'
Jacques Lucke self-assigned this 2020-01-08 17:09:40 +01:00
Member

Unfortunately, I cannot help you with the issue. The bug tracker is not for build errors though. For those, please use https:*blender.chat/home or https:*devtalk.blender.org/.

Unfortunately, I cannot help you with the issue. The bug tracker is not for build errors though. For those, please use https:*blender.chat/home or https:*devtalk.blender.org/.
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
2 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#71505
No description provided.