rstudio / rstudio/reticulate

import("sys") will change Sys.which("python")

Open
#445 6 comments 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

R version 3.5.2 (2018-12-20) -- "Eggshell Igloo"
Copyright (C) 2018 The R Foundation for Statistical Computing
Platform: x86_64-suse-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

library(reticulate)
Sys.which("python")
python
"/home/jinshan/anaconda3/bin/python"
import("sys")
Module(sys)
Sys.which("python")
python
"/usr/bin/python"

reticulate version 1.11

when I use import_from_path will make no module error, because import_form_path will call import("sys") which will change path, making some module can not be found.

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

Reproduce the behavior in the issue using reticulate 1.11, comparing Sys.which("python") before and after import("sys"). Start by tracing import_from_path and its call to import("sys"); done means importing sys no longer changes Python resolution or causes modules to become unavailable.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, r
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.