1

I have been trying to debug this for about 8 hours now and I am getting really frustrated. I can't get reticulate to work and I have followed probably 15 tutorials step by step. I am able to import numpy and matplotlib just fine, but other packages in my environment, such as pandas and seaborn, return an error ImportError: no module named pandas. I just want to use python in R. It shouldn't be this hard. Things I have tried:

  • Creating a new conda environment
  • Creating a new virtual environment
  • Uninstalling and reinstalling R and RStudio
  • Creating an .Renviron and .Rprofile file as suggested here
  • Following this tutorial exactly

Someone please help me. When I run py_config(), this is the output:

Show in New WindowClear OutputExpand/Collapse Output
python:         /usr/bin/python
libpython:      /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config/libpython2.7.dylib
pythonhome:     /System/Library/Frameworks/Python.framework/Versions/2.7:/System/Library/Frameworks/Python.framework/Versions/2.7
version:        2.7.10 (default, Feb 22 2019, 21:17:52)  [GCC 4.2.1 Compatible Apple LLVM 10.0.1 (clang-1001.0.37.14)]
numpy:          /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy
numpy_version:  1.8.0

python versions found: 
 /usr/local/bin/python3
 /usr/bin/python

I don't want to be using python 2.7 I don't think. I tried use_python() to no avail. I am about to give up, is there any last hope? It shouldn't be this hard!

bismo
  • 1,257
  • 1
  • 16
  • 36
  • Apple computers ship with Python 2 (though I wonder if that will change now that Python 2 is officially no longer supported). Perhaps before you do anything with R, first concentrate on getting Python 3 with pandas, numpy etc. running on your machine. See https://docs.python.org/3/using/mac.html – John Coleman Aug 25 '20 at 13:12
  • I do have python3 running on my machine with multiple conda environments. See ```/usr/local/bin/python3``` in the output above @JohnColeman. – bismo Aug 25 '20 at 13:13
  • 1
    There seems to be some sort of consistency problem. Perhaps [this question](https://stackoverflow.com/q/63220597/4996248) will help. I agree that it shouldn't be this hard. – John Coleman Aug 25 '20 at 13:18
  • I've referenced that same question 3 times to no avail. I am so confused. – bismo Aug 25 '20 at 13:21
  • What about [this answer](https://stackoverflow.com/a/58743111/4996248) (using `Sys.setenv(RETICULATE_PYTHON = "/usr/bin/python3")` rather than modifying `.Renviron`) to the question that you linked to? – John Coleman Aug 25 '20 at 13:37
  • Same thing. numpy and matplotlib work, but not pandas or seaborn. py_configure() returns the same output as I list in the original post. – bismo Aug 25 '20 at 13:40

0 Answers0