1
$\begingroup$

I want to use the pymesh library inside Blender because I think it could be fun to play with the functions of pymesh and model in blender in the same time. But I am having some problem...

I managed to run the simple script : import pymesh

To do this, I copied and paste my pymesh directory into the blender/scripts/module one.

But then, pymesh doesn't recognize any functions :

import pymesh pymesh.test()

Error is : AttributeError: module 'pymesh' has no attribute 'test'

Any idea ?

$\endgroup$
4
  • $\begingroup$ So now I have installed pymesh in my /usr/share/blender/scripts/modules/PyMesh directory. I added the /usr/share/blender/scripts/ directory to my user preferences in the scripts case. The problem remains the same, I can import pymesh but I can't use any of the functions. $\endgroup$ – street-poney Aug 1 '19 at 9:53
  • $\begingroup$ Is it possible that pymesh cannot be installed in python 3.7 ? $\endgroup$ – street-poney Aug 1 '19 at 11:34
  • $\begingroup$ I have managed to install pymesh with python 3.7 using a wheel file accessible here github.com/PyMesh/PyMesh/issues/133 $\endgroup$ – street-poney Aug 1 '19 at 12:18
  • $\begingroup$ If i change blender-2.80rc2-linux-glibc217-x86_64/2.80/python to ..../_python, the executable doesn't work anymore so I can't run blender... $\endgroup$ – street-poney Aug 1 '19 at 12:40
0
$\begingroup$

You probably don't want to use the system python with blender. The version of python that comes packaged with Blender has the python bindings for that version of blender (bpy) already installed. If you suddenly use the system python, blender is probably going to break if you want to install a different version, and definitely won't work if you want to use it with two different versions of blender (e.g. the stable release and the current beta release).

Instead, just take advantage of the fact that blender comes with its own Python distribution: it has its own version of pip. It's also a good thing, because it isolates the python installation between different versions of blender. Here's what I usually do to install modules into Blender's python. From Blender's scripting tab:

import sys, subprocess
subprocess.call([sys.executable, '-m', 'pip', 'install', 'pymesh'])

What this does is call the pip associated with the current installation of Blender, and tells it to install pymesh.

You might need to run blender with elevated privileges (e.g. run as administrator in windows) for this to work. You also might want to delete the install of pymesh that you've already placed in your blender python folder.

$\endgroup$
3
  • $\begingroup$ Blender doesn't come with PIP installed by default. You'll need to install that first before running the code. $\endgroup$ – RandomPanda Jun 8 at 2:59
  • 1
    $\begingroup$ As of version 2.81, Blender comes with pip already installed. See the developer discussion at developer.blender.org/T71856 $\endgroup$ – AmphotericLewisAcid Jun 8 at 21:36
  • $\begingroup$ I was not aware of this. Thanks for explaining. $\endgroup$ – RandomPanda Jun 10 at 2:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.