@@ -372,16 +372,38 @@ def _test_in_env(
372372 raise RuntimeError ("Conda not available" ) from e
373373
374374 working_dir .mkdir (parents = True , exist_ok = True )
375+ summary_path = working_dir / "summary.json"
375376 try :
376377 run_command (["conda" , "activate" , env_name ])
377378 except Exception :
378379 path = working_dir / "env.yaml"
379- _ = path .write_bytes (encoded_env )
380- logger .debug ("written conda env to {}" , path )
381- run_command (["conda" , "env" , "create" , f"--file={ path } " , f"--name={ env_name } " ])
382- run_command (["conda" , "activate" , env_name ])
380+ try :
381+ _ = path .write_bytes (encoded_env )
382+ logger .debug ("written conda env to {}" , path )
383+ run_command (
384+ ["conda" , "env" , "create" , f"--file={ path } " , f"--name={ env_name } " ]
385+ )
386+ run_command (["conda" , "activate" , env_name ])
387+ except Exception as e :
388+ summary = descr .validation_summary
389+ summary .add_detail (
390+ ValidationDetail (
391+ name = "Conda environment creation" ,
392+ status = "failed" ,
393+ loc = ("weights" , weight_format ),
394+ recommended_env = conda_env ,
395+ errors = [
396+ ErrorEntry (
397+ loc = ("weights" , weight_format ),
398+ msg = str (e ),
399+ type = "conda" ,
400+ with_traceback = True ,
401+ )
402+ ],
403+ )
404+ )
405+ return summary
383406
384- summary_path = working_dir / "summary.json"
385407 run_command (
386408 [
387409 "conda" ,
0 commit comments