You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You can point pip at your org's mirror by setting an env var like
PIP_INDEX_URL=https://<custom-mirror-url>
or by creating a global pip.conf file with the index-url set. That should work for py_install() and virtualenv_create()/virtualenv_install(), but I'm not sure about install_python().
Thank you! I'm new to Python and hadn't come across any of these options while looking for an answer. This looks promising!
EDIT: the solution offered by @t-kalinowski may be an option, but this is what I ended up doing in case someone finds themselves in a similar situation. I found that Posit mirrors PyPi and isn't blocked by my company's firewall.
system('wget <URL to Miniconda3-latest-Linux-x86_64.sh> -O ~/miniconda.sh') # download latest version of miniconda system('bash ~/miniconda.sh -b -u -p ~/miniconda3') # install miniconda system('rm -rf ~/miniconda.sh') # remove miniconda installer system('~/miniconda3/bin/conda init bash') # activate conda for bash system('~/miniconda3/bin/conda init zsh') # activate conda for zsh
library(reticulate)
# confirm that miniconda is installed conda_list() use_python(<use path returned by conda_list()>)
# use Posit Package Manager instead of PyPi / Python official repo system('pip config set global.index-url https://packagemanager.posit.co/pypi/latest/simple') system('pip config set global.trusted-host packagemanager.posit.co')
py_install("numpy", pip = TRUE) # confirm install is possible now. pip = TRUE is essential!! # NB all Python libraries will be installed to your miniconda environment, so make sure you set the right one with use_python()
# run Python in R np <- import("numpy", convert = TRUE) np1 <- np$array(c(1:4)) np1
My org blocks https://www.python.org/ftp/python so reticulate commands like install_python() and py_install() fail since they're hitting https://www.python.org/ftp/python by default.
We have internal mirrors for all of the sources but I don't see any mention in the reticulate MAN for how to define alternate sources / mirrors
The text was updated successfully, but these errors were encountered: