Sympy changes the random seed

117 Views Asked by At

I am working on a python 3 project where I use deap and sympy. I set the seed to a fixed value after I imported the random module in the main file.py that I execute in order to have a reproductible code. but then I found out that I do not obtain the same results after I run it more than once (deap uses a lot of random numbers), when I tracked the bug I found that it's in the sympy parsing function sympy.parsing.sympy_parser.parse_expr used to transform a string to a sympy expression. I am pretty sure sympy is messing with the random seed but I have no idea how to rectify it. Any suggestions or ideas would be appreciated and let me know if the problem described is clear or not. Thanks!



1

There are 1 best solutions below

0
On

Update: As oscar said, apparently this was a bug that was fixed so all I needed to do was to update sympy to its latest version. If you already have Anaconda and want to update SymPy run the command:

conda update sympy