SCIPY_ARRAY_API not working

I am trying to run the code for the competition. I have run code with importing scipy and sklearn packages before and there were no isuees. When I run my code now i get the error:

RuntimeError: Scikit-learn array API support was enabled but scipy’s own support is not enabled. Please set the SCIPY_ARRAY_API=1 environment variable before importing sklearn or scipy. More details at: Support for the array API standard — SciPy v1.15.3 Manual

I have tried reading the link above and setting os.environ[‘SCIPY_ARRAY_API’] = ‘1’ before my packages. The error is not leaving. What should I do to solve this?

Is the code commented in the .py version?

If so, you need to tell the system to not do that. So in a dedicated cell at the very top:

# @crunch/keep:on
import os
os.environ['SCIPY_ARRAY_API'] = '1'

(the comment is the most important part)

I updated the documentation: Known Issues | CrunchDAO Docs V3

That solved it. Thanks!

1 Like