Build Synapser

When You install Synapser, You may encounter a similar error:


Execution halted
ERROR: configuration failed for package ‘synapser’
* removing ‘/private/var/folders/2n/xwh21m9s3sq_mhnkbc6n6z_c0000gn/T/RtmpZ47UPP/Rinstf55478c3f09/synapser’

For this error, You can try first remove $HOME.virtualenvs then run the build command again.

Build Synapser when creating vignettes

When you build synapser, you may encounter the following error:


Error: processing vignette 'upload.Rmd' failed with diagnostics:
No credentials provided.
--- failed re-building ‘upload.Rmd’

First, create a file named .synapseConfig in your home directory. Then add the following lines to the file:

authtoken = <authtoken>

Now, you should be able to build Synapser.

Using Synapser with reticulate

Synapser is compatible with reticulate and the two packages can be used together in the same R session.

If you are getting this kind error:

Error in value[[3L]](cond) : 'concreteType'

As of synapser v2.0.0, it is still only compatible with reticulate v1.28 due to a miscellaneous update in reticulate v1.29. Specifically, py_to_r() now succeeds when converting subtypes of the built-in Python types (e.g. list, dict, str). Please install reticulate v1.28.


As a workaround, if you wish to communicate with Synapse in an R session that also uses reticulate, you can use the Synapse Python client direclty through reticulate.

Type Conversions

The core of the Synapser library is the python client. Reticulate is used to translate R to Python and back.

These are the documented conversions from R to Python: Reticulate Type Conversions

NA values in R do not have a direct equivalent in Python. This has been a topic of great discussion. Synapser is not trying to solve this. NA values in R are handled by Reticulate per the implementation defined in Reticulate.

When working with R and Reticulate, NA values in types tables are converted by Reticulate depending on the data type.

For numeric data types, NA values are converted to the corresponding R value NA_real_. For integer data types, NA values are converted to NA_integer_. For logical data types, NA values are converted to NA_logical_. For character data types, NA values are converted to NA_character_.

In addition, Reticulate also converts any values that cannot be coerced to the specified data type to NA_character_.

Reticulate performs these conversions automatically.

When Reticulate converts R objects to Python objects, the NA values in R types tables are converted to Python’s None.

R’s NA is a logical constant of length 1 which is used to represent the absence of a value. In Python, the equivalent of NA is None, which is a special constant used to indicate the absence of a value.

Reticulate automatically converts NA values in R types tables to None when converting R objects to Python. This ensures that the data types and values remain consistent between the two languages.


  • Reticulate converts logical NAs to Python True, which convert back to TRUE in R
na_logical = NA
## [1] "logical"
na_py <- reticulate::r_to_py(na_logical)
## True
na_r <- reticulate::py_to_r(na_py)
## [1] TRUE
na_logical = c(T, F, NA)
## [1] "logical"
na_py <- reticulate::r_to_py(na_logical)
## [True, False, True]
na_r <- reticulate::py_to_r(na_py)
  • Reticulate converts character NAs to Python strings, which convert back to characters in R
na_char = c("T", "F", NA)
## [1] "character"
na_py <- reticulate::r_to_py(na_char)
## ['T', 'F', 'NA']
na_r <- reticulate::py_to_r(na_py)
## [1] "T"  "F"  "NA"
  • Reticulate converts numeric NAs to Python np.nan, which convert back to NA in R
na_num = c(1538006762583, 1538006762584, NA)
## [1] "numeric"
na_py <- reticulate::r_to_py(na_num)
## [1538006762583.0, 1538006762584.0, nan]
na_r <- reticulate::py_to_r(na_py)
## [1] 1.538007e+12 1.538007e+12           NA