Python in R – Error: could not find a Python environment for /usr/bin/python

I don’t understand how R handles the Python environment and Python version and keep getting the error Error: could not find a Python environment for /usr/bin/python. I installed Miniconda and created a conda environment in the shell: conda activate r-reticulate Then, in R, I try to install keras (same problem with package tensorflow): library(keras) reticulate::use_condaenv() … Read more

git stderr output can’t pipe

I’m writing a graphical URI handler for git:// links with bash and zenity, and I’m using a zenity ‘text-info’ dialog to show git’s clone output while it’s running, using FIFO piping. The script is about 90 lines long, so I won’t bother posting it here, but here’s the most important lines: git clone “$1” “$target” … Read more

Passing bash variables to a script?

What’s the best way to pass bash variables to a python script. I’d like to do something like the following: $cat test.sh #!/bin/bash foo=”hi” python -c ‘import test; test.printfoo($foo)’ $cat test.py #!/bin/python def printfoo(str): print str When I try running the bash script, I get a syntax error: File “<string>”, line 1 import test; test.printfoo($foo) … Read more

change background and text of strips associated to multiple panels in R / lattice

The following is the example I work on. require(lattice) data(barley) xyplot(yield ~ year | site, data = barley) I want to put different strip color for different sprips and font color is also different optimized with the backgroud color. For example: strip background colors = c(“black”, “green4”, “blue”, “red”, “purple”, “yellow”) font color = c(“white”, … Read more

MemoryError in R while read.xlsx

I am using the following R code (that utilizes the Java parameter to increase memory as well): library(xlsx) options(java.parameters = “-Xmx1g”) library(XLConnect) NiVe <- read.xlsx(“version1.xlsx”,1) The version1.xlsx file is 13 MB in size. I get the following error: Error in .jcall(“RJavaTools”, “Ljava/lang/Object;”, “invokeMethod”, cl, : java.lang.OutOfMemoryError: Java heap space Can someone help? Answer Try to … Read more