nerfstudio icon indicating copy to clipboard operation
nerfstudio copied to clipboard

rich MarkupError

Open forEachWhileTrue opened this issue 1 year ago • 12 comments

Hello there,

I'm running nerfstudio on an Azure Maching Learning VM with Ubuntu 18.04. When I try to process data with ns-process-data images I get an error which is thrown by the rich library after downscaling the images:

Screenshot 2023-06-20 at 15 17 41

I already processed polycam data which worked without problems. So this error only appears in combination with colmap.

Hope you can help me and thanks in advance!

forEachWhileTrue avatar Jun 20 '23 13:06 forEachWhileTrue

I'm a bit in a hurry to get this running, so if someone could help me out here, I would really appreciate it. :)

forEachWhileTrue avatar Jun 26 '23 11:06 forEachWhileTrue

Can you check that your terminal is set up to use UTF-8

tancik avatar Jun 26 '23 18:06 tancik

Can you check that your terminal is set up to use UTF-8

yes, it's UTF-8. I face the same problem!

Terry10086 avatar Jun 30 '23 07:06 Terry10086

Can you check that your terminal is set up to use UTF-8

Yes, it is but it’s still not working.

forEachWhileTrue avatar Jun 30 '23 07:06 forEachWhileTrue

Here is the error information ────────────────────────────────────────────── 💀 💀 💀 ERROR 💀 💀 💀 ─────────────────────────────────────────────── Error running command: colmap feature_extractor --database_path data/nerfstudio/render/colmap/database.db --image_path data/nerfstudio/render/images --ImageReader.single_camera 1 --ImageReader.camera_model OPENCV --SiftExtraction.use_gpu 1 ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── Traceback (most recent call last): File "/home/yangtongyu/.conda/envs/nerfstudio/bin/ns-process-data", line 8, in <module> sys.exit(entrypoint()) File "/home/yangtongyu/nerf/nerfstudio/nerfstudio/scripts/process_data.py", line 408, in entrypoint tyro.cli(Commands).main() File "/home/yangtongyu/nerf/nerfstudio/nerfstudio/process_data/images_to_nerfstudio_dataset.py", line 82, in main self._run_colmap() File "/home/yangtongyu/nerf/nerfstudio/nerfstudio/process_data/colmap_converter_to_nerfstudio_dataset.py", line 199, in _run_colmap colmap_utils.run_colmap( File "/home/yangtongyu/nerf/nerfstudio/nerfstudio/process_data/colmap_utils.py", line 129, in run_colmap run_command(feature_extractor_cmd, verbose=verbose) File "/home/yangtongyu/nerf/nerfstudio/nerfstudio/utils/scripts.py", line 37, in run_command CONSOLE.print(out.stderr.decode("utf-8")) File "/home/yangtongyu/.conda/envs/nerfstudio/lib/python3.8/site-packages/rich/console.py", line 1673, in print renderables = self._collect_renderables( File "/home/yangtongyu/.conda/envs/nerfstudio/lib/python3.8/site-packages/rich/console.py", line 1537, in _collect_renderables self.render_str( File "/home/yangtongyu/.conda/envs/nerfstudio/lib/python3.8/site-packages/rich/console.py", line 1429, in render_str rich_text = render_markup( File "/home/yangtongyu/.conda/envs/nerfstudio/lib/python3.8/site-packages/rich/markup.py", line 158, in render print(pop_style(style_name)) File "/home/yangtongyu/.conda/envs/nerfstudio/lib/python3.8/site-packages/rich/markup.py", line 145, in pop_style raise KeyError(style_name) KeyError: 'home/conda/feedstock_root/build_artifacts/colmap_1686935602614/work/src/base/database.cc, line 270' (nerfstudio) yangtongyu@amax21-1:~/nerf/nerfstudio$ ns-process-data images --data data/nerfstudio/render --output-dir data/nerfstudio/render [12:02:24] 🎉 Done copying images. process_data_utils.py:241 [12:02:27] 🎉 Done downscaling images. process_data_utils.py:364 ────────────────────────────────────────────── 💀 💀 💀 ERROR 💀 💀 💀 ─────────────────────────────────────────────── Error running command: colmap feature_extractor --database_path data/nerfstudio/render/colmap/database.db --image_path data/nerfstudio/render/images --ImageReader.single_camera 1 --ImageReader.camera_model OPENCV --SiftExtraction.use_gpu 1 ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── Traceback (most recent call last): File "/home/yangtongyu/.conda/envs/nerfstudio/bin/ns-process-data", line 8, in <module> sys.exit(entrypoint()) File "/home/yangtongyu/nerf/nerfstudio/nerfstudio/scripts/process_data.py", line 408, in entrypoint tyro.cli(Commands).main() File "/home/yangtongyu/nerf/nerfstudio/nerfstudio/process_data/images_to_nerfstudio_dataset.py", line 82, in main self._run_colmap() File "/home/yangtongyu/nerf/nerfstudio/nerfstudio/process_data/colmap_converter_to_nerfstudio_dataset.py", line 199, in _run_colmap colmap_utils.run_colmap( File "/home/yangtongyu/nerf/nerfstudio/nerfstudio/process_data/colmap_utils.py", line 129, in run_colmap run_command(feature_extractor_cmd, verbose=verbose) File "/home/yangtongyu/nerf/nerfstudio/nerfstudio/utils/scripts.py", line 37, in run_command CONSOLE.print(out.stderr.decode("utf-8")) File "/home/yangtongyu/.conda/envs/nerfstudio/lib/python3.8/site-packages/rich/console.py", line 1673, in print renderables = self._collect_renderables( File "/home/yangtongyu/.conda/envs/nerfstudio/lib/python3.8/site-packages/rich/console.py", line 1537, in _collect_renderables self.render_str( File "/home/yangtongyu/.conda/envs/nerfstudio/lib/python3.8/site-packages/rich/console.py", line 1429, in render_str rich_text = render_markup( File "/home/yangtongyu/.conda/envs/nerfstudio/lib/python3.8/site-packages/rich/markup.py", line 161, in render raise MarkupError( rich.errors.MarkupError: closing tag '[/home/conda/feedstock_root/build_artifacts/colmap_1686935602614/work/src/base/database.cc, line 270]' at position 13 doesn't match any open tag

Terry10086 avatar Jun 30 '23 12:06 Terry10086

Hey, is there another solution? Because my terminal supports UTF-8 but it's still not working. :(

forEachWhileTrue avatar Jul 10 '23 09:07 forEachWhileTrue

Hi everyone, has anyone finished this problem? I found that if I use only cpu to process it will be fine (but this is too slow). Does colmap/ns-process-data can use gpu?

lan-creator avatar Aug 05 '23 04:08 lan-creator

I'm using the official docker image and encontered the same problem. My solution is to edit line 37 of scripts.py, using try and except with print() instead of rich console if anything goes wrong. So that it prints the correct error messages.

HugoFeng avatar Aug 08 '23 09:08 HugoFeng

Here is the error information ────────────────────────────────────────────── 💀 💀 💀 ERROR 💀 💀 💀 ─────────────────────────────────────────────── Error running command: colmap feature_extractor --database_path data/nerfstudio/render/colmap/database.db --image_path data/nerfstudio/render/images --ImageReader.single_camera 1 --ImageReader.camera_model OPENCV --SiftExtraction.use_gpu 1 ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── Traceback (most recent call last): File "/home/yangtongyu/.conda/envs/nerfstudio/bin/ns-process-data", line 8, in <module> sys.exit(entrypoint()) File "/home/yangtongyu/nerf/nerfstudio/nerfstudio/scripts/process_data.py", line 408, in entrypoint tyro.cli(Commands).main() File "/home/yangtongyu/nerf/nerfstudio/nerfstudio/process_data/images_to_nerfstudio_dataset.py", line 82, in main self._run_colmap() File "/home/yangtongyu/nerf/nerfstudio/nerfstudio/process_data/colmap_converter_to_nerfstudio_dataset.py", line 199, in _run_colmap colmap_utils.run_colmap( File "/home/yangtongyu/nerf/nerfstudio/nerfstudio/process_data/colmap_utils.py", line 129, in run_colmap run_command(feature_extractor_cmd, verbose=verbose) File "/home/yangtongyu/nerf/nerfstudio/nerfstudio/utils/scripts.py", line 37, in run_command CONSOLE.print(out.stderr.decode("utf-8")) File "/home/yangtongyu/.conda/envs/nerfstudio/lib/python3.8/site-packages/rich/console.py", line 1673, in print renderables = self._collect_renderables( File "/home/yangtongyu/.conda/envs/nerfstudio/lib/python3.8/site-packages/rich/console.py", line 1537, in _collect_renderables self.render_str( File "/home/yangtongyu/.conda/envs/nerfstudio/lib/python3.8/site-packages/rich/console.py", line 1429, in render_str rich_text = render_markup( File "/home/yangtongyu/.conda/envs/nerfstudio/lib/python3.8/site-packages/rich/markup.py", line 158, in render print(pop_style(style_name)) File "/home/yangtongyu/.conda/envs/nerfstudio/lib/python3.8/site-packages/rich/markup.py", line 145, in pop_style raise KeyError(style_name) KeyError: 'home/conda/feedstock_root/build_artifacts/colmap_1686935602614/work/src/base/database.cc, line 270' (nerfstudio) yangtongyu@amax21-1:~/nerf/nerfstudio$ ns-process-data images --data data/nerfstudio/render --output-dir data/nerfstudio/render [12:02:24] 🎉 Done copying images. process_data_utils.py:241 [12:02:27] 🎉 Done downscaling images. process_data_utils.py:364 ────────────────────────────────────────────── 💀 💀 💀 ERROR 💀 💀 💀 ─────────────────────────────────────────────── Error running command: colmap feature_extractor --database_path data/nerfstudio/render/colmap/database.db --image_path data/nerfstudio/render/images --ImageReader.single_camera 1 --ImageReader.camera_model OPENCV --SiftExtraction.use_gpu 1 ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── Traceback (most recent call last): File "/home/yangtongyu/.conda/envs/nerfstudio/bin/ns-process-data", line 8, in <module> sys.exit(entrypoint()) File "/home/yangtongyu/nerf/nerfstudio/nerfstudio/scripts/process_data.py", line 408, in entrypoint tyro.cli(Commands).main() File "/home/yangtongyu/nerf/nerfstudio/nerfstudio/process_data/images_to_nerfstudio_dataset.py", line 82, in main self._run_colmap() File "/home/yangtongyu/nerf/nerfstudio/nerfstudio/process_data/colmap_converter_to_nerfstudio_dataset.py", line 199, in _run_colmap colmap_utils.run_colmap( File "/home/yangtongyu/nerf/nerfstudio/nerfstudio/process_data/colmap_utils.py", line 129, in run_colmap run_command(feature_extractor_cmd, verbose=verbose) File "/home/yangtongyu/nerf/nerfstudio/nerfstudio/utils/scripts.py", line 37, in run_command CONSOLE.print(out.stderr.decode("utf-8")) File "/home/yangtongyu/.conda/envs/nerfstudio/lib/python3.8/site-packages/rich/console.py", line 1673, in print renderables = self._collect_renderables( File "/home/yangtongyu/.conda/envs/nerfstudio/lib/python3.8/site-packages/rich/console.py", line 1537, in _collect_renderables self.render_str( File "/home/yangtongyu/.conda/envs/nerfstudio/lib/python3.8/site-packages/rich/console.py", line 1429, in render_str rich_text = render_markup( File "/home/yangtongyu/.conda/envs/nerfstudio/lib/python3.8/site-packages/rich/markup.py", line 161, in render raise MarkupError( rich.errors.MarkupError: closing tag '[/home/conda/feedstock_root/build_artifacts/colmap_1686935602614/work/src/base/database.cc, line 270]' at position 13 doesn't match any open tag

same problem, seems like my output dir is within my NAS, which may goes wrong with some linux file permissions. When I change the output dir to a folder under docker /workspace/ , everything goes well.

HugoFeng avatar Aug 08 '23 09:08 HugoFeng

I tried to track the issue, which turns out to be the database file created being locked and colmap failed to process it. For me, it happened because I tried to process data on a NAS, the database file colmap tries to process was created with an insufficient access authority and cannot even be later changed.

The simple but tedious solution was to move things back to local. I don't know if anyone has any better idea of how to solve it in a better way.

deephog avatar Sep 29 '23 19:09 deephog

Agree with @HugoFeng and @deephog, the issue might be coming from a database.db lock, which is based on it's location. I'm working on a remote Linux machine and ran into the issue. I moved the output folder somewhere up the directories and it worked as expected.

Jordan-Pierce avatar Jan 23 '24 16:01 Jordan-Pierce

hey guys I got a possible solution,

If you're mounting the NAS on Linux using the mount command, try to toss in the nobrl option.

Just run something like this:

sudo mount -t cifs -o username=USERNAME,uid=$(id -u),gid=$(id -g),iocharset=utf8,nobrl //192.168.X.XX/Main /nas/Main

This should sort out those pesky errors about file permissions and database locks.

qf-wei avatar Apr 12 '24 16:04 qf-wei