Custom Block Environment

Modified on Wed, 18 Mar, 2020 at 6:37 PM

Custom Block scripts are executed in specific environments which are described in this document. It is meant as a resource to understand in which way the execution differs from e.g. an execution directly within the terminal, in order to aid in troubleshooting situations.


R

Localisation

When Omniscope starts it tries to find a working R installation. On computers running Windows it will check these keys in the registry whether they contain an InstallPath variable:

  • HKCU\Software\R-core\R64
  • HKCU\Software\R-core\R
  • HKCU\Software\R-core\R64
  • HKLM\Software\R-core\R

On Linux, Omniscope will check in these folders:

  • /usr/local/bin
  • /usr/bin/
  • /bin/

On Mac OS X, Omniscope looks for installations made by downloading R from the Cran website, as well as versions installed via Homebrew:

  • /Library/Frameworks/R.framework/Resources
  • /usr/local/Cellar/r/


If one of the keys or paths points to a folder with an Rscript executable, Omniscope will execute it to derive its version. If multiple installations are present, the one with the highest version is chosen. In case R is installed in a way in which it is impossible for Omniscope to find it, it is possible to enter the path to the folder containing the Rscript executable in the admin section. Note that this will add this particular folder to the list of folders to look for. In case it does not point to the highest version, it will not be chosen.


Execution

R scripts are executed with the Rscript executable. This executable behaves slightly different than when scripts are executed via the R executable. Specifically many packages that are pre-loaded in R, are not in Rscript. Therefore they are attached via

--default-packages base methods stats utils


The PATH environmental variable is left intact, except on Mac OS X in which /usr/local/bin is added to the path to include Homebrew installed binaries to e.g. gfortran compilers



Packages

All R packages used by R scripts within a Custom Block are installed in an internal folder. No globally installed packages are used, i.e. if the package "forecast" is already installed via RStudio, and a Custom Block requires it, it will be installed again in the internal folder. These folders are:

  • Windows: C:\Users\XXXXX\AppData\Local\Visokio (where XXXXX stands for the user running Omniscope)
  • Linux: ~/.visokioappdata/Visokio/R-library
  • Mac OS X: ~/Library/Application Support/Visokio/R-library

In case the location of these folders is impractical, it is possible to redefine where Omniscope installs the packages in the admin section.


Before Omniscope executes a script it scans it and looks for library() and require() statements. These packages are then installed via install.packages(). On Windows, all packages are installed as binary packages. On linux, all packages are build from source, and on Mac OS X, packages are build from source for Mac OS X 10.11 or lower (El-Capitan) and installed as binary packages for everything above 10.11.



Python

Localisation

When Omniscope starts it tries to find a working Python installation. On computers running Windows it will check these keys in the registry whether they contain an InstallPath variable:

  • HKCU\Software\Python\PythonCore
  • HKLM\Software\Python\PythonCore
  • HKCU\Software\WOW6432Node\Python\PythonCore
  • HKLM\Software\WOW6432Node\Python\PythonCore

On Linux, Omniscope will check the /usr/bin folder


On Mac OS X, Omniscope looks for installations made by downloading R from the cran website, as well as versions installed via Homebrew:

  • /usr/local/opt/python3/bin
  • /usr/local/opt/python2/bin
  • /usr/local/bin
  • /usr/bin

If one of the keys or paths points to a folder with a Python executable, Omniscope will execute it to derive its version. If multiple installations with the same version are present only one will be taken. In case Python is installed in a way in which it is impossible for Omniscope to find it, it is possible to enter the path to the folder containing the Python executable in the admin section. 


Packages

Packages that are available to Omniscope are packages that are installed globally, i.e. packages installed via a simple call to pip, and packages that Omniscope has installed. Generally speaking, if a package is already available globally, Omniscope will not install it again - except if the globally installed package has an insufficient version.


Before Omniscope executes a Python script it will check whether or not all dependencies defined in the "Dependencies" block options are fulfilled. In case of simple unversioned dependencies this is done via a check of what packages are already available globally and Omniscope-locally. In case of versioned dependencies, the package is attempted to be installed via pip. In case pip agrees that an already installed packages fulfils the dependency, the installation attempt is aborted automatically.

Packages are installed via python -m pip install XXXXX (where XXXXX stands for the package name). This guarantees that the right pip executable is used for the right python executable.





Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article