princeton-vl / infinigen

Infinite Photorealistic Worlds using Procedural Generation
https://infinigen.org
BSD 3-Clause "New" or "Revised" License
5.16k stars 432 forks source link

TypeError: 'numpy._DTypeMeta' object is not subscriptable #130

Closed gav-sturm closed 10 months ago

gav-sturm commented 10 months ago

Describe the bug Terrain cv2 not subscriptable error when running first HelloWorld command. Using docker container on WSL Ubuntu

Steps to Reproduce

(If this is your first time running Infinigen) What are the full output logs of install.sh ?

skipping cuda
compiled lib/cpu/utils/FastNoiseLite.so
compiled lib/cpu/elements/voronoi_rocks.so
compiled lib/cpu/elements/upsidedown_mountains.so
compiled lib/cpu/elements/ground.so
compiled lib/cpu/elements/warped_rocks.so
compiled lib/cpu/elements/mountains.so
compiled lib/cpu/elements/landtiles.so
compiled lib/cpu/elements/atmosphere.so
compiled lib/cpu/elements/waterbody.so
compiled lib/cpu/surfaces/chunkyrock.so
compiled lib/cpu/surfaces/cobble_stone.so
compiled lib/cpu/surfaces/cracked_ground.so
compiled lib/cpu/surfaces/dirt.so
compiled lib/cpu/surfaces/ice.so
compiled lib/cpu/surfaces/mountain.so
compiled lib/cpu/surfaces/mud.so
compiled lib/cpu/surfaces/sand.so
compiled lib/cpu/surfaces/sandstone.so
compiled lib/cpu/surfaces/snow.so
compiled lib/cpu/surfaces/soil.so
compiled lib/cpu/surfaces/stone.so
compiled lib/cpu/meshing/cube_spherical_mesher.so
compiled lib/cpu/meshing/frontview_spherical_mesher.so
compiled lib/cpu/meshing/uniform_mesher.so
compiled lib/cpu/meshing/utils.so
In file included from source/cpu/soil_machine/SoilMachine.cpp:18:
source/cpu/soil_machine/layermap.h:37:10: fatal error: glm/glm.hpp: No such file or directory
   37 | #include <glm/glm.hpp>
      |          ^~~~~~~~~~~~~
compilation terminated.
running build_ext
running build_src
build_src
...

Platform

Additional context Add any other context about the problem here.

araistrick commented 10 months ago

Hi folks, I was able to reproduce it and found that it seems to be that opencv's latest release 4.8.0.76 is incompatible with our version of numpy, so I have patched the requirements.txt to specify opencv-python<=4.8.0.74 which fixed the issue on the machine I was able to replicate this.

Sorry for the issue, I will look into more tightly constraining the versions so this doesn't happen in future. Let me know if the issue persists.

gav-sturm commented 10 months ago

That seemed to remove the error... I am now left with the followup error which I am not is related to the previous issue. Again, running on WSL-Ubuntu.

