Skip to end of banner
Go to start of banner

Deprecated - PythonEmbedInR Developer Bootstrap

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 5 Current »

PythonEmbedInR is one of synapser's dependencies. It's an R package that requires C compilation. 

Mac System Dependencies

  • OpenSSL 
  • wget
Notes:

The easiest instruction I found was to use:

brew install wget

This command will install other wget dependencies including openssl. Don't forget to read the output of the brew command and add openssl to PATH in ~/.bash_profile.

Common errors and fixes:

Mac - libcryto.a not found

Repro

There are 2 ways to repro this problem. In Terminal:

  1. clone the repo
  2. run the following commands:

    cd PythonEmbedInR
    R CMD build .
    R CMD install PythonEmbedInR_0.0.0.tar.gz
  3. error:

    * installing to library ‘/Library/Frameworks/R.framework/Versions/3.5/Resources/library’
    * installing *source* package ‘PythonEmbedInR’ ...
    ./configure: line 32: wget: command not found
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100 19.6M  100 19.6M    0     0  19.5M      0  0:00:01  0:00:01 --:--:-- 19.5M
    Mac specific configuration
    cp: /usr/local/opt/openssl/lib/libcrypto.a: No such file or directory
    ERROR: configuration failed for package ‘PythonEmbedInR’
    * removing ‘/Library/Frameworks/R.framework/Versions/3.5/Resources/library/PythonEmbedInR’
    * restoring previous ‘/Library/Frameworks/R.framework/Versions/3.5/Resources/library/PythonEmbedInR’
    
    

In RStudio:

  1. Open PythonEmbedInR project
  2. Click Install and Restart
  3. Error:

    ==> R CMD INSTALL --no-multiarch --with-keep.source PythonEmbedInR
    
    * installing to library ‘/Library/Frameworks/R.framework/Versions/3.5/Resources/library’
    * installing *source* package ‘PythonEmbedInR’ ...
    ./configure: line 32: wget: command not found
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
      0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0Failed to download https://www.python.org/ftp/python/3.5.3/Python-3.5.3.tgz
      0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
    curl: (77) error setting certificate verify locations:
      CAfile: /Library/Frameworks/R.framework/Versions/3.5/Resources/library/PythonEmbedInR/lib/python3.5/site-packages/pip/_vendor/requests/cacert.pem
      CApath: none
    ERROR: configuration failed for package ‘PythonEmbedInR’
    * removing ‘/Library/Frameworks/R.framework/Versions/3.5/Resources/library/PythonEmbedInR’
    * restoring previous ‘/Library/Frameworks/R.framework/Versions/3.5/Resources/library/PythonEmbedInR’
    
    Exited with status 1.

Fix

Install the Mac System Dependencies listed above.

Local Work Flow

This section captures the process of making changes to the code, write tests, build, install, and run the tests. This section does not include Git practices.

RStudio is great to writing R packages. However, the PythonEmbedInR package requires the code to be compiled in C. When building the package in RStudio, RStudio will drive CPU to 100% for a long period of time. This workflow is optimizing the tools by using syntax highlighting in RStudio for code changes, and Terminal for building (may use up to 35% CPU) and running tests.

Step 1: Add changes to the code base in RStudio (including writing tests)
Step 2: In Terminal:

cd PythonEmbedInR
R CMD build .
R CMD install PythonEmbedInR_0.0.0.tar.gz

Step 3: In R:

setwd(sprintf('%s/tests', getwd()))
source('testthat.R')



  • No labels