rstudio / rstudio/reticulate

Issue warning if repl_python() can't find the executable set by use_python()

Open
#352 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
R
Stars
1.8k
Forks
349
Avg merge
5h 13m
Merged PRs (30d)
4

Description

If use_python() was invoked using an invalid path, repl_python() uses whatever python executable it can find instead.

Suggestion: issue a warning stating that the path set by use_python() was not found and that repl_python() is falling back on what it can find. The executable being used is already identified at the start, but the warning will explain why the "wrong" python is being used.


In this examples, python42 is not a valid path, but /usr/bin/python3 is.

Restarting R session...

> library(reticulate)
> use_python("python42")
> reticulate::repl_python()
Python 2.7.12 (/usr/bin/python)
Reticulate 1.10 REPL -- A Python interpreter in R.
>>> import sys
>>> print(sys.executable)
/usr/bin/python
>>> quit

Restarting R session...

> library(reticulate)
> reticulate::repl_python()
Python 2.7.12 (/usr/bin/python)
Reticulate 1.10 REPL -- A Python interpreter in R.
>>> import sys
>>> print(sys.executable)
/usr/bin/python
>>> quit

Restarting R session...

> library(reticulate)
> use_python("/usr/bin/python3")
> reticulate::repl_python()
Python 3.5.2 (/usr/bin/python3)
Reticulate 1.10 REPL -- A Python interpreter in R.
>>> import sys
>>> print(sys.executable)
/usr/bin/python3
>>> quit

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing repl_python() and its use of the executable selected by use_python(). Add a warning when the configured path is unavailable and repl_python() falls back to another executable; verify the behavior against the python42 and /usr/bin/python3 examples in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, r
Domain
cli
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.