Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compiling problems in python using #1203

Open
EarlyForGimlet opened this issue Jun 19, 2024 · 3 comments
Open

Compiling problems in python using #1203

EarlyForGimlet opened this issue Jun 19, 2024 · 3 comments

Comments

@EarlyForGimlet
Copy link

EarlyForGimlet commented Jun 19, 2024

Description

i am afraid i am not very familiar with the compiling issue, i changed my mitsuba.conf with the following :

    "enabled": [
        "scalar_rgb", "scalar_spectral", "cuda_ad_rgb", "llvm_ad_rgb","scalar_spectral_polarized","cuda_rgb_polarized","cuda_mono_polarized"
    ],

and then i compiled it following the guide, there is only one error but doesn't seem matter, however when i use the setpath.bat nothing happened, and i can't find the mitsuba3.exe neither, i just wanna to know how to use the compiled mitsuba in python since i know that i don't need to use "pip install mitsuba" because it may cause some confusing problems according to the former Q&As,
so what should i do after compiling and are my compling methods proper?
thanks a lot!

@njroussel
Copy link
Member

Running setpath.bat will add the build folder to PATH/PYTHONPATH environment variables. Once that is done you should be able to import mitsuba in your python shell.

Alternatively, you can ignore the setpath.bat script and in your python file add something along the lines of

import sys
sys.path.append("your/path/to/the/release/build/folder") 
import mitsuba

This is equivalent to adding the build folder to the PYTHONPATH environment variable.

@EarlyForGimlet
Copy link
Author

thank you for your answers, i tried your ways and finally succeeded, however the mudule"mitsuba" is highlighed with underline
image
i still can print the following variants correctly ,which is a great progress for me
屏幕截图 2024-06-20 141436
i wonder to know how to solve this problem cause there is no automatic code completion which is a bit annoying
what's more, when i import this mudule i found that i have to change my environment from conda env i established before into python's “oiginal environment” because it said that :

ImportError: The 'mitsuba' native modules could not be imported. You're likely trying to use Mitsuba within a Python binary (D:\ProgramFiles\Anaconda3\envs\mitsuba\python.exe) that is different from the one for which the native module was compiled (C:\Users\MSI\AppData\Local\Programs\Python\Python39\python.exe).

is there any solutions to compatible the compiled mitsuba with the conda env?
thank you for your time and attention in this matter!

@njroussel
Copy link
Member

That snippet of code makes Python aware of the mitsuba package at runtime. For you IDE to be able to give you auto-completion information, it also needs to add that path to its PYTHONPATH.Maybe your IDE has an option to add paths somewhere.

When you compiled mitsuba, were you in a conda env? I think that should work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants