-
Notifications
You must be signed in to change notification settings - Fork 20
Build based on Blender 2.83.1 #13
base: master
Are you sure you want to change the base?
Conversation
Add script to create an AWS Lambda layer
Thanks for working through these issues to move to Blender 2.8! I got everything working from your build and tested several scripts. I had success on almost all, but I was not able to get rendering working. The error is "Unable to open display". Some quick googling shows that this is a common error with headless rendering- most specifically with EEVEE, but I tried CYCLES as well. Were you able to get rendering working? Thanks... |
Update: |
Actually, I'm having trouble running this at all on AWS Lambda. It complains about requiring numpy. When I add numpy, together with bpy_lambda, they total over 250MB and get rejected by AWS. I'm looking into Zappa at the moment. |
I did get it working on AWS Lambda. My bpy_lambda_layer.zip is 75MB and that's the only layer I require for a few of the scripts I run, some other scripts require other layers and push it over 250MB but I can isolate these. Perhaps your specific scripts are requiring numpy? I'm happy to send over my bpy_lambda_layer.zip if you'd like to see how it zipped up or use it in your lambda. Again, thanks for all of the debugging to get it working in 2.8x. |
Yes, same size of bpy_lambda_layer.zip for me. It's numpy that adds another big increase and for Lambda what matters is the unpacked size. The part of my script requiring numpy is @bonflintstone I found that it works fine if we drop gltf and use |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your work on this!
@@ -1 +1 @@ | |||
docker run --rm -u root -v "$PWD":/var/task:ro,delegated lambci/lambda:python3.6 test.handler | |||
docker run --rm -u root -v "$PWD":/var/task:ro,delegated lambci/lambda:python3.7 test.handler |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using 3.7 hangs indefinitely for me, but 3.6 runs correctly. Are you able to get a successful test run using 3.7?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
3.7 hangs for me too. I wasn't sure about reverting to 3.6 or figuring out why bpy.ops.object.modifier_add(type='REMESH')
causes this issue with Python 3.7
On a real AWS Lambda, it actually causes a segmentation fault:
START RequestId: ... Version: $LATEST
Info: Deleted 3 object(s)
Info: Deleted 3 object(s)
END RequestId: 458a32a9-7db8-4ae4-93a8-74d88ba75159
REPORT RequestId: 458a32a9-7db8-4ae4-93a8-74d88ba75159 Duration: 228.16 ms Billed Duration: 300 ms Memory Size: 1024 MB Max Memory Used: 235 MB Init Duration: 1426.11 ms
RequestId: ... Error: Runtime exited with error: signal: segmentation fault (core dumped)
Runtime.ExitError
I also tested on an Amazon Linux based Light Sail instance and got the segmentation fault with both Python 3.6 and 3.7
What do you think could be the issue behind this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a lot of help to add, but I was able to run 3.7 with a different test.py script that I configured to test specific to my project. Does not have "remesh" so perhaps that's the culprit as salimhb identifies.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm... Yeah, the only thing I can think of is that the WITH_MOD_REMESH
is not currently being set in the make options. However, when I enabled that flag I still wasn't able to get the test to pass on 3.7.
I'd be fine with changing the test -- but it is unfortunate to have this regression.
@markhohmann: Do you have ideas for a test handler that'd exercise basic blender functionality without calling the remesh operation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@markhohmann can you try this patch and check if it resolves the error "Unable to open display". I added some X11 and GL libs: https://gist.github.com/salimhb/92be32bd629b15b03e94bdc0f8e8b8f5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bcongdon For me I think the basic functionality anyone would need would be: 1) create an object 2) add a material and 3) render to output. Meaning, would people typically use blender on the server side without doing those things? I'm sure there are a ton of use cases that fall outside, but if we test for these major ones, hopefully we can create a foundational test others could extend. Let me know if you have thoughts on essential use cases beyond the three above. I'll submit a test handler.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@markhohmann I think these steps sound good. Did you try my last patch to fix the error "Unable to open display"?
I've added some X11libs that might fix it.
If yes, then I can update this PR with this commit railslove@df514ef
Co-authored-by: Ben Congdon <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whoops, sorry -- I wrote up these comments a few days ago but didn't send them out
-DWITH_IMAGE_TIFF=OFF \ | ||
-DWITH_INPUT_NDOF=OFF \ | ||
-DWITH_LIBMV=OFF \ | ||
-DWITH_MOD_REMESH=ON \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps since this is no longer being set in the make options, that's what is causing the remesh operation to fail?
I tried enabling this manually, but the test still hangs on 3.7 for me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think so. WITH_MOD_REMESH
is ON by default. After running install_deps.sh
you can checked in ~/blender-git/build_linux_bpy/CMakeCache.txt
and it is ON. The value of BUILD_CMAKE_ARGS
below is from the output of install_deps.sh
@@ -1 +1 @@ | |||
docker run --rm -u root -v "$PWD":/var/task:ro,delegated lambci/lambda:python3.6 test.handler | |||
docker run --rm -u root -v "$PWD":/var/task:ro,delegated lambci/lambda:python3.7 test.handler |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm... Yeah, the only thing I can think of is that the WITH_MOD_REMESH
is not currently being set in the make options. However, when I enabled that flag I still wasn't able to get the test to pass on 3.7.
I'd be fine with changing the test -- but it is unfortunate to have this regression.
@markhohmann: Do you have ideas for a test handler that'd exercise basic blender functionality without calling the remesh operation?
@bcongdon @markhohmann I needed Collada support and made a new build to support that. You can check the changes here railslove/bpy_lambda@blender-2.83.1...railslove:blender-2.83.1-collada
|
I'd be in favor of putting an explanation like that in the README. Probably not in favor of checking it in, as -- like you said -- that puts you quite close to the layer size limit |
Agreed, I think it's worth including, thanks for sharing. |
Thanks @salimhb! 👍 Tried your changes and they worked for me. Had to comment out the |
Hi! |
@manuelbostanci The 50MB limit is for direct upload of lambda deployment packages. For layers, AWS suggests the limit for direct upload of lambda layers is 10MB (maybe the hard limit is actually 50MB as appears you've discovered.) To upload larger files, look at uploading them to S3 and then point to that S3 location. If you are using the AWS console, you should see "Upload a file from Amazon S3" as a choice. If you are using the cli, you specify with the --content flag. |
@markhohmann Thanks! The upload via --content was the missing part! ;) |
HI @bcongdon @markhohmann, is this PR planned to be merged? If there's still pending stuff with it, is there any way I can help? I'm looking to test this out to benchmark timing and cost for a pretty big render, and I am pretty sure I'd need 2.8 support. Thanks. |
Hello @asyrique you can checkout this branch and build it yourself to run benchmarks. We are actually discussing improving the test.py. So if you have suggestions to use from your benchmarks, that would be great input. |
Thanks for the work on this! I'm getting the following error though when running
|
@tiivik try increasing the memory available for Docker. |
Indeed that helped! 🤦 Thanks! |
Hey sorry to bug with this a little more but how were you able to include numpy packaged with blender? I understand it will make the unzipped package exceed the AWS limit but I'm okay with that. removing
|
Okay, I was downloading and unpacking the numpy layer but not importing it. GLTF exporting which requires numpy does work, thanks for the instructions so far! |
Use the sample code mentioned in my previous comment to download and import bpy in runtime. Then just add the scipy/numpy layer offered by AWS. It's the only reliable way to get numpy support on Lambda. |
Thanks. I actually got a better performance when using bpy as a lambda layer and download numpy during runtime. With provisioned concurrency enabled from cold start to end of the test script execution 2 seconds. |
That's great! Where do you download numpy from or did you compile it yourself? I couldn't find any numpy package compatible with Lambda. That's why I resorted to using the one offered by AWS as a layer. |
I actually created a tool for this awhile back, see here https://github.com/tiivik/LambdaZipper/ |
Some struggles continue. Were you succesfully able to export to .gltf?
However the following results in export error and corrupt GLTF file.
I've tried it with a blender 2.83.1 and 2.83.6 lambda layers as well as numpy layers 1.17.0 and 1.17.4. Is there a lib I'm missing?
|
It's a known issue for blender compiled as bpy. |
Thx @salimhb for this awesome PR! Why is this not yet merged 🤷 ? Changing this line helped:
|
Add script to create an AWS Lambda layer