2

When developing Blender add-ons, I often find myself in need of the numpy package due to its optimized algorithms for array manipulation. However, a significant hurdle arises from the requirement to install numpy using pip. This additional installation step can be daunting for the average user and may hinder the accessibility of my add-on.

Given this constraint, I'm hesitant to rely on external libraries like NumPy. Is it advisable to avoid using such libraries altogether in Blender add-on development, or are there alternative approaches to consider?

One potential solution I'm considering is extracting and including only the necessary parts of NumPy (np.array, np.ndarray, etc.) within my add-on. However, I'm unsure about the feasibility and potential challenges associated with this approach.

Can anyone provide insights into best practices for incorporating external libraries like NumPy in Blender add-ons while ensuring ease of use for end-users? Additionally, is there a standard technique or process that can be employed to safely include specific parts of NumPy within an add-on, without relying on the user to install it separately?

Any advice or guidance on this matter would be greatly appreciated

Harry McKenzie
  • 10,995
  • 8
  • 23
  • 51
  • Blender ships with numpy, you do not need to do anything special to use it beyond import numpy. – scurest Mar 07 '24 at 12:49
  • woot i think you already installed it via pip. because i remember i had to install it via pip. – Harry McKenzie Mar 07 '24 at 13:01
  • You don't. Many of the addons that ship with Blender use numpy. – scurest Mar 07 '24 at 13:41
  • There might be discrepancies between the numpy version used by Blender and the latest available numpy version through pip though, you may have had an error stating a function does not exist because it was part of a more recent release of numpy. or similarly an addon using shipping an older numpy version override blender's default one. But numpy does come with vanilla Blender – Gorgious Mar 07 '24 at 14:08
  • very nice ok thank you for the clarification! so on another note, generally if a module is not part of blender, it's best to avoid using them in your addon? – Harry McKenzie Mar 07 '24 at 14:13

0 Answers0