Open MaxGhenis opened 11 months ago
I was just able to make it work on notebook.
Interesting, thanks @ch1nmay7898! Could you check if we could do anything to avoid the error without restarting the runtime?
Found this helpful: (link)
My understanding: Looks like it is necessary to restart the runtime on Colab for it to register the newly installed versions of dependencies. The warning says that argparse was previously imported in the runtime and to register the argparse-1.4.0 version (which gets installed with policyengine_us), runtime needs to be restarted.
There is a way to restart the runtime programmatically from command line, but that doesn't seem like the best way.
Could we change our code to work with the argparse version colab uses?
Looks like this TypeError is related to the numpy version and not the argparse version. When I do a pip show numpy on a new Colab notebook I see that it comes with version 1.23.5. Looks like policyengine-core specifically only supports numpy<1.22 and >=1.21, so a runtime restart might be necessary to avoid other issues.
Judging by the error, it looks like the contains_nan handling in the policyengine_core helper might be expecting the vector to be in a format it's no longer in with numpy versions > 1.22. If updating the numpy version of policyengine-core is a possibility, then the next step should be to do that and run this logic to see why contains_nan encountering this error.
Looks like this issue has been fixed on the openfisca-core side: https://github.com/openfisca/openfisca-core/commit/a71d2217f6dc19d3786d24490e1324d2feb2c91f
I thought that a bool parameter being a list #2801 was the cause, but it didn't fix it (notebook).
This means any automatically generated microsimulation Python code from the app fails in Colab (works locally).
throws