ropensci / rdataretriever

R interface to the Data Retriever
https://docs.ropensci.org/rdataretriever
Other
44 stars 21 forks source link

Error loading rdataretriever on mac OSX #200

Closed gdicecco closed 4 years ago

gdicecco commented 5 years ago

Loading reticulate seemed to work, but could not subsequently call rdataretriever functions:

> library(reticulate)
> use_condaenv("r-reticulate", require =TRUE)
> library(rdataretriever)
Warning messages:
1: In if (utils::file_test("-d", python)) python <- file.path(python,  :
  the condition has length > 1 and only the first element will be used
2: In system2(command = python, args = paste0("\"", config_script,  :
  running command ''/miniconda3/envs/r-reticulate/bin/python' '/Users/gracedicecco/Library/r-miniconda/envs/r-reticulate/bin/python' "/Library/Frameworks/R.framework/Versions/3.6/Resources/library/reticulate/config/config.py" 2>/dev/null' had status 1
> sessionInfo()
R version 3.6.1 (2019-07-05)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Mojave 10.14.6

Matrix products: default
BLAS:   /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libRlapack.dylib

Random number generation:
 RNG:     Mersenne-Twister 
 Normal:  Inversion 
 Sample:  Rounding 

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] rdataretriever_2.0.0 reticulate_1.13     

loaded via a namespace (and not attached):
[1] compiler_3.6.1  Matrix_1.2-17   tools_3.6.1     Rcpp_1.0.2      grid_3.6.1      jsonlite_1.6    lattice_0.20-38
> rdataretriever::datasets()
Error in python_config(python_version, required_module, python_version,  : 
  Error 1 occurred running /miniconda3/envs/r-reticulate/bin/python/Users/gracedicecco/Library/r-miniconda/envs/r-reticulate/bin/python 
In addition: Warning messages:
1: In if (utils::file_test("-d", python)) python <- file.path(python,  :
  the condition has length > 1 and only the first element will be used
2: In system2(command = python, args = paste0("\"", config_script,  :
  running command ''/miniconda3/envs/r-reticulate/bin/python' '/Users/gracedicecco/Library/r-miniconda/envs/r-reticulate/bin/python' "/Library/Frameworks/R.framework/Versions/3.6/Resources/library/reticulate/config/config.py" 2>/dev/null' had status 1
3: In if (utils::file_test("-d", python)) python <- file.path(python,  :
  the condition has length > 1 and only the first element will be used
4: In system2(command = python, args = paste0("\"", config_script,  :
  running command ''/miniconda3/envs/r-reticulate/bin/python' '/Users/gracedicecco/Library/r-miniconda/envs/r-reticulate/bin/python' "/Library/Frameworks/R.framework/Versions/3.6/Resources/library/reticulate/config/config.py" 2>/dev/null' had status 1
> 
ha0ye commented 4 years ago

Error in python_config(python_version, required_module, python_version, : Error 1 occurred running /miniconda3/envs/r-reticulate/bin/python/Users/gracedicecco/Library/r-miniconda/envs/r-reticulate/bin/python

This looks like something might be off with how reticulate speaks to your python configuration.

Can you try the following in a fresh R session and report back the results?

library(reticulate)
use_condaenv("r-reticulate", required =TRUE)
py_config()
ethanwhite commented 4 years ago

@gdicecco - terribly sorry this got lost in the fall and thanks to @ha0ye for jumping in.

Thanks to improvements in the package we use for interfacing with Python we've been able to improve and simplify the installation process. If you have a few minutes to give them a try and see if they fix things for you they are available here: https://github.com/ropensci/rdataretriever#basic-installation

gdicecco commented 4 years ago

The new installation process works great, thanks @ethanwhite!

One note which may or may not be useful to you is that I had to clear out the /.retriever directory from my previous installation attempt in order to successfully update some existing datasets. Originally a bunch of datasets that had been downloaded before could not update and then those problem datasets didn't appear when I called rdataretriever::datasets(). Simply removing /.retriever and anything inside the directory and then redoing the basic installation steps solved the problem.

Below are the errors I got on the first try of the basic installation instructions, before clearing /.retriever and starting over: `> rdataretriever::get_updates() # Update the available datasets Please wait while the retriever updates its scripts, ... Failed to load script: aquatic_animal_excretion (/Users/gracedicecco/.retriever/scripts/) Exception: cannot import name 'VERSION' Failed to load script: vertnet_mammals (/Users/gracedicecco/.retriever/scripts/) Exception: cannot import name 'VERSION' Failed to load script: intertidal_abund_me (/Users/gracedicecco/.retriever/scripts/) Exception: cannot import name 'open_fr' Failed to load script: vertnet_fishes (/Users/gracedicecco/.retriever/scripts/) Exception: cannot import name 'VERSION' Failed to load script: breed_bird_survey (/Users/gracedicecco/.retriever/scripts/) Exception: cannot import name 'HOME_DIR' Failed to load script: predator_prey_size_marine (/Users/gracedicecco/.retriever/scripts/) Exception: cannot import name 'VERSION' Failed to load script: tree_demog_wghats (/Users/gracedicecco/.retriever/scripts/) Exception: cannot import name 'VERSION' Failed to load script: vertnet (/Users/gracedicecco/.retriever/scripts/) Exception: cannot import name 'VERSION' Failed to load script: vertnet_reptiles (/Users/gracedicecco/.retriever/scripts/) Exception: cannot import name 'VERSION' Failed to load script: vertnet_amphibians (/Users/gracedicecco/.retriever/scripts/) Exception: cannot import name 'VERSION' Failed to load script: forest_plots_wghats (/Users/gracedicecco/.retriever/scripts/) Exception: cannot import name 'VERSION' Failed to load script: predicts (/Users/gracedicecco/.retriever/scripts/) Exception: cannot import name 'VERSION' Failed to load script: plant_life_hist_eu (/Users/gracedicecco/.retriever/scripts/) Exception: cannot import name 'HOME_DIR' Failed to load script: forest_inventory_analysis (/Users/gracedicecco/.retriever/scripts/) Exception: cannot import name 'open_fr' Failed to load script: wood_density (/Users/gracedicecco/.retriever/scripts/) Exception: cannot import name 'HOME_DIR' Failed to load script: pantheria (/Users/gracedicecco/.retriever/scripts/) Exception: cannot import name 'VERSION' Failed to load script: breed_bird_survey_50stop (/Users/gracedicecco/.retriever/scripts/) Exception: cannot import name 'HOME_DIR' Failed to load script: vertnet_birds (/Users/gracedicecco/.retriever/scripts/) Exception: cannot import name 'VERSION' Failed to load script: npn (/Users/gracedicecco/.retriever/scripts/) Exception: cannot import name 'open_fw' Failed to load script: socean_diet_data (/Users/gracedicecco/.retriever/scripts/) Exception: cannot import name 'VERSION' Failed to load script: flensburg_food_web (/Users/gracedicecco/.retriever/scripts/) Exception: cannot import name 'VERSION' Failed to load script: MammalSuperTree (/Users/gracedicecco/.retriever/scripts/) Exception: cannot import name 'VERSION' Failed to load script: biomass_allometry_db (/Users/gracedicecco/.retriever/scripts/) Exception: cannot import name 'VERSION' Failed to load script: amniote_life_hist (/Users/gracedicecco/.retriever/scripts/) Exception: cannot import name 'VERSION' Failed to load script: la_selva_trees (/Users/gracedicecco/.retriever/scripts/) Exception: cannot import name 'VERSION' Failed to load script: prism_climate (/Users/gracedicecco/.retriever/scripts/) Exception: cannot import name 'VERSION' Failed to load script: gentry_forest_transects (/Users/gracedicecco/.retriever/scripts/) Exception: cannot import name 'VERSION' Failed to load script: bioclim (/Users/gracedicecco/.retriever/scripts/) Exception: cannot import name 'VERSION' Downloading scripts: 0%| | 0/103 [00:00<?, ?files/s]Downloading scripts: 1%| | 1/103 [00:00<00:24, 4.13files/s]Downloading scripts: 2%|▏ | 2/103 [00:00<00:24, 4.16files/s]Downloading scripts: 3%|▎ | 3/103 [00:00<00:24, 4.10files/s]Downloading scripts: 5%|▍ | 5/103 [00:01<00:20, 4.73files/s]Downloading scripts: 7%|▋ | 7/103 [00:01<00:18, 5.32files/s]Downloading scripts: 8%|▊ | 8/103 [00:01<00:19, 4.93files/s]Downloading scripts: 10%|▉ | 10/103 [00:01<00:16, 5.65files/s]Downloading scripts: 11%|█ | 11/103 [00:01<00:17, 5.34files/s]Downloading scripts: 12%|█▏ | 12/103 [00:02<00:18, 4.96files/s]Downloading scripts: 13%|█▎ | 13/103 [00:02<00:18, 4.89files/s]Downloading scripts: 14%|█▎ | 14/103 [00:02<00:18, 4.84files/s]Downloading scripts: 17%|█▋ | 17/103 [00:02<00:14, 5.93files/s]Downloading scripts: 17%|█▋ | 18/103 [00:03<00:15, 5.53files/s]Downloading scripts: 18%|█▊ | 19/103 [00:03<00:15, 5.25files/s]Downloading scripts: 19%|█▉ | 20/103 [00:03<00:16, 4.93files/s]Downloading scripts: 20%|██ | 21/103 [00:03<00:16, 4.85files/s]Downloading scripts: 21%|██▏ | 22/103 [00:03<00:16, 4.82files/s]Downloading scripts: 22%|██▏ | 23/103 [00:04<00:16, 4.74files/s]Downloading scripts: 23%|██▎ | 24/103 [00:04<00:16, 4.80files/s]Downloading scripts: 24%|██▍ | 25/103 [00:04<00:16, 4.86files/s]Downloading scripts: 25%|██▌ | 26/103 [00:04<00:15, 5.00files/s]Downloading scripts: 26%|██▌ | 27/103 [00:04<00:15, 4.85files/s]Downloading scripts: 27%|██▋ | 28/103 [00:05<00:16, 4.64files/s]Downloading scripts: 28%|██▊ | 29/103 [00:05<00:15, 4.71files/s]Downloading scripts: 30%|███ | 31/103 [00:05<00:13, 5.51files/s]Downloading scripts: 31%|███ | 32/103 [00:05<00:13, 5.27files/s]Downloading scripts: 33%|███▎ | 34/103 [00:06<00:11, 5.89files/s]Downloading scripts: 35%|███▍ | 36/103 [00:06<00:10, 6.62files/s]Downloading scripts: 36%|███▌ | 37/103 [00:06<00:11, 5.81files/s]Downloading scripts: 38%|███▊ | 39/103 [00:06<00:09, 6.51files/s]Downloading scripts: 39%|███▉ | 40/103 [00:06<00:10, 5.92files/s]Downloading scripts: 40%|███▉ | 41/103 [00:07<00:11, 5.34files/s]Downloading scripts: 41%|████ | 42/103 [00:07<00:11, 5.21files/s]Downloading scripts: 43%|████▎ | 44/103 [00:07<00:09, 6.01files/s]Downloading scripts: 45%|████▍ | 46/103 [00:07<00:08, 6.66files/s]Downloading scripts: 46%|████▌ | 47/103 [00:08<00:09, 6.02files/s]Downloading scripts: 47%|████▋ | 48/103 [00:08<00:10, 5.02files/s]Downloading scripts: 48%|████▊ | 49/103 [00:08<00:11, 4.81files/s]Downloading scripts: 49%|████▊ | 50/103 [00:08<00:11, 4.61files/s]Downloading scripts: 50%|████▉ | 51/103 [00:08<00:11, 4.46files/s]Downloading scripts: 50%|█████ | 52/103 [00:09<00:11, 4.50files/s]Downloading scripts: 51%|█████▏ | 53/103 [00:09<00:11, 4.54files/s]Downloading scripts: 52%|█████▏ | 54/103 [00:09<00:11, 4.22files/s]Downloading scripts: 53%|█████▎ | 55/103 [00:09<00:11, 4.36files/s]Downloading scripts: 54%|█████▍ | 56/103 [00:10<00:10, 4.50files/s]Downloading scripts: 55%|█████▌ | 57/103 [00:10<00:10, 4.35files/s]Downloading scripts: 56%|█████▋ | 58/103 [00:10<00:10, 4.48files/s]Downloading scripts: 57%|█████▋ | 59/103 [00:10<00:09, 4.49files/s]Downloading scripts: 58%|█████▊ | 60/103 [00:11<00:09, 4.54files/s]Downloading scripts: 59%|█████▉ | 61/103 [00:11<00:09, 4.38files/s]Downloading scripts: 60%|██████ | 62/103 [00:11<00:09, 4.31files/s]Downloading scripts: 61%|██████ | 63/103 [00:11<00:09, 4.02files/s]Downloading scripts: 62%|██████▏ | 64/103 [00:12<00:09, 4.09files/s]Downloading scripts: 63%|██████▎ | 65/103 [00:12<00:09, 4.15files/s]Downloading scripts: 64%|██████▍ | 66/103 [00:12<00:09, 3.93files/s]Downloading scripts: 65%|██████▌ | 67/103 [00:12<00:08, 4.08files/s]Downloading scripts: 67%|██████▋ | 69/103 [00:13<00:07, 4.73files/s]Downloading scripts: 69%|██████▉ | 71/103 [00:13<00:05, 5.50files/s]Downloading scripts: 70%|██████▉ | 72/103 [00:13<00:06, 5.16files/s]Downloading scripts: 71%|███████ | 73/103 [00:13<00:06, 4.96files/s]Downloading scripts: 73%|███████▎ | 75/103 [00:13<00:04, 5.71files/s]Downloading scripts: 74%|███████▍ | 76/103 [00:14<00:04, 5.43files/s]Downloading scripts: 75%|███████▍ | 77/103 [00:14<00:05, 5.14files/s]Downloading scripts: 76%|███████▌ | 78/103 [00:14<00:05, 4.88files/s]Downloading scripts: 77%|███████▋ | 79/103 [00:14<00:05, 4.71files/s]Downloading scripts: 78%|███████▊ | 80/103 [00:15<00:04, 4.72files/s]Downloading scripts: 79%|███████▊ | 81/103 [00:15<00:04, 4.69files/s]Downloading scripts: 83%|████████▎ | 86/103 [00:15<00:02, 6.19files/s]Downloading scripts: 85%|████████▌ | 88/103 [00:15<00:02, 5.58files/s]Downloading scripts: 86%|████████▋ | 89/103 [00:16<00:02, 5.39files/s]Downloading scripts: 87%|████████▋ | 90/103 [00:16<00:02, 5.23files/s]Downloading scripts: 89%|████████▉ | 92/103 [00:16<00:01, 5.98files/s]Downloading scripts: 90%|█████████ | 93/103 [00:16<00:01, 5.45files/s]Downloading scripts: 91%|█████████▏| 94/103 [00:16<00:01, 4.91files/s]Downloading scripts: 99%|█████████▉| 102/103 [00:17<00:00, 6.50files/s]Downloading scripts: 100%|██████████| 103/103 [00:17<00:00, 5.96files/s]

Restarting R session...

Loading required package: raster Loading required package: sp

library(rdataretriever) Failed to load script: aquatic_animal_excretion (/Users/gracedicecco/.retriever/scripts/) Exception: cannot import name 'VERSION' Failed to load script: vertnet_mammals (/Users/gracedicecco/.retriever/scripts/) Exception: cannot import name 'VERSION' Failed to load script: intertidal_abund_me (/Users/gracedicecco/.retriever/scripts/) Exception: cannot import name 'open_fr' Failed to load script: vertnet_fishes (/Users/gracedicecco/.retriever/scripts/) Exception: cannot import name 'VERSION' Failed to load script: breed_bird_survey (/Users/gracedicecco/.retriever/scripts/) Exception: cannot import name 'HOME_DIR' Failed to load script: predator_prey_size_marine (/Users/gracedicecco/.retriever/scripts/) Exception: cannot import name 'VERSION' Failed to load script: tree_demog_wghats (/Users/gracedicecco/.retriever/scripts/) Exception: cannot import name 'VERSION' Failed to load script: vertnet (/Users/gracedicecco/.retriever/scripts/) Exception: cannot import name 'VERSION' Failed to load script: vertnet_reptiles (/Users/gracedicecco/.retriever/scripts/) Exception: cannot import name 'VERSION' Failed to load script: vertnet_amphibians (/Users/gracedicecco/.retriever/scripts/) Exception: cannot import name 'VERSION' Failed to load script: forest_plots_wghats (/Users/gracedicecco/.retriever/scripts/) Exception: cannot import name 'VERSION' Failed to load script: predicts (/Users/gracedicecco/.retriever/scripts/) Exception: cannot import name 'VERSION' Failed to load script: plant_life_hist_eu (/Users/gracedicecco/.retriever/scripts/) Exception: cannot import name 'HOME_DIR' Failed to load script: forest_inventory_analysis (/Users/gracedicecco/.retriever/scripts/) Exception: cannot import name 'open_fr' Failed to load script: wood_density (/Users/gracedicecco/.retriever/scripts/) Exception: cannot import name 'HOME_DIR' Failed to load script: pantheria (/Users/gracedicecco/.retriever/scripts/) Exception: cannot import name 'VERSION' Failed to load script: breed_bird_survey_50stop (/Users/gracedicecco/.retriever/scripts/) Exception: cannot import name 'HOME_DIR' Failed to load script: vertnet_birds (/Users/gracedicecco/.retriever/scripts/) Exception: cannot import name 'VERSION' Failed to load script: npn (/Users/gracedicecco/.retriever/scripts/) Exception: cannot import name 'open_fw' Failed to load script: socean_diet_data (/Users/gracedicecco/.retriever/scripts/) Exception: cannot import name 'VERSION' Failed to load script: flensburg_food_web (/Users/gracedicecco/.retriever/scripts/) Exception: cannot import name 'VERSION' Failed to load script: MammalSuperTree (/Users/gracedicecco/.retriever/scripts/) Exception: cannot import name 'VERSION' Failed to load script: biomass_allometry_db (/Users/gracedicecco/.retriever/scripts/) Exception: cannot import name 'VERSION' Failed to load script: amniote_life_hist (/Users/gracedicecco/.retriever/scripts/) Exception: cannot import name 'VERSION' Failed to load script: la_selva_trees (/Users/gracedicecco/.retriever/scripts/) Exception: cannot import name 'VERSION' Failed to load script: prism_climate (/Users/gracedicecco/.retriever/scripts/) Exception: cannot import name 'VERSION' Failed to load script: gentry_forest_transects (/Users/gracedicecco/.retriever/scripts/) Exception: cannot import name 'VERSION' rdataretriever::datasets() [1] "abalone-age" "acton-lake"
[3] "airports" "antarctic-breed-bird"
[5] "bioclim" "biodiversity-response"
[7] "biotime" "biotimesql"
[9] "bird-migration-data" "bird-size"
[11] "breast-cancer-wi" "breed-bird-survey-nlcd"
[13] "bupa-liver-disorders" "butterfly-population-network"
[15] "car-eval" "catalogos-dados-brasil"
[17] "chytr-disease-distr" "community-abundance-misc"
[19] "croche-vegetation-data" "dicerandra-frutescens"
[21] "ecoregions-us" "elton-traits"
[23] "fao-global-capture-product" "First-flowering dates of plants in the Northern Great Plains" [25] "fish-parasite-hosts" "forest-biomass-china"
[27] "forest-fires-portugal" "forest-plots-michigan"
[29] "fray-jorge-ecology" "gdp"
[31] "globi-interaction" "great-basin-mammal-abundance"
[33] "harvard-forest" "home-ranges"
[35] "iris" "lakecats-final-tables"
[37] "leaf-herbivory" "macroalgal-communities"
[39] "macrocystis-variation" "mammal-community-db"
[41] "mammal-diet" "mammal-life-hist"
[43] "mammal-masses" "mammal-metabolic-rate"
[45] "mammal-super-tree" "mapped-plant-quads-co"
[47] "mapped-plant-quads-id" "mapped-plant-quads-ks"
[49] "mapped-plant-quads-mt" "marine-recruitment-data"
[51] "mediter-basin-plant-traits" "mt-st-helens-veg"
[53] "nd-gain" "nematode-traits"
[55] "ngreatplains-flowering-dates" "nla"
[57] "noaa-fisheries-trade" "nyc-tree-count"
[59] "partners-in-flight" "phytoplankton-size"
[61] "plant-comp-ok" "plant-occur-oosting"
[63] "plant-taxonomy-us" "poker-hands"
[65] "portal" "portal-dev"
[67] "prairie-forest" "predator-prey-body-ratio"
[69] "sonoran-desert" "species-exctinction-rates"
[71] "streamflow-conditions" "transparencia-dados-abertos-brasil"
[73] "tree-canopy-geometries" "turtle-offspring-nesting"
[75] "usgs-elevation" "veg-plots-sdl"
[77] "wine-composition" "wine-quality" `

henrykironde commented 4 years ago

Thanks for the update @gdicecco. We have added a function to manage that. We shall have to run reset() function and parsing "scripts". This will reset the scripts. Then followed by the get_updates(). This will obtain the latest data packages And last, reload_scripts() to load the upgrades

ethanwhite commented 4 years ago

Thanks @gdicecco. Much appreciated. Glad it's working more smoothly now! We have an open issue related to your issue with old scripts and @henrykironde's solution: #111. I'm trying to clear our backlog in the next couple of weeks so hopefully I'll get to implementing something that will check for this and provide useful information to the user on how to fix it.