Conda build R package fails at C compiler issue on MacOS Mojave

前端 未结 2 1491

I\'m trying to install an R package called treatSens with conda to use it in Jupyter notebook. The commands I executed:

conda install conda-build conda skeleto

相关标签:
2条回答
  • 2020-12-18 14:32

    As a quick and dirty workaround (from this comment), I was able to install packages in R using below code in RStudio (opened in conda env)

    Sys.setenv(CONDA_BUILD_SYSROOT="/")
    

    Now, you can install any R package via RStudio Console e.g.

    install.packages("tidyverse")
    

    Hope this helps.

    0 讨论(0)
  • 2020-12-18 14:54

    There are several things you must do to get things building properly in MacOS Mojave. For reasons mysterious to me, the Anaconda folks are not keen to make this smooth, which is especially maddening for those of us who use esoteric R packages. I will write what seems current as of 2019-04-20:

    1. Install Xcode (v10.2.1)

    2. Install headers in the place open source tends to expect finding them. From the command line:

    open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg
    

    3. Install the command-line tools

    • As a belt-and braces approach, I downloaded and installed the DMG Command_Line_Tools_macOS_10.14_for_Xcode_10.2.1 from https://developer.apple.com/download/more/
    • I believe this is also what is done by xcode-select --install. If you run that command (once the tools are installed), you should see the message
    xcode-select: error: command line tools are already installed, use "Software Update" to install updates
    

    4. Download a copy of older MacOS SDK files. For example, from here

    5. Create a directory /opt

    sudo mkdir /opt
    

    6. Copy the SDK files there

    sudo cp -r ~/Downloads/MacOSX10.9.sdk /opt/
    
    sudo chmod -R a+rX /opt
    

    7. Create a conda_build_config.yaml file that will be referenced by Conda-build and related software. It should contain the following

    macos_min_version:
      - 10.9
    macos_machine:
      - x86_64-apple-darwin13.4.0
    MACOSX_DEPLOYMENT_TARGET:
      - 10.9
    CONDA_BUILD_SYSROOT:            # [osx]
      - /opt/MacOSX10.9.sdk          # [osx]
    

    In a terminal you can do that with:

    mkdir ~/.conda || echo 'Dir already present'
    echo "macos_min_version:" >> ~/.conda/conda_build_config.yaml
    echo "  - 10.9" >> ~/.conda/conda_build_config.yaml
    echo "macos_machine:" >> ~/.conda/conda_build_config.yaml
    echo "  - x86_64-apple-darwin13.4.0" >> ~/.conda/conda_build_config.yaml
    echo "MACOSX_DEPLOYMENT_TARGET:" >> ~/.conda/conda_build_config.yaml
    echo "  - 10.9" >> ~/.conda/conda_build_config.yaml
    echo "CONDA_BUILD_SYSROOT:" >> ~/.conda/conda_build_config.yaml
    echo "  - /opt/MacOSX10.9.sdk" >> ~/.conda/conda_build_config.yaml
    

    8. Tell Conda about your YAML file via your .condarc. It should contain the lines:

    conda_build:   
      config_file: ~/.conda/conda_build_config.yaml
    

    which can be accomplished using

    echo "conda_build:" >> ~/.condarc
    echo "  config_file: ~/.conda/conda_build_config.yaml" >> ~/.condarc
    
    0 讨论(0)
提交回复
热议问题