Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error when using reticulate in Rmarkdown #831

Closed
HediaTnani opened this issue Aug 26, 2020 · 6 comments
Closed

error when using reticulate in Rmarkdown #831

HediaTnani opened this issue Aug 26, 2020 · 6 comments

Comments

@HediaTnani
Copy link

Hi,

I'm having this error Error in py_call_impl(callable, dots$args, dots$keywords) : TypeError: use() got an unexpected keyword argument 'warn' when running this code in Rmarkdown

#Import packages
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
df = pd.read_table('../../data.txt',sep='\t',header=(0))
df.describe()

I'm running this chunk before:

library(reticulate)
use_python("/usr/bin/python")

How to solve this error message please?

@kevinushey
Copy link
Collaborator

This is an issue that should be fixed in the development version of reticulate -- can you try upgrading with:

remotes::install_github("rstudio/reticulate")

@pinogl
Copy link

pinogl commented Sep 2, 2020

Hi,
I had the same issue and the upgrade with the development fixed it.
Thank you

@BhuvaneshMurugan
Copy link

Even though After installing the Latest version of Reticulate, the error still apperars

@kevinushey
Copy link
Collaborator

This most likely depends on the version of matplotlib that is installed. This is where we call use():

reticulate/R/knitr-engine.R

Lines 396 to 400 in e7a3111

version <- numeric_version(matplotlib$`__version__`)
if (version < "3.3.0")
matplotlib$use("agg", warn = FALSE, force = TRUE)
else
matplotlib$use("agg", force = TRUE)

@BhuvaneshMurugan, what version of matplotlib do you have installed? Does updating to the latest version resolve things?

@pvsundar
Copy link

Even though After installing the Latest version of Reticulate, the error still apperars

i have the same issue. i am using RStudio 2023.12.0+369 "Ocean Storm" Release (33206f75bd14d07d84753f965eaa24756eda97b7, 2023-12-14) for windows
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) RStudio/2023.12.0+369 Chrome/116.0.5845.190 Electron/26.2.4 Safari/537.36
I am using python 3.11.7
I have reinstalled the latest "reticulate" using:
remotes::install_github("rstudio/reticulate")

Error in py_call_impl():
! NameError: name 'warnings' is not defined
Run reticulate::py_last_error() for details.
Backtrace:

  1. rmarkdown::render(...)
  2. knitr::knit(knit_input, knit_output, envir = envir, quiet = quiet)
  3. knitr:::process_file(text, output)
  4. knitr:::process_group.block(group)
  5. knitr:::call_block(x)
    ...
  6. knitr (local) engine(options)
  7. reticulate::eng_python(options)
  8. reticulate:::py_compile_eval(snippet, compile_mode)
  9. builtins$eval(compiled, globals, locals)
  10. reticulate:::py_call_impl(callable, call_args$unnamed, call_args$named)

@t-kalinowski
Copy link
Member

Hi @pvsundar the error message you're seeing is a little different, and likely unrelated to the original issue (which is fixed already). Can you please open a new issue, ideally with a minimal reproducible example that generates the error?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants