If you are using the {rosettaPTF} package for the first time you will need to have Python installed to obtain the necessary modules. You can set up {reticulate} to install into a virtual or Conda environment. Usually {reticulate} should cover most or all of the setup.
find_python(
envname = NULL,
pypath = NULL,
arcpy_path = getOption("rosettaPTF.arcpy_path")
)
As in reticulate::py_install()
: The name, or full path, of the environment in which Python packages are to be installed. When NULL (the default), the active environment as set by the RETICULATE_PYTHON_ENV variable will be used; if that is unset, then the r-reticulate environment will be used.
Optional: Path to python
executable
Optional: Path to ArcGIS Pro Python installation. For example: "C:/Program Files/ArcGIS/Pro/bin/Python"
. Set as NULL
to prevent use of ArcGIS Pro instance.
character path to python
or NULL
if no suitable environment can be found. The result is stored as the package option rosettaPTF.python_path
.
If you have Python set up correctly you should be able to run reticulate::py_config()
or reticulate::py_discover_config()
and discover your shared library.
A common problem with {reticulate} is not pointing at the correct (or any) python
binary or libpython
shared library. Use reticulate::use_python("/path/to/python", required = TRUE)
to set the path or, alternately, be sure python
can be found on your PATH. {reticulate} has a preference for Python environments that have numpy
installed.
Use reticulate::install_miniconda()
if you'd like to install a Miniconda Python environment. Conda is default on Windows.
For devices with limited ability to install new software that have ArcGIS Pro installed (some USDA computers), this method can look for a Python installation in "C:/Program Files/ArcGIS/Pro/bin/Python/envs/arcgispro-py3"
and Conda executable in "C:/Program Files/ArcGIS/Pro/bin/Python/Scripts"
. The base file path to "Python" directory can be customized using the arcpy_path
argument.
On Linux and OS X you can create a virtual environment using reticulate::virtualenv_create()
. The default environment name will be "r-reticulate"
.
find_python()
#> [1] "/home/runner/.virtualenvs/r-reticulate/bin/python"