marian42 / mesh_to_sdf

Calculate signed distance fields for arbitrary meshes
https://pypi.org/project/mesh-to-sdf/
MIT License
991 stars 107 forks source link

TypeError: startswith first arg must be bytes or a tuple of bytes, not str #31

Open BooPatienze opened 2 years ago

BooPatienze commented 2 years ago
>>> mesh_path = "/data3/ShapeNet-v2/04256520/93d5203022d651c831ae8c8ff1eb3d45/models/model_normalized.obj"
>>> mesh = utils.load_mesh(mesh_path)  # using trimesh
>>> from mesh_to_sdf import mesh_to_voxels
>>> mesh_sdf = mesh_to_voxels(mesh, voxel_resolution=30,
                          sign_method='depth',
...                           surface_point_method='scan',
...                           sign_method='depth',
...                           scan_count=20,
...                           scan_resolution=400,
...                           pad=True,
...                           check_result=False)
Traceback (most recent call last):
  File "/data3/lpz/sourcecode/corenet-main/env38/lib/python3.8/site-packages/OpenGL/latebind.py", line 41, in __call__
    return self._finalCall( *args, **named )
  File "/data3/lpz/sourcecode/corenet-main/env38/lib/python3.8/site-packages/OpenGL/wrapper.py", line 657, in wrapperCall
    result = wrappedOperation( *cArguments )
  File "/data3/lpz/sourcecode/corenet-main/env38/lib/python3.8/site-packages/OpenGL/platform/baseplatform.py", line 401, in __call__
    if self.load():
  File "/data3/lpz/sourcecode/corenet-main/env38/lib/python3.8/site-packages/OpenGL/platform/baseplatform.py", line 383, in load
    func = platform.PLATFORM.constructFunction(
  File "/data3/lpz/sourcecode/corenet-main/env38/lib/python3.8/site-packages/OpenGL/platform/baseplatform.py", line 148, in constructFunction
    if (not is_core) and not self.checkExtension( extension ):
  File "/data3/lpz/sourcecode/corenet-main/env38/lib/python3.8/site-packages/OpenGL/platform/baseplatform.py", line 270, in checkExtension
    result = extensions.ExtensionQuerier.hasExtension( name )
  File "/data3/lpz/sourcecode/corenet-main/env38/lib/python3.8/site-packages/OpenGL/extensions.py", line 98, in hasExtension
    result = registered( specifier )
  File "/data3/lpz/sourcecode/corenet-main/env38/lib/python3.8/site-packages/OpenGL/extensions.py", line 105, in __call__
    if not specifier.startswith( self.prefix ):
TypeError: startswith first arg must be bytes or a tuple of bytes, not str

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/data3/lpz/sourcecode/corenet-main/env38/lib/python3.8/site-packages/mesh_to_sdf/__init__.py", line 47, in mesh_to_voxels
    surface_point_cloud = get_surface_point_cloud(mesh, surface_point_method, 3**0.5, scan_count, scan_resolution, sample_point_count, sign_method=='normal')
  File "/data3/lpz/sourcecode/corenet-main/env38/lib/python3.8/site-packages/mesh_to_sdf/__init__.py", line 17, in get_surface_point_cloud
    return surface_point_cloud.create_from_scans(mesh, bounding_radius=bounding_radius, scan_count=scan_count, scan_resolution=scan_resolution, calculate_normals=calculate_normals)
  File "/data3/lpz/sourcecode/corenet-main/env38/lib/python3.8/site-packages/mesh_to_sdf/surface_point_cloud.py", line 162, in create_from_scans
    scans.append(Scan(mesh,
  File "/data3/lpz/sourcecode/corenet-main/env38/lib/python3.8/site-packages/mesh_to_sdf/scan.py", line 61, in __init__
    color, depth = render_normal_and_depth_buffers(mesh, camera, self.camera_transform, resolution)
  File "/data3/lpz/sourcecode/corenet-main/env38/lib/python3.8/site-packages/mesh_to_sdf/pyrender_wrapper.py", line 61, in render_normal_and_depth_buffers
    color, depth = renderer.render(scene, flags=pyrender.RenderFlags.SKIP_CULL_FACES)
  File "/data3/lpz/sourcecode/corenet-main/env38/lib/python3.8/site-packages/pyrender/offscreen.py", line 102, in render
    retval = self._renderer.render(scene, flags, seg_node_map)
  File "/data3/lpz/sourcecode/corenet-main/env38/lib/python3.8/site-packages/pyrender/renderer.py", line 125, in render
    self._update_context(scene, flags)
  File "/data3/lpz/sourcecode/corenet-main/env38/lib/python3.8/site-packages/pyrender/renderer.py", line 738, in _update_context
    p._add_to_context()
  File "/data3/lpz/sourcecode/corenet-main/env38/lib/python3.8/site-packages/pyrender/primitive.py", line 324, in _add_to_context
    self._vaid = glGenVertexArrays(1)
  File "/data3/lpz/sourcecode/corenet-main/env38/lib/python3.8/site-packages/OpenGL/latebind.py", line 45, in __call__
    return self._finalCall( *args, **named )
  File "/data3/lpz/sourcecode/corenet-main/env38/lib/python3.8/site-packages/OpenGL/wrapper.py", line 657, in wrapperCall
    result = wrappedOperation( *cArguments )
  File "/data3/lpz/sourcecode/corenet-main/env38/lib/python3.8/site-packages/OpenGL/platform/baseplatform.py", line 401, in __call__
    if self.load():
  File "/data3/lpz/sourcecode/corenet-main/env38/lib/python3.8/site-packages/OpenGL/platform/baseplatform.py", line 383, in load
    func = platform.PLATFORM.constructFunction(
  File "/data3/lpz/sourcecode/corenet-main/env38/lib/python3.8/site-packages/OpenGL/platform/baseplatform.py", line 148, in constructFunction
    if (not is_core) and not self.checkExtension( extension ):
  File "/data3/lpz/sourcecode/corenet-main/env38/lib/python3.8/site-packages/OpenGL/platform/baseplatform.py", line 270, in checkExtension
    result = extensions.ExtensionQuerier.hasExtension( name )
  File "/data3/lpz/sourcecode/corenet-main/env38/lib/python3.8/site-packages/OpenGL/extensions.py", line 98, in hasExtension
    result = registered( specifier )
  File "/data3/lpz/sourcecode/corenet-main/env38/lib/python3.8/site-packages/OpenGL/extensions.py", line 105, in __call__
    if not specifier.startswith( self.prefix ):
TypeError: startswith first arg must be bytes or a tuple of bytes, not str

My virtualenv pip list : absl-py 0.12.0 aiohttp 3.8.1 aiohttp-cors 0.7.0 aioredis 2.0.0 aiosignal 1.2.0 apache-beam 2.34.0 astunparse 1.6.3 async-timeout 4.0.1 attrs 21.2.0 avro-python3 1.9.1 beautifulsoup4 4.10.0 blessings 1.7 cachetools 4.2.4 certifi 2021.10.8 charset-normalizer 2.0.9 click 8.0.3 colorama 0.4.4 colorful 0.5.4 contextlib2 21.6.0 crcmod 1.7 cycler 0.11.0 Cython 0.29.24 dataclasses 0.6 dataclasses-jsonschema 2.15.0 dill 0.3.1.1 dm-tree 0.1.6 docopt 0.6.2 fastavro 1.4.7 filelock 3.4.0 flatbuffers 2.0 fonttools 4.28.4 freetype-py 2.2.0 frozenlist 1.2.0 future 0.18.2 gast 0.3.3 gin-config 0.5.0 glcontext 2.3.4 google 3.0.0 google-api-core 1.31.5 google-api-python-client 2.33.0 google-auth 1.35.0 google-auth-httplib2 0.1.0 google-auth-oauthlib 0.4.6 google-cloud-core 1.7.2 google-cloud-storage 1.28.1 google-pasta 0.2.0 google-resumable-media 0.5.1 googleapis-common-protos 1.54.0 gpustat 0.4.1 grpcio 1.42.0 h5py 2.10.0 hdfs 2.6.0 httplib2 0.19.1 idna 3.3 imageio 2.9.0 importlib-metadata 4.8.2 importlib-resources 5.4.0 joblib 1.1.0 jq 1.1.1 json5 0.9.5 jsonschema 3.2.0 kaggle 1.5.12 keras 2.7.0 Keras-Preprocessing 1.1.2 kiwisolver 1.3.2 libclang 12.0.0 lvis 0.5.3 lxml 4.7.1 Markdown 3.3.6 matplotlib 3.5.1 mesh-to-sdf 0.0.14 moderngl 5.6.0 msgpack 1.0.3 multidict 5.2.0 networkx 2.6.3 numpy 1.21.5 nvidia-ml-py3 7.352.0 oauth2client 4.1.3 oauthlib 3.1.1 object-detection 0.1 opencensus 0.8.0 opencensus-context 0.1.2 opencv-python 4.5.4.60 opencv-python-headless 4.5.4.60 opt-einsum 3.3.0 orjson 3.6.5 packaging 21.3 pandas 1.0.3 Pillow 7.1.2 pip 21.3.1 pkg_resources 0.0.0 portalocker 2.3.2 prometheus-client 0.12.0 promise 2.3 protobuf 3.19.1 psutil 5.8.0 py-cpuinfo 8.0.0 py-spy 0.3.11 pyarrow 5.0.0 pyasn1 0.4.8 pyasn1-modules 0.2.8 pycocotools 2.0.3 pydot 1.4.2 pyglet 1.5.21 pymongo 3.12.3 PyOpenGL 3.1.0 pyparsing 2.4.7 pyrender 0.1.45 pyrsistent 0.18.0 python-dateutil 2.8.2 python-slugify 5.0.2 pytz 2021.3 pyviz3d 0.2.25 PyWavelets 1.2.0 PyYAML 6.0 ray 1.0.1 redis 3.4.1 regex 2021.11.10 requests 2.26.0 requests-oauthlib 1.3.0 rsa 4.8 sacrebleu 2.0.0 scikit-image 0.17.2 scikit-learn 1.0.2 scipy 1.7.3 sentencepiece 0.1.96 seqeval 0.0.10 setuptools 59.6.0 six 1.16.0 sklearn 0.0 soupsieve 2.3.1 tabulate 0.8.9 tensorboard 2.7.0 tensorboard-data-server 0.6.1 tensorboard-plugin-wit 1.8.0 tensorflow-addons 0.15.0 tensorflow-datasets 4.4.0 tensorflow-estimator 2.3.0 tensorflow-gpu 2.3.1 tensorflow-hub 0.12.0 tensorflow-io 0.23.1 tensorflow-io-gcs-filesystem 0.23.1 tensorflow-metadata 1.5.0 tensorflow-model-optimization 0.7.0 tensorflow-text 2.7.3 termcolor 1.1.0 text-unidecode 1.3 tf-models-official 2.7.0 tf-slim 1.1.0 threadpoolctl 3.0.0 tifffile 2021.11.2 torch 1.7.0 torchvision 0.8.1 tqdm 4.62.3 trimesh 3.9.42 typeguard 2.13.3 typing-extensions 3.10.0.2 uritemplate 4.1.1 urllib3 1.26.7 Werkzeug 2.0.2 wheel 0.37.0 wrapt 1.13.3 yarl 1.7.2 zipp 3.6.0

According to this error outputs, I try PyOpenGL==3.1.5, but I get the follow error:

>>> mesh_sdf = utils.create_sdf_from_mesh(mesh)
Segmentation fault (core dumped)

what can I do to figure it out? I using Ubuntu 18.04, CUDA 10.1, nvidia-driver 470.86