6
$\begingroup$

I have been in the hope of finding a way to use awesome Anaconda Python in Blender in Windows 7 x64, as I was inspired by several articles including the one described here on why using Anaconda is advantageous. I have tried many suggested potential solutions, as summarized below, but unfortunately no success:

  1. Calling 3rd Party Python Modules in Blender Scripts
  2. SpaceBlender
  3. Using 3rd party Python modules
  4. ImportError: DLL load failed: %1 is not a valid Win32 application. But the DLL's are there

I truly would love to be able to utilize Anaconda. I particularly want to be able to import many packages including h5py for reading HDF files, which are larger than 2GB. Because of the C library dependencies of h5py, it is impossible to build them in Windows from source. Could the community help me find a practical way of using Anaconda3-4.0.0-Windows-x86_64 in blender-2.77a-windows64? I don't mind completely replacing Blender python with Anaconda (although I copied them in blender folder and did not work).

$\endgroup$
1
  • 1
    $\begingroup$ Anaconda is a python installation - try removing blenders python so it uses the system installed python if anaconda doesn't install where expected then you may need to create shortcuts or rename etc. Also h5py isn't impossible to build, it just can't be installed from source on windows, but you can install compilers etc and build it manually. $\endgroup$
    – sambler
    Commented Apr 20, 2016 at 12:03

2 Answers 2

4
$\begingroup$

I succeeded using the following solution:

  1. Install anaconda2 x64(I use python 2.7 usually, so I installed it.).
  2. Install Blender 2.77a x64.
  3. Create py35 environment for blender by command conda create --name py35 python=3.5 anaconda.
  4. Rename C:\Program Files\Blender Foundation\Blender\2.77\python to _python.
  5. (a) Copy & Paste the folder from C:\Anaconda2\envs\py35 to C:\Program Files\Blender Foundation\Blender\2.77\python.
  6. (b) Or, alternatively, create a link to the anaconda installation. This way any updates will automatically be available: You need to run cmd as administrator (use right click on the item)

    D:\Blender Foundation\Blender\2.77>mv python python_old
    D:\Blender Foundation\Blender\2.77>mklink /j python d:\Anaconda2\envs\py3
    Junction created for python <<===>> d:\Anaconda2\envs\py3
    
  7. Try import bpy, import pandas, import numpy, import scipy, import sklearn, ...etc. on Blender python console.

Console, Text Editor both worked fine for me.

$\endgroup$
4
  • $\begingroup$ Can you comment on how Blender can manage using python 2.7 as it needs python 3? Does creating conda create py35 python=3.5 anaconda actually creates python 3 or it is a virtual python 3? $\endgroup$ Commented May 2, 2016 at 17:36
  • 1
    $\begingroup$ @Ahmad Blender don't care about python 2.7(Actual) or 3.5(Virtual) of my anaconda. It only cares about .../Blender/2.77/python... which is copied version of my virtual python 3.5 of anaconda in my case. $\endgroup$
    – su79eu7k
    Commented May 3, 2016 at 0:50
  • 1
    $\begingroup$ conda create py35 python=3.5 anaconda will create a python 3 environment. you can use this to have multiple environments $\endgroup$
    – ntg
    Commented Nov 4, 2016 at 15:14
  • $\begingroup$ you can switch between environments, E.g. open a command prompt (run cmd) and then type "activate py35" then typing python will run python 3 ... $\endgroup$
    – ntg
    Commented Nov 20, 2017 at 10:02
2
$\begingroup$

Tried a modified method from the one provided by @ntg:

Created a virtual environment inside the blender folder to replace python folder it has. The following example is for macOS and blender 2.82.

conda create --prefix /Applications/Blender.app/Contents/Resources/2.82/python python=3.7

To install python packages I used this to activate the environment and install the packages.

conda activate /Applications/Blender.app/Contents/Resources/2.82/python
conda install pandas 
conda install geopandas
$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .