Related: I've found that to run time-consuming number-crunching code from Elixir, the most convenient approach is to call a Python script via ports. It's super easy and can't crash your VM.
To convert from/to Erlang terms in your Python script, you can use a library like https://github.com/skosch/python-erlastic (a fork I maintain, the original project was abandoned).