Blender 3.1.2 - ValueError

Hi there,

I successfully installed compas for blender (python=3.10). However, when I try to use python inside Blender, it always throws me the following error;
ValueError: compile(): unrecognised flags
Any hints on how to solve this?

Thanks!

hi,

could you provide a bit more information about

  • your system?
  • the specific version of blender?
  • how you installed compas for blender?

thanks

hi,

  • macOS Monterey 12.4
  • Blender 3.1.2
  • python 3.10.4

I created a seperate conda env for blender, installed compas, and then I followed the instructions on compas website;

conda activate blender
python -m compas_blender.install -v 3.1

The terminal prompted that compas for blender has been successfully installed.

Thanks!

hi,

thanks for pointing this out. i unfortunately get the same error.

i have a M1 Max (and am assuming you also have the new chip type. let me know if that is not the case…) so i thought it was related to the difference between the default conda-forge “x86_64” python build versus the now default “osx_arm64” of Blender 3.1, but the error also appears when i make sure that the installed python in the conda environment is from the conda-forge/osx-arm64 subdir. even without installing compas, just replacing the Blender python with the Anaconda python, i get the same result as you. so there seems to be a more fundamental issue that we will have to figure out :slight_smile:

if you don’t need any other packages from conda and just want to use compas in Blender, you could work around this relatively easily.

  1. uninstall compas again. this will restore the original Blender python.
  2. navigate to the folder containing the Blender python with the Terminal
  3. make sure you have pip installed
  4. upgrade pip
  5. install compas
python -m compas_blender.uninstall -v 3.1
cd /Applications/Blender.app/Contents/Resources/3.1/python/bin
./python3.10 -m ensurepip
./python3.10 -m pip install --upgrade pip
./python3.10 -m pip install compas

after that everything works fine in Blender for me. the only limitation is that you can only install packages that are available on PyPi this way. if you need things like compas_cgal or compas_occ, you will have to use them via RPC…

would be nice if you could add the problem to the issue tracker so we don’t forget to fix it.

hope this helps,
tom

1 Like

Hi Tom,

Thanks! The workaround works, and I am still on an Intel mac, so we should note that down that this solution works in both Apple Silicon and Intel Macs.
Also, as per your suggestion, I opened a Gh issue here.

Best as always,
Dimitrios