-
Notifications
You must be signed in to change notification settings - Fork 327
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
Pymc3 model fails to compile using reticulate, possibly related to m1 (apple silicon) #1014
Comments
Do you have macOS command line tools installed? (What is the output of |
Yup - I have fully functional R and python installations. From R I can compile R packages and Stan models. From Python I can compile python packages via pip and Pymc3 models.
|
Can you also confirm the output of
may also help. (An alternate way to accomplish the same is to set the If that still doesn't help, then I'm not really sure what the issue could be beyond some kind of Anaconda incompatibility with arm64 macOS... (It would be worth trialing with a plain Python virtual environment, independent of Anaconda.) |
The xcode path was already set as:
I don't think this can be an issue of anaconda not being compatible with arm64, since all of this runs perfectly from the same conda environment from within jupyter. It seems to me the issue has to be that reticulate, for whatever reason, perhaps because of something rstudio is doing in launching reticulate, doesn't match the environment aesara is expecting. Calling This may be naive, but is it possible that conda is executing the scripts under |
Ah, you're probably right. When RStudio binds to an Anaconda Python installation, we don't run the associated activate script, so we don't pick up on the environment variables that would normally be set in those cases. |
Am I mistaken that that's going to be a pretty big issue? I think it breaks any conda package that depends on clang (pymc3, pystan?, tensorflow?, pytorch?, custom cython code?). Is it your thinking that this is confined to conda but the same packages should function properly in a virtualenv? |
FYI - something similar seems to happen with venv and virtualenv. The script runs fine from the console. From reticulate, however, I get a different compilation error:
|
Uh oh. I'm about to try and wrap my PyMC python code for some biostatisticians R users, hopefully using reticulate, and I'm seeing this open issue and dreading the next few days... @elbamos @kevinushey , have you ever had any luck solving this in the last 2 years, by any chance, before I run into the minefield? ;-) |
@jucor Many conda-compilation related issues go away, or change shape, in the moving landscape. If you run into problems please open a new issue and we'll do what we can to help. For minimizing risk of compilation/installation hurdles like this one, try use a venv if possible. You might also try something like this for pre-compiled binaries: Sys.setenv(PIP_INDEX_URL = "https://packagemanager.posit.co/pypi/latest/simple")
reticulate::py_install(...) |
Thank you, makes a lot of sense! I have used conda-forge for scientific packages for the last few years as they solved better than pip the dependencies on external scientific libraries (like lapack, blas, sundials, cvode, etc). Maybe that has changed? (I haven't tried pip as main tool in years) |
Hi @t-kalinowski and @kevinushey Is there any way we could pick up the environment variables that Indeed, I'm exploding on the same landlmine as @elbamos : pyMC failing to compile using reticulate on macOS. See the minimum reproducible example attached And unfortunately, while reticulate recommends venv, pyMC strongly recommends conda (and I can't get it to work with venv), so I'm really stuck. Thanks for any help! |
I found a workaround by filling the SDKROOT variable, which if (Sys.info()['sysname'] == 'Darwin') {
sdk_root=system2("xcrun", args="--show-sdk-path", stdout=TRUE, stderr=TRUE)
Sys.setenv(SDKROOT=sdk_root)
} So that helps the minimum example. Not sure how it will handle other issues linked to BLAS conda-env libraries, but I'm not there yet. |
@jucor, thank you for posting back with your solution! If you run into other errors, or want more help with this one, can you please open a new github issue, and include the MRE in the body of the issue instead of as an attachment? |
With pleasure, if you can help me find how to put Rmarkdown blocks in the body of an issue 😅 (the code chunks in it okay havoc with the GitHub parser) |
Flank the Rmd document text with lines containing 4 backticks, like so:
|
Awesome, thanks a lot, I did not know that 4-backticks trick! Will
definitely do next time.
|
The attached file works properly from within Jupyter, but produces a compile error when run from reticulate (1.20) using the same conda environment.
minimum reproducible example: pymc_test.py.zip
The compiler error I'm seeing is:
The text was updated successfully, but these errors were encountered: