python package not available from current channel

I'm trying to use python in the RStudio IDE for the first time, and I'm failing to import a certain python package: pyquadkey2.

library(reticulate)
py_install("pyquadkey2")

PackagesNotFoundError: The following packages are not available from current channels:
Error: one or more Python packages failed to install [error code 1]

Is the issue that the package is not part of the repository that py_install() is set to check, in the same way that an R package on github might not be in CRAN? If so, is there an approach equivalent to using devtools to install from github? Or am I barking up the wrong tree?

This is python in RStudio IDE Day 0 for me.

R version 4.0.2 (2020-06-22)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Catalina 10.15.7

other attached packages:
 [1] reticulate_1.16

I'm getting a bit closer, but still stuck. I followed the steps in this tutorial for preparing the RStudio IDE to use python.

Then I installed several python packages:

pip install pandas geopandas shapely pyquadkey2

which resulted in:

Successfully built pyquadkey2
Successfully installed ... geopandas-0.9.0 pandas-1.3.3 pyquadkey2-0.2.0 shapely-1.7.1

However, when I run from pyquadkey2 import quadkey in a python block in the RStudio IDE, I get:

ModuleNotFoundError: No module named 'pyquadkey2'

> reticulate::py_config()
python:         /Users/epg4/Library/r-miniconda/envs/r-reticulate/bin/python
libpython:      /Users/epg4/Library/r-miniconda/envs/r-reticulate/lib/libpython3.6m.dylib
pythonhome:     /Users/epg4/Library/r-miniconda/envs/r-reticulate:/Users/epg4/Library/r-miniconda/envs/r-reticulate
version:        3.6.10 |Anaconda, Inc.| (default, Mar 25 2020, 18:53:43)  [GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)]
numpy:          /Users/epg4/Library/r-miniconda/envs/r-reticulate/lib/python3.6/site-packages/numpy
numpy_version:  1.19.4

I noticed that the results of py_config() were not showing the virtualenv I created, so I restarted R and retraced my steps. Now when I run py_config() I see that I'm pointing to the virtualenv.

And it works!

The tutorials linked above were very helpful. I did not understand the idea of the virtual environments prior to watching the video and stepping through each command.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.