I am trying to use functions from the openturns Python package from R. I believe it should be possible to install and import Python packages using the R-package reticulate , but it does not seem to work for openturns . It seems to work fine for other packages (such as scipy , numpy and pandas ), but I can’t get it to work with openturns . Installing the package seems to work fine but I get an error message when I try to import it. This is what I am doing:
library(reticulate)
use_condaenv("C:/AppsM/Anaconda/")
import("numpy")
Module(numpy)
import("openturns")
Error in py_module_import(module, convert = convert) :
ImportError: DLL load failed while importing _common: La procédure spécifiée est introuvable.
Thank you for your answer Michaël. Nevertheless, using Anaconda Spyder (Windows), I have no problem to install and import OpenTURNS. This works fine.
My problem arises when I try to install and import OpenTURNS using the R-package reticulate that allows to call Python from R (Interface to Python • reticulate). Then, it works for other packages (Scipy, Numpy and Pandas) but not for OpenTURNS with the following error message:
ImportError: DLL load failed while importing _common: La procédure spécifiée est introuvable.
Did you try to use the suggested pip command? I am not sure that my message was accurate enough. According to @schueller : "this is due to a conflict with numpy (and scipy) mingw runtime" . This is not related to Spyder.
Do you have multiple Python distributions on the system? This may explain why loading OpenTURNS fails from R (which may use the Python distribution A), while you can at the same time load if from Python distribution B. Hence, if the effect of the pip install numpy --force-reinstall --no-deps command is to fix the install in distribution B, this has no effect of install A.
To check this, you can do as follows:
from the base Python environment, print the python, numpy and scipy versions ;