[Bioc-devel] Python module "tensorflow_probability" not found

Vincent Carey @tvjc @end|ng |rom ch@nn|ng@h@rv@rd@edu
Tue Jul 4 13:04:34 CEST 2023


Sorry to hear about this.  Our informal outlook on python
interoperation in Bioconductor packages is that
the basilisk discipline should be used.  This allows you to pin
specific versions of all python dependencies
and use python for your R functions from an insulated conda environment.

There is also information about specifying python dependencies in the
DESCRIPTION file at
https://rstudio.github.io/reticulate/articles/python_dependencies.html
 I do not know if our build
system or R CMD install take effective advantage of that approach at this time.

I was surprised to see that my attempt to use reticulate::py_install()
to install tensorflow_probabiliity
on my laptop failed:

'/home/stvjc/.local/share/r-miniconda/bin/conda' 'install' '--yes'
'--prefix' '/home/stvjc/.local/share/r-miniconda/envs/r-reticulate'
'-c' 'conda-forge' 'tensorflow_probability'
Retrieving notices: ...working... done
Collecting package metadata (current_repodata.json): done
Solving environment: unsuccessful initial attempt using frozen solve.
Retrying with flexible solve.
Collecting package metadata (repodata.json): done
Solving environment: unsuccessful initial attempt using frozen solve.
Retrying with flexible solve.

PackagesNotFoundError: The following packages are not available from
current channels:

  - tensorflow_probability

Current channels:

  - https://conda.anaconda.org/conda-forge/linux-64
  - https://conda.anaconda.org/conda-forge/noarch
  - https://repo.anaconda.com/pkgs/main/linux-64
  - https://repo.anaconda.com/pkgs/main/noarch
  - https://repo.anaconda.com/pkgs/r/linux-64
  - https://repo.anaconda.com/pkgs/r/noarch

To search for alternate channels that may provide the conda package you're
looking for, navigate to

    https://anaconda.org

and use the search bar at the top of the page.


Error: one or more Python packages failed to install [error code 1]

Enter a frame number, or 0 to exit

1: py_install("tensorflow_probability")

So the "current channels" used by reticulate in my pretty stock
installation of R/reticulate seem flawed
for this purpose.  I had hoped to write a bit of code that would check
for the desired module and install
it if missing, that you could include in your package.

get_pippath = function() {
   pypath = reticulate::conda_list() |> (\(x)x[x$name=="r-reticulate",])()
   gsub("python$", "pip", pypath$python)
}

check_tfp = function() {
   pippath = get_pippath()
   peek = system(paste0(pippath, " list | grep tensor"), intern=TRUE)
   peek = gsub(" +", " ", peek)
   tfdf = do.call(rbind, lapply(strsplit(peek, " "), function(x)
data.frame(pkg=x[1], version=x[2])))
   "tensorflow_probability" %in% tfdf$pkg
}

install_tfp = function() {
   pippath = get_pippath()
   chk = system(paste(pippath, "install tensorflow_probability"), intern=TRUE)
   chk2 = check_tfp()
   list(sysout=chk, tfp_installed=chk2)
}

The first two functions seem to do what I want, the latter does not.

Suggestion -- read the basilisk vignettes, use it if at all possible.
Certainly we can take
care of this in our build system when the holiday ends, but it would
be great to have the software
arrange the solution when necessary, and I don't see a way to
accomplish this at the moment.



On Tue, Jul 4, 2023 at 5:32 AM Kim Philipp Jablonski
<kim.philipp.jablonski using gmail.com> wrote:
>
> Hello,
>
> The latest builds of my package 'pareg' started failing on BioC 3.17 for
> Linux and macOS but not Windows:
> https://master.bioconductor.org/checkResults/3.17/bioc-LATEST/pareg/nebbiolo1-buildsrc.html
> .
> In both cases, the error messages is "Python module tensorflow_probability
> was not found". This wasn't an issue in earlier releases.
>
> Do you know what the reason for this is and how I can fix it?
> Thanks a lot for your help!
>
> Best regards,
> Kim
>
>         [[alternative HTML version deleted]]
>
> _______________________________________________
> Bioc-devel using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/bioc-devel

-- 
The information in this e-mail is intended only for the ...{{dropped:16}}



More information about the Bioc-devel mailing list