Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

run.py fails in google CoLab with src/tcmalloc.cc:283] Attempt to free invalid pointer 0x7f9b3462b000 #188

Closed
mshunjan opened this issue Apr 14, 2021 · 2 comments

Comments

@mshunjan
Copy link

mshunjan commented Apr 14, 2021

Hi BlenderProc team. I've been wanting to use blenderproc for some of my dev teams machine learning pipelines, and it runs great locally on an Ubuntu 20.04 instance. However, we wanted to make it easier to use collaboratively for our entire team, so we decided to run blenderproc in google colab. However we are getting the following logs for the cell:

Note that ! indicates we are executing a linux command . This executes in a temporary shell.

!python run.py examples/basic/config.yaml examples/basic/camera_positions examples/basic/scene.obj examples/basic/output

logs:

Parsing config 'examples/basic/config.yaml'
Filling placeholder <args:2> at modules/(main.Initializer)/config/global/output_dir: examples/basic/output
Filling placeholder <args:1> at modules/(loader.ObjectLoader)/config/path: examples/basic/scene.obj
Filling placeholder <args:0> at modules/(camera.CameraLoader)/config/path: examples/basic/camera_positions
Successfully finished parsing 
Using blender in /content/Blender/blender-2.91.0-linux64
Looking in links: /tmp/tmp_x3ks8jt
Requirement already satisfied: setuptools in /content/Blender/blender-2.91.0-linux64/2.91/python/lib/python3.7/site-packages (41.2.0)
Requirement already satisfied: pip in /content/Blender/blender-2.91.0-linux64/2.91/python/lib/python3.7/site-packages (21.0.1)
Requirement already satisfied: pip in /content/Blender/blender-2.91.0-linux64/2.91/python/lib/python3.7/site-packages (21.0.1)
pyyaml:5.1.2 was installed: True
Using temporary directory: /dev/shm/blender_proc_cd968e097933443cbcf210e9725568a2
src/tcmalloc.cc:283] Attempt to free invalid pointer 0x7f9b3462b000 
Cleaning temporary directory

We think it is a problem with line 278 in run.py

p = subprocess.Popen([blender_run_path, "--background", "--python-exit-code", "2", "--python", path_src_run, "--",  args.config, temp_dir, "--batch-process", args.batch_process], env=dict(os.environ, PYTHONPATH=""), cwd=repo_root_directory)
@moizsajid
Copy link
Contributor

@mshunjan Hi, for running Blender inside Colab, you need to reinstall libtcmalloc, install some additional packages (assuming if they are not installed already) and set the LD_PRELOAD env variable as shown below. Please run these commands before the run.py call. Let me know if this resolves your issue?

import os

!apt remove libtcmalloc-minimal4
!apt install libtcmalloc-minimal4

os.environ["LD_PRELOAD"] = "/usr/lib/x86_64-linux-gnu/libtcmalloc_minimal.so.4.3.0"

!apt install libboost-all-dev
!apt install libgl1-mesa-dev

@mshunjan
Copy link
Author

Hi @moizsajid! Thanks this worked for me. Looks like I was missing the libtcmalloc library. I'll close the issue, now. For anyone that stumbles across this in the future, here's what my code looked like to solve this:

%cd /content/
!git clone https://github.com/DLR-RM/BlenderProc.git

# Download some required libraries
import os
 
!apt install libtcmalloc-minimal4

os.environ["LD_PRELOAD"] = "/usr/lib/x86_64-linux-gnu/libtcmalloc_minimal.so.4.3.0"

!apt install libboost-all-dev
!apt install libgl1-mesa-dev 

I also had to manually install these pip dependencies for plotting, however this is unrelated to the issue. This is what I did:

!pip install h5py
!pip install matplotlib

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants