-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SymPy integration #89
Comments
The problem with this is that adding reticulate to allow SymPy usage means that the R package can't be called from python. This is discussed on the RxODE issue here: nlmixrdevelopment/RxODE#170 (comment) Is there any way to make this a suggests instead of a dependency so that my python users can call the R package with |
I think yes - reticulate and sympy stuff should be optional and there should be option to disable them. |
I think that would be great. Thank you for your accommodation. |
@rikardn do you know if the calling of |
@mattfidler Also I think loading reticulate package itself doesn't automatically initialize the python session. If we avoid initializing the python session ourselves I think it should be okay. |
Thanks @Marlin-Na, good to know. |
@mattfidler If I remember correctly my python script that called nlmixr froze/crashed the python console only when nlmixr was calling python. But I didn't test much more than one estimation. Another way of calling nlmixr from python would of course be to not use rpy2 and to do command line calls instead. That should always work. I would of course be grateful if you could isolate the parts needing python so that rpy2 could be used. Just out of curiosity: how general are the functions that you want to integrate? |
@rikardn In my mind, this is to implement functionalities that are not available yet in the SymEngine C++ library, e.g. integration, simplification. In future, as more functions are implemented in C++, we may replace them with C++ ones. |
@Marlin-Na Ok. Expect it to stay this way for a while since the development of symengine is very slow currently and that no Google summer of code project was announced for symengine this year. |
Thank you for the clarification @rikardn. |
Thanks for doing all this stuff with symengine and SymPy. But I think I must be missing a step to integrate with SymPy. I installed symengine.py from GitHub (although its latest commit did not build so I had to checkout 62a0d89 "Merge pull request #319 from Marlin-Na/pycapsule"). When I run R code like in the OP, it does not seem to have the pycapsule functionality
even though the shared object seems to have the relevant symbols:
Does anyone know what I overlooked? |
We can use SymPy to provide missing functionalities in SymEngine.
Then this provides nice seamless integration through reticulate:
The symengine object in R is first passed to python through pycapsule, then converted to symengine.py object. Thanks to symengine.py's compatibility layer, sympy functions can work on them and the result is seamlessly converted back to R's symengine object.
Related issues: symengine/symengine.py#319, rstudio/reticulate#660
The text was updated successfully, but these errors were encountered: