bulletphysics / bullet3

Bullet Physics SDK: real-time collision detection and multi-physics simulation for VR, games, visual effects, robotics, machine learning etc.

Home Page:http://bulletphysics.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

pip-installed PyBullet does not have NumPy enabled

luator opened this issue · comments

According to the documentation "pip install pybullet has NumPy enabled, if available on the system."
However, I just ran into an issue that indicates that NumPy is not used (getCameraImage returned an tuple instead of the expected array). Also pybullet.isNumpyEnabled() returns 0.

Both PyBullet and NumPy are installed via pip (in a venv). I did not have this issue in the past, so could it be a problem that was introduced with a recent release (of either PyBullet or NumPy)? Or am I missing something?

Steps to reproduce:

python3 -m venv /tmp/test-venv
. /tmp/test-venv/bin/activate
pip install -U pip

pip install numpy
pip install pybullet

python -c "import importlib.metadata; print('NumPy version:', importlib.metadata.version('numpy'))"
python -c "import importlib.metadata; print('PyBullet version:', importlib.metadata.version('pybullet'))"
python -c "import pybullet; print('NumPy enabled:', pybullet.isNumpyEnabled())"

Output I get (on Ubuntu 22.04 with Python 3.10.12):

...
NumPy version: 1.25.2
PyBullet version: 3.2.5
pybullet build time: Aug 24 2023 11:18:40
NumPy enabled: 0

I do not have the issue in a different environment (using a container) with an older NumPy version. There I get

NumPy version: 1.23.3
PyBullet version: 3.2.5
pybullet build time: Aug 23 2023 11:35:33
NumPy enabled: 1

However, just downgrading NumPy in the "steps to reproduce" above does not help. I noticed that even though the PyBullet version is the same, the build time differs by one day, so it seems that's actually also not exactly the same version.