Closed ahhurlbert closed 5 years ago
I will let Ethan have a look into this first, he uses it for his classes too
Hey @ahhurlbert - we've been moving away from the installers as part of our shift to using reticulate
over the last year. The idea is to to rely on the core packaging systems while also minimizing the need for R users to think about Python.
Can you take a look at https://github.com/ropensci/rdataretriever#installation and see if this fits the "easy-for-undergrads" bill? Basically it involves running a standard graphically installer for Python and then running the following lines all in R:
install.packages("reticulate")
library(reticulate)
py_available(initialize = TRUE)
py_install("retriever")
install.packages("rdataretriever")
If this isn't simple enough can you let us know what your timeline is and we can chat some more.
This sounds like a great and manageable solution! EXCEPT...
> install.packages("reticulate")
Installing package into ‘C:/Users/hurlbert/Documents/R/win-library/3.5’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.5/reticulate_1.13.zip'
Content type 'application/zip' length 1632573 bytes (1.6 MB)
downloaded 1.6 MB
package ‘reticulate’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\hurlbert\AppData\Local\Temp\Rtmp8YMV3o\downloaded_packages
> library(reticulate)
> py_available(initialize = TRUE)
[1] TRUE
> py_install("retriever")
Collecting package metadata (current_repodata.json): ...working... done
Solving environment: ...working... done
## Package Plan ##
environment location: C:\Users\hurlbert\AppData\Local\CONTIN~1\MINICO~1\envs\r-reticulate
Preparing transaction: ...working... done
Verifying transaction: ...working... done
Executing transaction: ...working... done
==> WARNING: A newer version of conda exists. <==
current version: 4.7.10
latest version: 4.7.12
Please update conda by running
$ conda update -n base -c defaults conda
#
# To activate this environment, use
#
# $ conda activate r-reticulate
#
# To deactivate an active environment, use
#
# $ conda deactivate
Collecting package metadata (current_repodata.json): ...working... done
Solving environment: ...working... done
## Package Plan ##
environment location: C:\Users\hurlbert\AppData\Local\CONTIN~1\MINICO~1\envs\r-reticulate
added / updated specs:
- retriever
The following packages will be downloaded:
package | build
---------------------------|-----------------
argcomplete-1.10.0 | py_0 31 KB conda-forge
asn1crypto-0.24.0 | py36_1003 154 KB conda-forge
atomicwrites-1.3.0 | py_0 9 KB conda-forge
attrs-19.1.0 | py_0 32 KB conda-forge
ca-certificates-2019.9.11 | hecc5488_0 181 KB conda-forge
certifi-2019.9.11 | py36_0 147 KB conda-forge
cffi-1.12.3 | py36hb32ad35_0 219 KB conda-forge
chardet-3.0.4 | py36_1003 209 KB conda-forge
colorama-0.4.1 | py_0 15 KB conda-forge
cryptography-2.7 | py36hb32ad35_0 553 KB conda-forge
future-0.17.1 | py36_1000 697 KB conda-forge
idna-2.8 | py36_1000 132 KB conda-forge
importlib_metadata-0.23 | py36_0 39 KB conda-forge
intel-openmp-2019.4 | 245 1.4 MB
libblas-3.8.0 | 12_mkl 3.5 MB conda-forge
libcblas-3.8.0 | 12_mkl 3.5 MB conda-forge
liblapack-3.8.0 | 12_mkl 3.5 MB conda-forge
mkl-2019.4 | 245 99.2 MB
more-itertools-7.2.0 | py_0 48 KB conda-forge
numpy-1.17.2 | py36hc71023c_0 4.7 MB conda-forge
openssl-1.1.1c | hfa6e2cd_0 4.7 MB conda-forge
packaging-19.2 | py_0 27 KB conda-forge
pandas-0.25.1 | py36he350917_0 9.6 MB conda-forge
pip-19.2.3 | py36_0 1.9 MB conda-forge
pluggy-0.12.0 | py_0 18 KB conda-forge
py-1.8.0 | py_0 65 KB conda-forge
pycparser-2.19 | py36_1 173 KB conda-forge
pymysql-0.9.3 | py_0 41 KB conda-forge
pyopenssl-19.0.0 | py36_0 81 KB conda-forge
pyparsing-2.4.2 | py_0 57 KB conda-forge
pysocks-1.7.1 | py36_0 26 KB conda-forge
pytest-5.1.2 | py36_0 368 KB conda-forge
python-3.6.7 | he025d50_1005 20.7 MB conda-forge
python-dateutil-2.8.0 | py_0 219 KB conda-forge
pytz-2019.2 | py_0 228 KB conda-forge
requests-2.22.0 | py36_1 84 KB conda-forge
retriever-2.4.0 | py_0 54 KB conda-forge
setuptools-41.2.0 | py36_0 656 KB conda-forge
six-1.12.0 | py36_1000 21 KB conda-forge
tqdm-4.36.1 | py_0 43 KB conda-forge
urllib3-1.25.6 | py36_0 160 KB conda-forge
vs2015_runtime-14.16.27012 | hf0eaf9b_0 1.1 MB
wcwidth-0.1.7 | py_1 17 KB conda-forge
wheel-0.33.6 | py36_0 52 KB conda-forge
win_inet_pton-1.1.0 | py36_0 7 KB conda-forge
wincertstore-0.2 | py36_1002 13 KB conda-forge
xlrd-1.2.0 | py_0 108 KB conda-forge
zipp-0.6.0 | py_0 7 KB conda-forge
------------------------------------------------------------
Total: 158.9 MB
The following NEW packages will be INSTALLED:
argcomplete conda-forge/noarch::argcomplete-1.10.0-py_0
asn1crypto conda-forge/win-64::asn1crypto-0.24.0-py36_1003
atomicwrites conda-forge/noarch::atomicwrites-1.3.0-py_0
attrs conda-forge/noarch::attrs-19.1.0-py_0
ca-certificates conda-forge/win-64::ca-certificates-2019.9.11-hecc5488_0
certifi conda-forge/win-64::certifi-2019.9.11-py36_0
cffi conda-forge/win-64::cffi-1.12.3-py36hb32ad35_0
chardet conda-forge/win-64::chardet-3.0.4-py36_1003
colorama conda-forge/noarch::colorama-0.4.1-py_0
cryptography conda-forge/win-64::cryptography-2.7-py36hb32ad35_0
future conda-forge/win-64::future-0.17.1-py36_1000
idna conda-forge/win-64::idna-2.8-py36_1000
importlib_metadata conda-forge/win-64::importlib_metadata-0.23-py36_0
intel-openmp pkgs/main/win-64::intel-openmp-2019.4-245
libblas conda-forge/win-64::libblas-3.8.0-12_mkl
libcblas conda-forge/win-64::libcblas-3.8.0-12_mkl
liblapack conda-forge/win-64::liblapack-3.8.0-12_mkl
mkl pkgs/main/win-64::mkl-2019.4-245
more-itertools conda-forge/noarch::more-itertools-7.2.0-py_0
numpy conda-forge/win-64::numpy-1.17.2-py36hc71023c_0
openssl conda-forge/win-64::openssl-1.1.1c-hfa6e2cd_0
packaging conda-forge/noarch::packaging-19.2-py_0
pandas conda-forge/win-64::pandas-0.25.1-py36he350917_0
pip conda-forge/win-64::pip-19.2.3-py36_0
pluggy conda-forge/noarch::pluggy-0.12.0-py_0
py conda-forge/noarch::py-1.8.0-py_0
pycparser conda-forge/win-64::pycparser-2.19-py36_1
pymysql conda-forge/noarch::pymysql-0.9.3-py_0
pyopenssl conda-forge/win-64::pyopenssl-19.0.0-py36_0
pyparsing conda-forge/noarch::pyparsing-2.4.2-py_0
pysocks conda-forge/win-64::pysocks-1.7.1-py36_0
pytest conda-forge/win-64::pytest-5.1.2-py36_0
python conda-forge/win-64::python-3.6.7-he025d50_1005
python-dateutil conda-forge/noarch::python-dateutil-2.8.0-py_0
pytz conda-forge/noarch::pytz-2019.2-py_0
requests conda-forge/win-64::requests-2.22.0-py36_1
retriever conda-forge/noarch::retriever-2.4.0-py_0
setuptools conda-forge/win-64::setuptools-41.2.0-py36_0
six conda-forge/win-64::six-1.12.0-py36_1000
tqdm conda-forge/noarch::tqdm-4.36.1-py_0
urllib3 conda-forge/win-64::urllib3-1.25.6-py36_0
vc pkgs/main/win-64::vc-14.1-h0510ff6_4
vs2015_runtime pkgs/main/win-64::vs2015_runtime-14.16.27012-hf0eaf9b_0
wcwidth conda-forge/noarch::wcwidth-0.1.7-py_1
wheel conda-forge/win-64::wheel-0.33.6-py36_0
win_inet_pton conda-forge/win-64::win_inet_pton-1.1.0-py36_0
wincertstore conda-forge/win-64::wincertstore-0.2-py36_1002
xlrd conda-forge/noarch::xlrd-1.2.0-py_0
zipp conda-forge/noarch::zipp-0.6.0-py_0
Downloading and Extracting Packages
six-1.12.0 | 21 KB | ########## | 100%
pyopenssl-19.0.0 | 81 KB | ########## | 100%
liblapack-3.8.0 | 3.5 MB | ########## | 100%
pytest-5.1.2 | 368 KB | ########## | 100%
colorama-0.4.1 | 15 KB | ########## | 100%
python-dateutil-2.8. | 219 KB | ########## | 100%
wincertstore-0.2 | 13 KB | ########## | 100%
pandas-0.25.1 | 9.6 MB | ########## | 100%
python-3.6.7 | 20.7 MB | ########## | 100%
certifi-2019.9.11 | 147 KB | ########## | 100%
pip-19.2.3 | 1.9 MB | ########## | 100%
libblas-3.8.0 | 3.5 MB | ########## | 100%
cryptography-2.7 | 553 KB | ########## | 100%
openssl-1.1.1c | 4.7 MB | ########## | 100%
wcwidth-0.1.7 | 17 KB | ########## | 100%
numpy-1.17.2 | 4.7 MB | ########## | 100%
atomicwrites-1.3.0 | 9 KB | ########## | 100%
pymysql-0.9.3 | 41 KB | ########## | 100%
pluggy-0.12.0 | 18 KB | ########## | 100%
more-itertools-7.2.0 | 48 KB | ########## | 100%
packaging-19.2 | 27 KB | ########## | 100%
idna-2.8 | 132 KB | ########## | 100%
requests-2.22.0 | 84 KB | ########## | 100%
zipp-0.6.0 | 7 KB | ########## | 100%
tqdm-4.36.1 | 43 KB | ########## | 100%
future-0.17.1 | 697 KB | ########## | 100%
cffi-1.12.3 | 219 KB | ########## | 100%
ca-certificates-2019 | 181 KB | ########## | 100%
intel-openmp-2019.4 | 1.4 MB | ########## | 100%
pytz-2019.2 | 228 KB | ########## | 100%
pysocks-1.7.1 | 26 KB | ########## | 100%
vs2015_runtime-14.16 | 1.1 MB | ########## | 100%
retriever-2.4.0 | 54 KB | ########## | 100%
asn1crypto-0.24.0 | 154 KB | ########## | 100%
importlib_metadata-0 | 39 KB | ########## | 100%
wheel-0.33.6 | 52 KB | ########## | 100%
xlrd-1.2.0 | 108 KB | ########## | 100%
pycparser-2.19 | 173 KB | ########## | 100%
py-1.8.0 | 65 KB | ########## | 100%
chardet-3.0.4 | 209 KB | ########## | 100%
argcomplete-1.10.0 | 31 KB | ########## | 100%
win_inet_pton-1.1.0 | 7 KB | ########## | 100%
urllib3-1.25.6 | 160 KB | ########## | 100%
pyparsing-2.4.2 | 57 KB | ########## | 100%
libcblas-3.8.0 | 3.5 MB | ########## | 100%
attrs-19.1.0 | 32 KB | ########## | 100%
setuptools-41.2.0 | 656 KB | ########## | 100%
mkl-2019.4 | 99.2 MB | ########## | 100%
Preparing transaction: ...working... done
Verifying transaction: ...working... done
Executing transaction: ...working... done
==> WARNING: A newer version of conda exists. <==
current version: 4.7.10
latest version: 4.7.12
Please update conda by running
$ conda update -n base -c defaults conda
Warning message:
In normalizePath(path.expand(path), winslash, mustWork) :
path[1]="C:\Users\hurlbert\AppData\Local\Continuum\miniconda3\envs\r-reticulate/python.exe": The system cannot find the file specified
> install.packages("rdataretriever")
Installing package into ‘C:/Users/hurlbert/Documents/R/win-library/3.5’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.5/rdataretriever_2.0.0.zip'
Content type 'application/zip' length 51995 bytes (50 KB)
downloaded 50 KB
package ‘rdataretriever’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\hurlbert\AppData\Local\Temp\Rtmp8YMV3o\downloaded_packages
> library(rdataretriever)
> rdataretriever::datasets()
Error in py_module_import(module, convert = convert) :
ModuleNotFoundError: No module named 'retriever'
> sessionInfo()
R version 3.5.3 (2019-03-11)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252 LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] rdataretriever_2.0.0 reticulate_1.13 sp_1.3-1 sf_0.7-7 tmap_2.3
[6] tidyr_0.8.3 scales_1.0.0 rmarkdown_1.12 markdown_0.9 knitr_1.22
[11] lubridate_1.7.4 dplyr_0.8.0.1
loaded via a namespace (and not attached):
[1] Rcpp_1.0.1 lattice_0.20-38 class_7.3-15 assertthat_0.2.1 digest_0.6.18 utf8_1.1.4
[7] mime_0.6 R6_2.4.0 evaluate_0.13 e1071_1.7-2 httr_1.4.0 pillar_1.3.1
[13] rlang_0.3.3 rstudioapi_0.10 raster_3.0-2 Matrix_1.2-15 rgdal_1.4-4 webshot_0.5.1
[19] readr_1.3.1 stringr_1.4.0 htmlwidgets_1.3 munsell_0.5.0 tinytex_0.12 shiny_1.3.2
[25] compiler_3.5.3 httpuv_1.5.1 xfun_0.6 pkgconfig_2.0.2 tmaptools_2.0-2 rgeos_0.5-1
[31] htmltools_0.3.6 tidyselect_0.2.5 tibble_2.1.1 codetools_0.2-16 XML_3.98-1.19 fansi_0.4.0
[37] viridisLite_0.3.0 crayon_1.3.4 later_0.8.0 grid_3.5.3 jsonlite_1.6 lwgeom_0.1-7
[43] xtable_1.8-4 DBI_1.0.0 magrittr_1.5 units_0.6-4 KernSmooth_2.23-15 cli_1.1.0
[49] stringi_1.4.3 promises_1.0.1 leafsync_0.1.0 leaflet_2.0.2 xml2_1.2.0 RColorBrewer_1.1-2
[55] tools_3.5.3 dichromat_2.0-0 glue_1.3.1 purrr_0.3.2 hms_0.4.2 crosstalk_1.0.0
[61] yaml_2.2.0 colorspace_1.4-1 classInt_0.4-1 rvest_0.3.3
Can you try restarting RStudio and see if that fixes things?
If not can you email me so that we can find some time for me to take a look and see what's going on?
The reason the new instructions don't work turns out to be a bug in reticulate
. The latest release does not work properly on Windows because it fails to load its own default r-reticulate
environment.
Upgrading to their development version fixes this, so for now it is necessary to install reticulate
using devtools
.
devtools::install_github('rstudio/reticulate')
Turns out this bug was original reported reported to reticulate
two months ago: https://github.com/rstudio/reticulate/issues/571. I have re-reported it and asked about the possibility of a quick release: https://github.com/rstudio/reticulate/issues/601
@ahhurlbert - from reading in between the lines of that issue it's possible that install Anaconda instead of miniconda will solve the issue. I'm going to test now before I got to bed and see if that will solve the problem for you.
Sadly Anaconda has the same issues. 🤞 for a new release of reticulate
soon.
Closing and replacing with a new issue over in https://github.com/ropensci/rdataretriever
Hi @ethanwhite @henrykironde
It's my annual "trying to get undergrads up and running with Rdataretriever for a class exercise" problem. I want to make it as simple as possible for them to get up and running, and would prefer NOT to assume that they have Python or, in the case of Windows, a special terminal program like Git Bash.
So ideally, they download the installers from data-retriever.org, follow instructions on that page, then
install.packages()
in R and they are off and running. I've tried this on a new Windows machine (i.e. that did not previously have Retriever installed), and ran into problems, maybe PATH related, or maybe just lack-of-Python related (my test machine has no Python installed).In RStudio, I get
Checking from the shell,
which retriever
returns/c/Program Files (x86)/DataRetriever/retriever
, andretriever ls
returnsI'm probably just mis-remembering, but I don't remember telling my students in previous years that they also had to install Python for this to work. I can of course, but it's an extra step that of course can lead to additional troubleshooting in a large class. Can you provide your suggested "easy-for-undergrads" installation steps?
Thanks!