jverzani / gWidgets2tcltk

An R package implementing the gWidgets2 API for the tcltk package
7 stars 2 forks source link

[macOS / Linux] `gWidgets2tcltk` fails to install: `Error in structure(.External(.C_dotTclObjv, objv), class = "tclObj") : [tcl] invalid command name "font".` #19

Open barracuda156 opened 1 year ago

barracuda156 commented 1 year ago
  * installing *source* package ‘gWidgets2tcltk’ ...
  ** package ‘gWidgets2tcltk’ successfully unpacked and MD5 sums checked
  ** using staged installation
  ** R
  ** demo
  ** inst
  ** byte-compile and prepare package for lazy loading
  Warning message:
  In fun(libname, pkgname) :
    no display name and no $DISPLAY environment variable
  Error in structure(.External(.C_dotTclObjv, objv), class = "tclObj") : 
    [tcl] invalid command name "font".

  Error: unable to load R code in package ‘gWidgets2tcltk’
  Execution halted
  ERROR: lazy loading failed for package ‘gWidgets2tcltk’
  * removing ‘/opt/local/var/macports/build/_Users_runner_work_macports-ports_macports-ports_ports_R_R-gWidgets2tcltk/R-gWidgets2tcltk/work/destroot/opt/local/Library/Frameworks/R.framework/Versions/4.3/Resources/library/gWidgets2tcltk’
  Command failed:  cd "/opt/local/var/macports/build/_Users_runner_work_macports-ports_macports-ports_ports_R_R-gWidgets2tcltk/R-gWidgets2tcltk/work/gWidgets2tcltk" && /opt/local/bin/R CMD INSTALL . --library=/opt/local/var/macports/build/_Users_runner_work_macports-ports_macports-ports_ports_R_R-gWidgets2tcltk/R-gWidgets2tcltk/work/destroot/opt/local/Library/Frameworks/R.framework/Versions/4.3/Resources/library 
  Error: Failed to destroot R-gWidgets2tcltk: command execution failed
tdhock commented 9 months ago

I have the same issue on linux/redhat, https://github.com/tdhock/data.table-revdeps/issues/8 is there some way to install without having a working DISPLAY?

tdhock commented 9 months ago

similar to https://github.com/jverzani/gWidgets2tcltk/issues/15 and https://github.com/jverzani/gWidgets2tcltk/issues/14

barracuda156 commented 9 months ago

I have the same issue on linux/redhat

I have modified the title to account for Linux failures.

tdhock commented 9 months ago

to simulate this issue on a linux system, you can unset DISPLAY, for example from the shell:

DISPLAY= ~/R/R-devel/bin/R -e 'install.packages("gWidgets2tcltk")'
tdhock commented 9 months ago

not sure if this is happening in .onLoad or before, maybe one of these lines https://github.com/search?q=repo%3Ajverzani%2FgWidgets2tcltk%20font&type=code

jverzani commented 9 months ago

I can't replicate, but would welcome a PR if there is some workaround found. The correct repository is https://github.com/gwidgets3/gWidgets2tcltk. When I set that up, I should have redirected to there.

tdhock commented 9 months ago

On https://cloud.r-project.org/web/packages/gWidgets2tcltk/ it says that the URL for the package is https://github.com/jverzani/gWidgets2tcltk (not github.com/gwidgets3), please update and turn off the issue tracker for this repo, if this repo is no longer used.

tdhock commented 9 months ago

I can't replicate, but would welcome a PR if there is some workaround found. The correct repository is https://github.com/gwidgets3/gWidgets2tcltk. When I set that up, I should have redirected to there.

can you please share what code you used when you were not able to replicate? and the results you got? is that on linux too?

a work-around for my use case would be to try to set a valid DISPLAY, but I am not sure if that is possible.

tdhock commented 8 months ago

For a work-around on linux, you can try prefixing the install with xvfb-run, which sets up a virtual x windows frame buffer, with a valid DISPLAY, see below. First command without xvfb-run does not work, second command does work.

th798@cn31:~$  ~/R/R-4.3.2/bin/R -e 'install.packages("gWidgets2tcltk")'

R version 4.3.2 (2023-10-31) -- "Eye Holes"
Copyright (C) 2023 The R Foundation for Statistical Computing
Platform: x86_64-pc-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.

> install.packages("gWidgets2tcltk")
trying URL 'http://cloud.r-project.org/src/contrib/gWidgets2tcltk_1.0-8.tar.gz'
Content type 'application/x-gzip' length 511003 bytes (499 KB)
==================================================
downloaded 499 KB

* installing *source* package ‘gWidgets2tcltk’ ...
** package ‘gWidgets2tcltk’ successfully unpacked and MD5 sums checked
** using staged installation
** R
** demo
** inst
** byte-compile and prepare package for lazy loading
Warning message:
no DISPLAY variable so Tk is not available
Error in structure(.External(.C_dotTclObjv, objv), class = "tclObj") :
  [tcl] invalid command name "font".

Error: unable to load R code in package ‘gWidgets2tcltk’
Execution halted
ERROR: lazy loading failed for package ‘gWidgets2tcltk’
* removing ‘/projects/genomic-ml/R/R-4.3.2/library/gWidgets2tcltk’
* restoring previous ‘/projects/genomic-ml/R/R-4.3.2/library/gWidgets2tcltk’

The downloaded source packages are in
        ‘/tmp/th798/7431468/Rtmp5hAvTk/downloaded_packages’
Warning message:
In install.packages("gWidgets2tcltk") :
  installation of package ‘gWidgets2tcltk’ had non-zero exit status
>
>
th798@cn31:~$ xvfb-run ~/R/R-4.3.2/bin/R -e 'install.packages("gWidgets2tcltk")'

R version 4.3.2 (2023-10-31) -- "Eye Holes"
Copyright (C) 2023 The R Foundation for Statistical Computing
Platform: x86_64-pc-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.

> install.packages("gWidgets2tcltk")
trying URL 'http://cloud.r-project.org/src/contrib/gWidgets2tcltk_1.0-8.tar.gz'
Content type 'application/x-gzip' length 511003 bytes (499 KB)
==================================================
downloaded 499 KB

* installing *source* package ‘gWidgets2tcltk’ ...
** package ‘gWidgets2tcltk’ successfully unpacked and MD5 sums checked
** using staged installation
** R
** demo
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded from temporary location
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (gWidgets2tcltk)

The downloaded source packages are in
        ‘/tmp/th798/7431468/RtmpOGCAVu/downloaded_packages’
>
>