Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Numpy 2.x not supported #288

Copy link
Copy link
@ZamboniMarco99

Description

@ZamboniMarco99
Issue body actions

I think this is quite a urgent issue since new installations of pyrender break.

The new major release of numpy brings braking changes in the api making pyrender not compatible with it.

A quick fix could be giving an upper bound to the numpy dependency in setup.py

For example this code raise an AttributeError when pyrender try to use np.infty:

import trimesh
import pyrender

mesh = trimesh.load(file)
scene = pyrender.Scene.from_trimesh_scene(mesh_glb, bg_color=[1.0, 1.0, 1.0])
pyrender.Viewer(scene)

Traceback:

Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File ".../.venv/lib/python3.10/site-packages/pyrender/viewer.py", line 300, in __init__
    zfar = max(scene.scale * 10.0, DEFAULT_Z_FAR)
  File ".../.venv/lib/python3.10/site-packages/pyrender/scene.py", line 254, in scale
    return np.linalg.norm(self.extents)
  File ".../.venv/lib/python3.10/site-packages/pyrender/scene.py", line 248, in extents
    return np.diff(self.bounds, axis=0).reshape(-1)
  File ".../.venv/lib/python3.10/site-packages/pyrender/scene.py", line 226, in bounds
    corners_local = trimesh.bounds.corners(mesh.bounds)
  File ".../.venv/lib/python3.10/site-packages/pyrender/mesh.py", line 87, in bounds
    bounds = np.array([[np.infty, np.infty, np.infty],
  File ".../.venv/lib/python3.10/site-packages/numpy/__init__.py", line 397, in __getattr__
    raise AttributeError(
AttributeError: `np.infty` was removed in the NumPy 2.0 release. Use `np.inf` instead.. Did you mean: 'info'?

For full documentation here the contents of my venv:

Package                   Version
------------------------- -----------
addict                    2.4.0
attrs                     23.2.0
blinker                   1.8.2
certifi                   2024.7.4
charset-normalizer        3.3.2
click                     8.1.7
configargparse            1.7
contourpy                 1.2.1
cycler                    0.12.1
dash                      2.17.1
dash-core-components      2.0.0
dash-html-components      2.0.0
dash-table                5.0.0
fastjsonschema            2.20.0
flask                     3.0.3
fonttools                 4.53.1
freetype-py               2.4.0
idna                      3.7
imageio                   2.34.2
importlib-metadata        8.0.0
itsdangerous              2.2.0
jinja2                    3.1.4
joblib                    1.4.2
jsonschema                4.23.0
jsonschema-specifications 2023.12.1
jupyter-core              5.7.2
kiwisolver                1.4.5
markupsafe                2.1.5
matplotlib                3.9.1
nbformat                  5.10.4
nest-asyncio              1.6.0
networkx                  3.3
numpy                     2.0.0
open3d                    0.18.0
packaging                 24.1
pandas                    2.2.2
pillow                    10.4.0
platformdirs              4.2.2
plotly                    5.22.0
pyglet                    2.0.15
pyopengl                  3.1.0
pyparsing                 3.1.2
pyquaternion              0.9.9
pyrender                  0.1.45
python-dateutil           2.9.0.post0
pytz                      2024.1
pyyaml                    6.0.1
referencing               0.35.1
requests                  2.32.3
retrying                  1.3.4
rpds-py                   0.19.0
scikit-learn              1.5.1
scipy                     1.14.0
setuptools                70.3.0
six                       1.16.0
tenacity                  8.5.0
threadpoolctl             3.5.0
tqdm                      4.66.4
traitlets                 5.14.3
trimesh                   4.4.2
typing-extensions         4.12.2
tzdata                    2024.1
urllib3                   2.2.2
werkzeug                  3.0.3
zipp                      3.19.2
ndahn and panki27

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.