(base) gavsturm@DESKTOP-0M27Q9T:~/infinigen/worldgen$ $Blender -noaudio --background --python generate.py -- --seed 0 --task render -g desert.gin simple.gin --input_folder outputs/helloworld/fine --output_folder outputs Blender 3.3.1 (hash b292cfe5a936 built 2022-10-05 00:14:35) Read prefs: /home/gavsturm/.config/blender/3.3/config/userpref.blend /run/user/1000/gvfs/ non-existent directory [14:47:00.578] [root] [INFO] | Converted args.seed='0' to scene_seed=0, parsed as hexadecimal [14:47:00.593] [root] [INFO] | infinigen version 1.0.3 [14:47:00.593] [root] [INFO] | CUDA_VISIBLE_DEVICES=None [14:47:00.593] [times] [INFO] | [MAIN TOTAL] [14:47:00.593] [times] [INFO] | [Reading input blendfile] Error: Cannot read file '/home/gavsturm/infinigen/worldgen/outputs/helloworld/fine/scene.blend': No such file or directory Error: Cannot read file '/home/gavsturm/infinigen/worldgen/outputs/helloworld/fine/scene.blend': No such file or directory [14:47:00.593] [times] [INFO] | [Reading input blendfile] failed with <class 'RuntimeError'> [14:47:00.593] [times] [INFO] | [MAIN TOTAL] failed with <class 'RuntimeError'> Error: Python: Traceback (most recent call last): File "/home/gavsturm/infinigen/worldgen/generate.py", line 441, in main() File "/home/gavsturm/infinigen/worldgen/generate.py", line 431, in main infinigen.main( File "/home/gavsturm/infinigen/worldgen/core.py", line 461, in main execute_tasks( File "/home/gavsturm/infinigen/blender/3.3/python/lib/python3.10/site-packages/gin/config.py", line 1605, in gin_wrapper utils.augment_exception_message_and_reraise(e, err_str) File "/home/gavsturm/infinigen/blender/3.3/python/lib/python3.10/site-packages/gin/utils.py", line 41, in augment_exception_message_and_reraise raise proxy.with_traceback(exception.traceback) from None File "/home/gavsturm/infinigen/blender/3.3/python/lib/python3.10/site-packages/gin/config.py", line 1582, in gin_wrapper return fn(*new_args, **new_kwargs) File "/home/gavsturm/infinigen/worldgen/core.py", line 286, in execute_tasks bpy.ops.wm.open_mainfile(filepath=str(input_folder / 'scene.blend')) File "/home/gavsturm/infinigen/blender/3.3/scripts/modules/bpy/ops.py", line 113, in call ret = _op_call(self.idname_py(), None, kw) RuntimeError: Error: Cannot read file '/home/gavsturm/infinigen/worldgen/outputs/helloworld/fine/scene.blend': No such file or directory

In call to configurable 'execute_tasks' (<function execute_tasks at 0x7f428d066710>)

Blender quit

araistrick commented 10 months ago

Are you able to check if that path it mentions exists? it may not have been successfully outputted by the previous command so check that one succeeded fully and printed that it saved the blend file

gav-sturm commented 10 months ago

ah, missed that... running into some file path permission error.

(base) gavsturm@DESKTOP-0M27Q9T:~/infinigen/worldgen$ $Blender -noaudio --background --python generate.py -- --seed 0 --task coarse -g desert.gin simple.gin --output_folder outputs2/helloworld/coarse Blender 3.3.1 (hash b292cfe5a936 built 2022-10-05 00:14:35) Read prefs: /home/gavsturm/.config/blender/3.3/config/userpref.blend /run/user/1000/gvfs/ non-existent directory [15:03:50.613] [root] [INFO] | Converted args.seed='0' to scene_seed=0, parsed as hexadecimal [15:03:50.627] [root] [INFO] | infinigen version 1.0.3 [15:03:50.627] [root] [INFO] | CUDA_VISIBLE_DEVICES=None [15:03:50.627] [times] [INFO] | [MAIN TOTAL] [15:03:50.627] [root] [INFO] | Processing frames 1 through 1 inclusive [15:03:50.664] [root] [WARNING] | Could not load addon "flip_fluids_addon" [15:03:50.665] [times] [INFO] | [terrain] [15:03:50.665] [times] [INFO] | [Create terrain] [15:03:50.665] [root] [INFO] | Terrain using only on the fly on_the_fly_asset_folder=PosixPath('/home/gavsturm/infinigen/worldgen/outputs2/helloworld/coarse/assets') [15:05:12.378] [times] [INFO] | [Create terrain] failed with <class 'OSError'> [15:05:12.379] [times] [INFO] | [terrain] failed with <class 'OSError'> [15:05:12.379] [times] [INFO] | [MAIN TOTAL] failed with <class 'OSError'> Error: Python: Traceback (most recent call last): File "/home/gavsturm/infinigen/worldgen/generate.py", line 441, in main() File "/home/gavsturm/infinigen/worldgen/generate.py", line 431, in main infinigen.main( File "/home/gavsturm/infinigen/worldgen/core.py", line 461, in main execute_tasks( File "/home/gavsturm/infinigen/blender/3.3/python/lib/python3.10/site-packages/gin/config.py", line 1605, in gin_wrapper utils.augment_exception_message_and_reraise(e, err_str) File "/home/gavsturm/infinigen/blender/3.3/python/lib/python3.10/site-packages/gin/utils.py", line 41, in augment_exception_message_and_reraise raise proxy.with_traceback(exception.traceback) from None File "/home/gavsturm/infinigen/blender/3.3/python/lib/python3.10/site-packages/gin/config.py", line 1582, in gin_wrapper return fn(*new_args, new_kwargs) File "/home/gavsturm/infinigen/worldgen/core.py", line 323, in execute_tasks compose_scene_func(output_folder, scene_seed) File "/home/gavsturm/infinigen/blender/3.3/python/lib/python3.10/site-packages/gin/config.py", line 1605, in gin_wrapper utils.augment_exception_message_and_reraise(e, err_str) File "/home/gavsturm/infinigen/blender/3.3/python/lib/python3.10/site-packages/gin/utils.py", line 41, in augment_exception_message_and_reraise raise proxy.with_traceback(exception.traceback) from None File "/home/gavsturm/infinigen/blender/3.3/python/lib/python3.10/site-packages/gin/config.py", line 1582, in gin_wrapper return fn(*new_args, *new_kwargs) File "/home/gavsturm/infinigen/worldgen/generate.py", line 86, in compose_scene terrain, terrain_mesh = p.run_stage('terrain', add_coarse_terrain, use_chance=False, default=(None, None)) File "/home/gavsturm/infinigen/worldgen/util/pipeline.py", line 75, in run_stage ret = fn(args, kwargs) File "/home/gavsturm/infinigen/worldgen/generate.py", line 82, in add_coarse_terrain terrain = Terrain(scene_seed, surface.registry, task='coarse', on_the_fly_asset_folder=output_folder/"assets") File "/home/gavsturm/infinigen/blender/3.3/python/lib/python3.10/site-packages/gin/config.py", line 1605, in gin_wrapper utils.augment_exception_message_and_reraise(e, err_str) File "/home/gavsturm/infinigen/blender/3.3/python/lib/python3.10/site-packages/gin/utils.py", line 41, in augment_exception_message_and_reraise raise proxy.with_traceback(exception.traceback) from None File "/home/gavsturm/infinigen/blender/3.3/python/lib/python3.10/site-packages/gin/config.py", line 1582, in gin_wrapper return fn(*new_args, new_kwargs) File "/home/gavsturm/infinigen/worldgen/terrain/core.py", line 87, in init self.elements, scene_infos = scene(seed, Path(on_the_fly_asset_folder), asset_path, device) File "/home/gavsturm/infinigen/blender/3.3/python/lib/python3.10/site-packages/gin/config.py", line 1605, in gin_wrapper utils.augment_exception_message_and_reraise(e, err_str) File "/home/gavsturm/infinigen/blender/3.3/python/lib/python3.10/site-packages/gin/utils.py", line 41, in augment_exception_message_and_reraise raise proxy.with_traceback(exception.traceback) from None File "/home/gavsturm/infinigen/blender/3.3/python/lib/python3.10/site-packages/gin/config.py", line 1582, in gin_wrapper return fn(*new_args, *new_kwargs) File "/home/gavsturm/infinigen/worldgen/terrain/scene.py", line 56, in scene elements[ElementNames.LandTiles] = LandTiles(device, caves, on_the_fly_asset_folder, reused_asset_folder) File "/home/gavsturm/infinigen/blender/3.3/python/lib/python3.10/site-packages/gin/config.py", line 1605, in gin_wrapper utils.augment_exception_message_and_reraise(e, err_str) File "/home/gavsturm/infinigen/blender/3.3/python/lib/python3.10/site-packages/gin/utils.py", line 41, in augment_exception_message_and_reraise raise proxy.with_traceback(exception.traceback) from None File "/home/gavsturm/infinigen/blender/3.3/python/lib/python3.10/site-packages/gin/config.py", line 1582, in gin_wrapper return fn(new_args, new_kwargs) File "/home/gavsturm/infinigen/worldgen/terrain/elements/landtiles.py", line 95, in init n_instances, tile_size, N, float_data = self.load_assets() File "/home/gavsturm/infinigen/blender/3.3/python/lib/python3.10/site-packages/gin/config.py", line 1605, in gin_wrapper utils.augment_exception_message_and_reraise(e, err_str) File "/home/gavsturm/infinigen/blender/3.3/python/lib/python3.10/site-packages/gin/utils.py", line 41, in augment_exception_message_and_reraise raise proxy.with_traceback(exception.traceback) from None File "/home/gavsturm/infinigen/blender/3.3/python/lib/python3.10/site-packages/gin/config.py", line 1582, in gin_wrapper return fn(*new_args, *new_kwargs) File "/home/gavsturm/infinigen/worldgen/terrain/elements/landtiles.py", line 127, in load_assets landtile_asset(self.on_the_fly_asset_folder / tile / f"{i}", tile, device=self.device) File "/home/gavsturm/infinigen/worldgen/terrain/assets/landtiles/core.py", line 142, in landtile_asset ant_landscape_asset(folder, preset_name, tile_size, resolution) File "/home/gavsturm/infinigen/worldgen/terrain/assets/landtiles/ant_landscape.py", line 69, in ant_landscape_asset if erosion: run_erosion(folder) File "/home/gavsturm/infinigen/blender/3.3/python/lib/python3.10/site-packages/gin/config.py", line 1605, in gin_wrapper utils.augment_exception_message_and_reraise(e, err_str) File "/home/gavsturm/infinigen/blender/3.3/python/lib/python3.10/site-packages/gin/utils.py", line 41, in augment_exception_message_and_reraise raise proxy.with_traceback(exception.traceback) from None File "/home/gavsturm/infinigen/blender/3.3/python/lib/python3.10/site-packages/gin/config.py", line 1582, in gin_wrapper return fn(new_args, **new_kwargs) File "/home/gavsturm/infinigen/worldgen/terrain/land_process/erosion.py", line 28, in run_erosion dll = load_cdll(f"terrain/lib/cpu/soil_machine/SoilMachine.so") File "/home/gavsturm/infinigen/worldgen/terrain/utils/ctype_util.py", line 28, in load_cdll return CDLL(Path(sys.path[-1]) / path, mode=RTLD_LOCAL) File "/home/gavsturm/infinigen/blender/3.3/python/lib/python3.10/ctypes/init.py", line 374, in init self._handle = _dlopen(self._name, mode) OSError: /home/gavsturm/infinigen/worldgen/terrain/lib/cpu/soil_machine/SoilMachine.so: cannot open shared object file: No such file or directory In call to configurable 'run_erosion' (<function run_erosion at 0x7f6f1f6abd00>) In call to configurable 'load_assets' (<function LandTiles.load_assets at 0x7f6f1b5767a0>) In call to configurable 'LandTiles' (<class 'terrain.elements.landtiles.LandTiles'>) In call to configurable 'scene' (<function scene at 0x7f6fdb5a9e10>) In call to configurable 'Terrain' (<class 'terrain.core.Terrain'>) In call to configurable 'compose_scene' (<function compose_scene at 0x7f6fe04a75b0>) In call to configurable 'execute_tasks' (<function execute_tasks at 0x7f6f1abf25f0>)

Blender quit

gav-sturm commented 10 months ago

If I use the default outputs folder i get a similar error...

(base) gavsturm@DESKTOP-0M27Q9T:~/infinigen/worldgen$ $Blender -noaudio --background --python generate.py -- --seed 0 --task coarse -g desert.gin simple.gin --output_folder outputs/helloworld/coarse Blender 3.3.1 (hash b292cfe5a936 built 2022-10-05 00:14:35) Read prefs: /home/gavsturm/.config/blender/3.3/config/userpref.blend /run/user/1000/gvfs/ non-existent directory [15:06:38.933] [root] [INFO] | Converted args.seed='0' to scene_seed=0, parsed as hexadecimal [15:06:38.947] [root] [INFO] | infinigen version 1.0.3 [15:06:38.947] [root] [INFO] | CUDA_VISIBLE_DEVICES=None Error: Python: Traceback (most recent call last): File "/home/gavsturm/infinigen/blender/3.3/python/lib/python3.10/pathlib.py", line 1173, in mkdir self._accessor.mkdir(self, mode) FileNotFoundError: [Errno 2] No such file or directory: '/home/gavsturm/infinigen/worldgen/outputs/helloworld/coarse'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home/gavsturm/infinigen/worldgen/generate.py", line 441, in main() File "/home/gavsturm/infinigen/worldgen/generate.py", line 431, in main infinigen.main( File "/home/gavsturm/infinigen/worldgen/core.py", line 455, in main output_folder.mkdir(exist_ok=True, parents=True) File "/home/gavsturm/infinigen/blender/3.3/python/lib/python3.10/pathlib.py", line 1177, in mkdir self.parent.mkdir(parents=True, exist_ok=True) File "/home/gavsturm/infinigen/blender/3.3/python/lib/python3.10/pathlib.py", line 1173, in mkdir self._accessor.mkdir(self, mode) PermissionError: [Errno 13] Permission denied: '/home/gavsturm/infinigen/worldgen/outputs/helloworld'

Blender quit

gav-sturm commented 10 months ago

Note: there are heightmap.exr tile_size.txt in the filepath: "infinigen/worldgen/outputs2/helloworld/coarse/assets/Mountain/0"

araistrick commented 10 months ago

This almost certainly seems like some kind of OS setup / permissions error. are you able to touch the path it mentions and create a file there? Also run ls -l <filepath> on it to check it's permissions (must include write permission), and maybe sudo chmod -R u+rwx <filepath>.

If the problem persists, please make a new github issue.

init-qy commented 8 months ago

xarray's latest release 2023.10.0 is aslo incompatible with numpy.

To fix it, add xarray==2023.9.0 to requirements.txt.