mitsuba-renderer / mitsuba3

Mitsuba 3: A Retargetable Forward and Inverse Renderer
https://www.mitsuba-renderer.org/
Other
2.1k stars 246 forks source link

AttributeError: module 'mitsuba' has no attribute 'set_variant' #1165

Closed arpan-kusari closed 6 months ago

arpan-kusari commented 6 months ago

I am trying to run the hello world example of mitsuba and getting the error in the title. I am using Ubuntu 22.04 with Python version 3.10.12 and installed mitsuba (and dr.jit) without error using 'pip mitsuba'. I confirm that mitsuba version 3.5.0 and drjit version 0.4.4 has been installed. But when I import and run mi.set_variant('scalar_rgb'), it gives me the AttributeError. From nvidia-smi, this is the output -

+---------------------------------------------------------------------------------------+
| NVIDIA-SMI 545.23.08              Driver Version: 545.23.08    CUDA Version: 12.3     |
|-----------------------------------------+----------------------+----------------------+
| GPU  Name                 Persistence-M | Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp   Perf          Pwr:Usage/Cap |         Memory-Usage | GPU-Util  Compute M. |
|                                         |                      |               MIG M. |
|=========================================+======================+======================|
|   0  Quadro RTX 6000                On  | 00000000:3B:00.0 Off |                  Off |
| 33%   29C    P8               4W / 260W |      6MiB / 24576MiB |      0%      Default |
|                                         |                      |                  N/A |
+-----------------------------------------+----------------------+----------------------+

+---------------------------------------------------------------------------------------+
| Processes:                                                                            |
|  GPU   GI   CI        PID   Type   Process name                            GPU Memory |
|        ID   ID                                                             Usage      |
|=======================================================================================|
|    0   N/A  N/A      2143      G   /usr/lib/xorg/Xorg                            4MiB |
+---------------------------------------------------------------------------------------+
merlinND commented 6 months ago

Hello @arpan-kusari,

Are you sure that the Python interpreter that you tried to import mitsuba with is the same that was used to pip-install the package?

Please try creating a virtual environment and importing it there:

mkdir test_dir
cd test_dir

python3 -m venv .venv
source ./.venv/bin/activate
pip install mitsuba
python

>>> import mitsuba as mi
>>> mi.set_variant("cuda_ad_rgb")
>>> scene = mi.load_dict(mi.cornell_box())
arpan-kusari commented 6 months ago

Hi, We have managed to recreate the issue. It is due to Python version. It works for 3.8 but not for 3.10.12.