Could you run your script as a batch script instead of a spyder dedicated terminal? That way, you will see the actual exception that is causing the BrokenPipeError. The most likely candidate is that you did not enclose the pm.sample inside an if __name__ == "__main__": statement.
Try rerunning with
if __name__ == "__main__":
with basic_model:
trace=pm.sample(5000)