Skip to main content
Join the official Python Developers Survey 2018 and win valuable prizes: Start the survey!

Blender as a python module

Project description

blenderpy

Blender as a python module with easy-install

Meant for installation into a virtualenv or wherever, for unit testing of Blender extensions being authored, or developement of a Blender 3d-enabled Python application.

Option 1 - Get prebuilt bdist_wheel from pypi

Prerequisites

  1. A supported python installation with pip installed

Installation

py -m pip install bpy

Option 2 - Build from sources using pypi

Prerequisites

  1. Windows users must have Visual Studio 2013 or later and C++ build tools installed to build from sources
  2. Windows users must have an SVN provider to build from sources (see )
  3. All users must py -m pip install cmake in their python environment to build from sources (currently adding it as a setup_requires does not install it properly); after build it may be uninstalled with py -m pip uninstall cmake
  4. Users of Python versions below 3.6 must have future-fstrings installed pip install -U future-fstrings
  5. Users of Python versions 3.4 and below will probably need to update setuptools pip install -U setuptools
  6. Up-to-date wheel

Installation

py -m pip install bpy --no-binary

How it works

  1. Create overriding classes CMakeExtension & BuildCMake, which inheirit from the setuptools classes; bpy is a python extension (.pyd) and an instance of CMakeExtension, BuildCMake is the command that is run when installing the extension from pip (or running setup.py)
  2. Using GitPython, clone Blender sources from https://git.blender.org/
  3. If on Windows, detect the installed version of Visual Studio and 64bit vs 32bit, and download the appropriate svn library based on that
  4. Using cmake, configure blender as a python module per the Ideasman42 wiki page (now defunct) https://wiki.blender.org/wiki//User:Ideasman42/BlenderAsPyModule; configure this build solution in the build_temp directory of the bpy package
  5. Using cmake, build the configured solution
  6. Place the built binaries in the built extension parent directory (important!)
  7. Relocate the /<Version> directory (i.e: /2.79) into the directory containing the executable from which this installation was spawned (where 'python.exe' is)
  8. Clean up using the remaining functionality from the superclasses build_ext and Extension
  9. bpy.pyd/ .so should now be installed into the site-packages

Gotchas

I have not tested this for platforms other than Windows at the moment. More to come soon.

Support this project

<script async src="https://c6.patreon.com/becomePatronButton.bundle.js"></script>

<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top"> <input type="hidden" name="cmd" value="_s-xclick"> <input type="hidden" name="encrypted" value="-----BEGIN PKCS7-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aBQCgXTAYBgkqhkiG9w0BCQMxCwYJKoZIhvcNAQcBMBwGCSqGSIb3DQEJBTEPFw0xODA4MDYyMjAxMjJaMCMGCSqGSIb3DQEJBDEWBBTpi8pDS59IpL1DXtj3V1goWjNNAzANBgkqhkiG9w0BAQEFAASBgITn4OUdSr1bgXGuyj/HaKvP9HHrJtiILcoGelesk4wuUooUVjG88colft5vfcY336L9SSz44FLkExBwbXHKxSaNuPIaneLwXWk8aUgbu6RmEp7TS0GNwkZ0ygCdoWIWSg/8VskhnSE7taX9y3r/0SIOtQ9m/Xhk9aYfPVJvNPcc-----END PKCS7----- "> <input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donate_SM.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!"> </form>

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
bpy-1.2.3-cp34-cp34m-win32.whl (64.6 MB) Copy SHA256 hash SHA256 Wheel cp34 Aug 7, 2018
bpy-1.2.3-cp34-cp34m-win_amd64.whl (69.4 MB) Copy SHA256 hash SHA256 Wheel cp34 Aug 7, 2018
bpy-1.2.3-cp35-cp35m-win32.whl (64.6 MB) Copy SHA256 hash SHA256 Wheel cp35 Aug 7, 2018
bpy-1.2.3-cp35-cp35m-win_amd64.whl (69.4 MB) Copy SHA256 hash SHA256 Wheel cp35 Aug 7, 2018
bpy-1.2.3-cp36-cp36m-win32.whl (64.6 MB) Copy SHA256 hash SHA256 Wheel cp36 Aug 7, 2018
bpy-1.2.3-cp36-cp36m-win_amd64.whl (69.4 MB) Copy SHA256 hash SHA256 Wheel cp36 Aug 7, 2018
bpy-1.2.3-cp37-cp37m-win32.whl (64.6 MB) Copy SHA256 hash SHA256 Wheel cp37 Aug 7, 2018
bpy-1.2.3-cp37-cp37m-win_amd64.whl (69.4 MB) Copy SHA256 hash SHA256 Wheel cp37 Aug 7, 2018
bpy-1.2.3.tar.gz (20.6 kB) Copy SHA256 hash SHA256 Source None Aug 7, 2018

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page