I don’t think Python backend will pick that environment if the Python version is different. The reason is that there is a Python interpreter embedded in the triton_python_backend_stub file that is not dependent on the Python version available in the environment (it is always 3.8 unless you are compiling your own stub). If the Python version is different you need to compile your own stub.
you could create different backend directories and control it using the backend parameter field but you need to put the full Python backend compiled with different Python versions in the backends directory (it must include the stub file, triton_python_backend_utils and everything else included). For the environment you need to create a tar file using conda-pack and use that for each of the models.
# Using tcmallocLD_PRELOAD=/usr/lib/$(uname-m)-linux-gnu/libtcmalloc.so.4:${LD_PRELOAD}tritonserver--model-repository=/models...
# Using jemallocLD_PRELOAD=/usr/lib/$(uname-m)-linux-gnu/libjemalloc.so:${LD_PRELOAD}tritonserver--model-repository=/models...
TRITONSERVER_Error*StubLauncher::Launch(){// Default Python backend stubstd::stringpython_backend_stub=python_lib_+"/triton_python_backend_stub";// Path to alternative Python backend stubstd::stringmodel_python_backend_stub=std::string(model_repository_path_)+"/triton_python_backend_stub";if(FileExists(model_python_backend_stub)){python_backend_stub=model_python_backend_stub;}if(python_execution_env_!=""){std::stringstreamss;// Need to properly set the LD_LIBRARY_PATH so that Python environments// using different python versions load properly.ss<<"source "<<path_to_activate_<<" && exec env LD_LIBRARY_PATH="<<path_to_libpython_<<":$LD_LIBRARY_PATH "<<python_backend_stub<<" "<<model_path_<<" "<<shm_region_name_<<" "<<shm_default_byte_size_<<" "<<shm_growth_byte_size_<<" "<<parent_pid_<<" "<<python_lib_<<" "<<ipc_control_handle_<<" "<<stub_name<<" "<<runtime_modeldir_;ipc_control_->uses_env=true;bash_argument=ss.str();}}
intstub_status_code=system((python_backend_stub+"> /dev/null 2>&1").c_str());// If running stub process without any arguments returns any status code,// other than 1, it can indicate a permission issue as a result of// downloading the stub process from a cloud object storage service.if(WEXITSTATUS(stub_status_code)!=1){// Give the execute permission for the triton_python_backend_stub to the// owner.interror=chmod(python_backend_stub.c_str(),S_IXUSR);if(error!=0){returnTRITONSERVER_ErrorNew(TRITONSERVER_ERROR_INTERNAL,(std::string("Failed to give execute permission to ""triton_python_backend_stub in ")+python_backend_stub+" "+stub_name+" Error No.: "+std::to_string(error)).c_str());}}