I tried to make Blender 2.83 (and 2.90) use my system python. It fails with an ugly error.
ModuleNotFoundError: No module named 'math'
My question: is this an error in my local installation, am I doing something wrong or does it just not work?
I use Ubuntu 20.04 and both Blender versions are downloaded from buildbot. Blender has Python 3.7.4 built in, system version is 3.7.5rc1. What I did is actually a recommended practice from Blender User Manual, and I remember it used to work.
First I removed the Blender built-in python and then I pointed to a proper PYTHONPATH.
~/bin/blender-2.83 PYTHONPATH=/usr/lib/python3.7 ./blender --python-use-system-env Traceback (most recent call last): File "/home/emu/bin/blender-2.83/2.83/scripts/modules/bpy/utils/__init__.py", line 109, in _test_import mod = __import__(module_name) File "/home/emu/bin/blender-2.83/2.83/scripts/startup/bl_operators/__init__.py", line 59, in <module> __import__(name=__name__, fromlist=_modules) File "/home/emu/bin/blender-2.83/2.83/scripts/startup/bl_operators/vertexpaint_dirt.py", line 144, in <module> from math import pi ModuleNotFoundError: No module named 'math'
The error log is much longer, you can imagine. Digging into these scripts shows that
math really cannot be imported and I believe it may be the error (and not just a symptom).
In the broader picture, I’m trying to debug my 2d geometric computations using
matplotlib. Although many of the necessary modules can be installed using
ensurepip, I can’t get any graphical output to work. I can’t install
tkinter, perhaps for similar reasons that
math is missing.
It is still possible to use system python? Is there a known workaround?