use_python() not working

reticulate

#1

Anyone found a work around for this? All of my modules are in python3.5 so I can't access them in R.

> use_python("/usr/local/lib/python3.5", required = T) 
> py_config() 
python: /usr/bin/python
libpython: /usr/lib/python2.7/config-x86_64-linux-gnu/libpython2.7.so 
pythonhome: /usr:/usr 
version: 2.7.12 (default, Nov 12 2018, 14:36:49) [GCC 5.4.0 20160609] 
numpy: [NOT FOUND] 

NOTE: Python version was forced by use_python function

#2

So, in python, I have:

>>> print(sys.path) 
['', '/usr/lib/python35.zip',
 '/usr/lib/python3.5',
 '/usr/lib/python3.5/plat-x86_64-linux-gnu', 
'/usr/lib/python3.5/lib-dynload',
 '/home/gwynn/.local/lib/python3.5/site-packages',
 '/usr/local/lib/python3.5/dist-packages',
 '/usr/lib/python3/dist-packages']

It looks like the path to the python I'm using is /usr/lib/python3.5, so I used this directory, and reticulate could not find python.

> use_python("/usr/lib/python3.5", required = T)
> py_config()
sh: 1: /usr/lib/python3.5/python: not found
Error in system2(command = python, args = paste0("\"", config_script,  : 
  error in running command

So I thought if I gave it the path ' /usr/lib' it would find python3.5, but I was mistaken.

> use_python("/usr/lib", required = T)
> py_config()
sh: 1: /usr/lib/python: not found
Error in system2(command = python, args = paste0("\"", config_script,  : 
  error in running command

Is it possible to access python3.5 using reticulate? It seems not.

That is where all of my modules are imported, and I'd like to access them along with other coding in R.


#3

Apparently https://conda.io/miniconda.html fixes this!

No, it did not fix my problem.

Yes, it did!


#4

I found a way to install modules in python and have reticulate find them:

  1. Install miniconda

  2. I used this command to find where miniconda was installed:
    $ find ~ -type d -iname mini*
    resulted in this:
    /home/gwynn/.mozilla/firefox/6buoq64a.default/minidumps
    /home/gwynn/miniconda

  3. From here I set the path
    export PATH=/home/gwynn/miniconda/bin:$PATH

  4. Then used this command to install modules:
    conda install scikit-learn(the package name)

  5. I restarted my computer and reticulate was able to find the packages.

Unfortunately, I still got an error running the file in reticulate, but this seemed to be a reticulate issue and I'm unable to copy it here. I was trying to recreate this: https://blog.conceptnet.io/posts/2017/how-to-make-a-racist-ai-without-really-trying/


#5

Additionally, I also needed to re-run

every time I restart my computer