Re: [R-sig-Debian] Unable to install some R packages in Ubuntu 20.04--internal compiler error: Segmentation fault

2021-04-23 Thread George N. White III
On Fri, 23 Apr 2021 at 00:29, Dirk Eddelbuettel  wrote:

>
> On 22 April 2021 at 18:43, Mazin Abdelghany wrote:
>
> | [...] Because miniconda is installed on my system, the PATH
> | variable is changed to the below:
> |
> /home/mazin/miniconda3/condabin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
>
> That likely puts a compiler _ahead_ in the path meaning that when R calls a
> compiler to install a package from source it may get _an incompatible_ one.
>
> Which would explain your issues.
>

I agree this is almost certainly the reason building packages fails.  I
have seen this
before (my interests include ocean remote sensing where Python and R are
often used
at different stages in a workflow).   In addition to compilers, there can
be problems with
differing dynamic library and python module versions, or the data files
used by some
libraries.  Some users conclude that "R doesn't work".  Such conflicts,
however, easily
avoided by using an environment manager such as John Furlani's Environment
Modules[1] (has a long history and was included in SGI IRIX64 decades ago)
or the
more recent Lua Mod[2].  Both are available as Ubuntu packages.  There are
others
(see the Wikipedia articles on Environment Modules).

[1] John L. Furlani, Modules: Providing a Flexible User Environment
 *Proceedings of the
Fifth Large Installation Systems Administration Conference (LISA V)*,
pp. 141–152, San Diego, CA, September 30 - October 3, 1991.
[2] https://www.tacc.utexas.edu/research-development/tacc-projects/lmod,
"Modern Scientific Software Management Using EasyBuild and Lmod," M.
Geimer, K. Hoste, and R. McLay, Proceedings of the First International
Workshop on HPC User Support Tools, HUST '14, Nov. 2014.
dx.doi.org/10.1109/HUST.2014.8.

-- 
George N. White III

[[alternative HTML version deleted]]

___
R-SIG-Debian mailing list
R-SIG-Debian@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-debian


Re: [R-sig-Debian] Unable to install some R packages in Ubuntu 20.04--internal compiler error: Segmentation fault

2021-04-22 Thread Dirk Eddelbuettel


On 22 April 2021 at 18:43, Mazin Abdelghany wrote:
|  A few new pieces of information with this feedback:
| 
| First,
| Opening R in the terminal window by running
| R
| And then typing
| install.packages("utf8")
| threw the error that I noted above.
| 
| Running
| sudo apt install r-cran-utf8
| in the terminal works to install the package
| 
| Second,
| I have never used conda to do anything with R. I installed conda as the
| package and environment manager for python, which I use for projects
| outside of R. I checked and my install of miniconda does not contain an R
| installation. Because miniconda is installed on my system, the PATH
| variable is changed to the below:
| 
/home/mazin/miniconda3/condabin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin

That likely puts a compiler _ahead_ in the path meaning that when R calls a
compiler to install a package from source it may get _an incompatible_ one.

Which would explain your issues.
 
| Using Dirk's suggestion, I installed the package bspm, which solved the
| issue for me.
| Running: (1) bspm::enable() within R and then install.packages() worked. I
| then, as written in its documentation, enabled bspm system-wide by default,
| including suppressMessages(bspm::enable()) in the Rprofile.site file.

That is indeed very nice as it gets you _binaries_ so it skips the need for
binaries -- which helps as your ability to create binaries appears to be
brokeb by conda or miniconda.

Dirk

| Thanks all,
| Mazin
| 
| On Mon, Apr 19, 2021 at 11:28 AM Dirk Eddelbuettel  wrote:
| 
| >
| > Hi Mazin,
| >
| > On 19 April 2021 at 10:24, Mazin Abdelghany wrote:
| > | I recently installed R onto my Ubuntu 20.04 install using the
| > instructions
| > | here: https://cran.r-project.org/bin/linux/ubuntu/. R works as expected.
| > |
| > | However, while some packages have installed without issue (e.g.,
| > R.matlab),
| > | there are many packages that have not been able to install. Each failed
| > | install throws a very similar error message. As an example,
| > | install.packages("utf8") throws:
| > | ```
| > | during GIMPLE pass: ccp
| > | as_utf8.c: In function ‘rutf8_as_utf8’:
| > | as_utf8.c:128:1: internal compiler error: Segmentation fault
| > |   128 | }
| > |   | ^
| > | Please submit a full bug report,
| > | with preprocessed source if appropriate.
| > | See  for instructions.
| > | make: *** [/usr/lib/R/etc/Makeconf:172: as_utf8.o] Error 1
| > | ERROR: compilation failed for package ‘utf8’
| > | ```
| >
| > Weird. I have been on Ubuntu for most of its existence, and tend to compile
| > (on my main development machine) all packages directly from CRAN.
| >
| > These packages _definitely_ install normally, so would need some extra
| > details.
| >
| > | As another example, install.packages("fansi") throws:
| > | ```
| > | during GIMPLE pass: ccp
| > | nchar.c: In function ‘FANSI_nzchar’:
| > | nchar.c:85:1: internal compiler error: Segmentation fault
| > |85 | }
| > |   | ^
| > | Please submit a full bug report,
| > | with preprocessed source if appropriate.
| > | See  for instructions.
| > | make: *** [/usr/lib/R/etc/Makeconf:172: nchar.o] Error 1
| > | ERROR: compilation failed for package ‘fansi’
| > | ```
| > |
| > | I have tried reinstalling gcc-9, which has not helped. I had found that
| > the
| > | PATH in Sys.getenv("PATH") was pointing to a miniconda3 install on my
| >
| > Ah. That is extra detail. And ... not a good idea in general.
| >
| > Mixing conda and normal installations is NOT a good idea. You also did not
| > mention above that you switched to conda.
| >
| > | system, so updated that to
| > |
| > 
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/lib/rstudio/bin/postback,
| > | which also has not helped.
| > |
| > | I posted a question to:
| > | https://answers.launchpad.net/ubuntu/+question/696623 and it was
| > suggested
| > | that I use gcc-10 instead of gcc-9. I edited /usr/lib/R/etc/Makeconf and
| > | replaced CC=-std=gnu99 with CC=gcc-10. This resolved the issue and the
| > | packages that were throwing these errors were able to be installed.
| > |
| > | After posting the question to Stackoverflow, it was made clear that this
| > | was not a solution rather an obtuse workaround. It was recommended that I
| > | send the question here for help.
| >
| > As I menionted when you asked on StackOverflow, that was not a good
| > suggestion. The compiler has nothing to do with this but you generally may
| > run into issue mixing conda and normal use.
| >
| > My recommendation and preference would be to stay away from conda -- as I
| > never used (or needed) it. Maybe others can help you with it.
| >
| > If you read the README for Ubuntu and CRAN, check out the hint about the
| > PPA. You can even couple it with the (very clever) 'bspm' package and then
| > _normal R installations will give you binaries_.  Demo in the 

Re: [R-sig-Debian] Unable to install some R packages in Ubuntu 20.04--internal compiler error: Segmentation fault

2021-04-22 Thread Mazin Abdelghany
 A few new pieces of information with this feedback:

First,
Opening R in the terminal window by running
R
And then typing
install.packages("utf8")
threw the error that I noted above.

Running
sudo apt install r-cran-utf8
in the terminal works to install the package

Second,
I have never used conda to do anything with R. I installed conda as the
package and environment manager for python, which I use for projects
outside of R. I checked and my install of miniconda does not contain an R
installation. Because miniconda is installed on my system, the PATH
variable is changed to the below:
/home/mazin/miniconda3/condabin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin

Using Dirk's suggestion, I installed the package bspm, which solved the
issue for me.
Running: (1) bspm::enable() within R and then install.packages() worked. I
then, as written in its documentation, enabled bspm system-wide by default,
including suppressMessages(bspm::enable()) in the Rprofile.site file.

Thanks all,
Mazin

On Mon, Apr 19, 2021 at 11:28 AM Dirk Eddelbuettel  wrote:

>
> Hi Mazin,
>
> On 19 April 2021 at 10:24, Mazin Abdelghany wrote:
> | I recently installed R onto my Ubuntu 20.04 install using the
> instructions
> | here: https://cran.r-project.org/bin/linux/ubuntu/. R works as expected.
> |
> | However, while some packages have installed without issue (e.g.,
> R.matlab),
> | there are many packages that have not been able to install. Each failed
> | install throws a very similar error message. As an example,
> | install.packages("utf8") throws:
> | ```
> | during GIMPLE pass: ccp
> | as_utf8.c: In function ‘rutf8_as_utf8’:
> | as_utf8.c:128:1: internal compiler error: Segmentation fault
> |   128 | }
> |   | ^
> | Please submit a full bug report,
> | with preprocessed source if appropriate.
> | See  for instructions.
> | make: *** [/usr/lib/R/etc/Makeconf:172: as_utf8.o] Error 1
> | ERROR: compilation failed for package ‘utf8’
> | ```
>
> Weird. I have been on Ubuntu for most of its existence, and tend to compile
> (on my main development machine) all packages directly from CRAN.
>
> These packages _definitely_ install normally, so would need some extra
> details.
>
> | As another example, install.packages("fansi") throws:
> | ```
> | during GIMPLE pass: ccp
> | nchar.c: In function ‘FANSI_nzchar’:
> | nchar.c:85:1: internal compiler error: Segmentation fault
> |85 | }
> |   | ^
> | Please submit a full bug report,
> | with preprocessed source if appropriate.
> | See  for instructions.
> | make: *** [/usr/lib/R/etc/Makeconf:172: nchar.o] Error 1
> | ERROR: compilation failed for package ‘fansi’
> | ```
> |
> | I have tried reinstalling gcc-9, which has not helped. I had found that
> the
> | PATH in Sys.getenv("PATH") was pointing to a miniconda3 install on my
>
> Ah. That is extra detail. And ... not a good idea in general.
>
> Mixing conda and normal installations is NOT a good idea. You also did not
> mention above that you switched to conda.
>
> | system, so updated that to
> |
> /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/lib/rstudio/bin/postback,
> | which also has not helped.
> |
> | I posted a question to:
> | https://answers.launchpad.net/ubuntu/+question/696623 and it was
> suggested
> | that I use gcc-10 instead of gcc-9. I edited /usr/lib/R/etc/Makeconf and
> | replaced CC=-std=gnu99 with CC=gcc-10. This resolved the issue and the
> | packages that were throwing these errors were able to be installed.
> |
> | After posting the question to Stackoverflow, it was made clear that this
> | was not a solution rather an obtuse workaround. It was recommended that I
> | send the question here for help.
>
> As I menionted when you asked on StackOverflow, that was not a good
> suggestion. The compiler has nothing to do with this but you generally may
> run into issue mixing conda and normal use.
>
> My recommendation and preference would be to stay away from conda -- as I
> never used (or needed) it. Maybe others can help you with it.
>
> If you read the README for Ubuntu and CRAN, check out the hint about the
> PPA. You can even couple it with the (very clever) 'bspm' package and then
> _normal R installations will give you binaries_.  Demo in the r-bspm:20.04
> container follows:
>
> edd@rob:~$ docker run --rm -ti rocker/r-bspm:20.04 bash
> root@6f02540917d0:/# apt update -qq # refresh indices
> 71 packages can be upgraded. Run 'apt list --upgradable' to see them.
> root@6f02540917d0:/# Rscript -e 'install.packages(c("utf8", "fansi"))'
> Loading required package: utils
> Tracing function "install.packages" in package "utils"
> Install system packages as root...
> Reading package lists... Done
> Building dependency tree
> Reading state information... Done
> Hit http://archive.ubuntu.com/ubuntu focal InRelease
>
>
> Hit http://security.ubuntu.com/ubuntu focal-security InRelease
>
>
> Hit 

Re: [R-sig-Debian] Unable to install some R packages in Ubuntu 20.04--internal compiler error: Segmentation fault

2021-04-19 Thread Dirk Eddelbuettel


Hi Mazin,

On 19 April 2021 at 10:24, Mazin Abdelghany wrote:
| I recently installed R onto my Ubuntu 20.04 install using the instructions
| here: https://cran.r-project.org/bin/linux/ubuntu/. R works as expected.
| 
| However, while some packages have installed without issue (e.g., R.matlab),
| there are many packages that have not been able to install. Each failed
| install throws a very similar error message. As an example,
| install.packages("utf8") throws:
| ```
| during GIMPLE pass: ccp
| as_utf8.c: In function ‘rutf8_as_utf8’:
| as_utf8.c:128:1: internal compiler error: Segmentation fault
|   128 | }
|   | ^
| Please submit a full bug report,
| with preprocessed source if appropriate.
| See  for instructions.
| make: *** [/usr/lib/R/etc/Makeconf:172: as_utf8.o] Error 1
| ERROR: compilation failed for package ‘utf8’
| ```

Weird. I have been on Ubuntu for most of its existence, and tend to compile
(on my main development machine) all packages directly from CRAN.

These packages _definitely_ install normally, so would need some extra
details.

| As another example, install.packages("fansi") throws:
| ```
| during GIMPLE pass: ccp
| nchar.c: In function ‘FANSI_nzchar’:
| nchar.c:85:1: internal compiler error: Segmentation fault
|85 | }
|   | ^
| Please submit a full bug report,
| with preprocessed source if appropriate.
| See  for instructions.
| make: *** [/usr/lib/R/etc/Makeconf:172: nchar.o] Error 1
| ERROR: compilation failed for package ‘fansi’
| ```
| 
| I have tried reinstalling gcc-9, which has not helped. I had found that the
| PATH in Sys.getenv("PATH") was pointing to a miniconda3 install on my

Ah. That is extra detail. And ... not a good idea in general.

Mixing conda and normal installations is NOT a good idea. You also did not
mention above that you switched to conda.

| system, so updated that to
| 
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/lib/rstudio/bin/postback,
| which also has not helped.
| 
| I posted a question to:
| https://answers.launchpad.net/ubuntu/+question/696623 and it was suggested
| that I use gcc-10 instead of gcc-9. I edited /usr/lib/R/etc/Makeconf and
| replaced CC=-std=gnu99 with CC=gcc-10. This resolved the issue and the
| packages that were throwing these errors were able to be installed.
| 
| After posting the question to Stackoverflow, it was made clear that this
| was not a solution rather an obtuse workaround. It was recommended that I
| send the question here for help.

As I menionted when you asked on StackOverflow, that was not a good
suggestion. The compiler has nothing to do with this but you generally may
run into issue mixing conda and normal use.

My recommendation and preference would be to stay away from conda -- as I
never used (or needed) it. Maybe others can help you with it.

If you read the README for Ubuntu and CRAN, check out the hint about the
PPA. You can even couple it with the (very clever) 'bspm' package and then
_normal R installations will give you binaries_.  Demo in the r-bspm:20.04
container follows:

edd@rob:~$ docker run --rm -ti rocker/r-bspm:20.04 bash
root@6f02540917d0:/# apt update -qq # refresh indices
71 packages can be upgraded. Run 'apt list --upgradable' to see them.
root@6f02540917d0:/# Rscript -e 'install.packages(c("utf8", "fansi"))'
Loading required package: utils
Tracing function "install.packages" in package "utils"
Install system packages as root...
Reading package lists... Done
Building dependency tree
Reading state information... Done
Hit http://archive.ubuntu.com/ubuntu focal InRelease

  
Hit http://security.ubuntu.com/ubuntu focal-security InRelease  

  
Hit http://ppa.launchpad.net/c2d4u.team/c2d4u4.0+/ubuntu focal InRelease

  
Hit http://archive.ubuntu.com/ubuntu focal-updates InRelease

  
Hit http://archive.ubuntu.com/ubuntu focal-backports InRelease  

  
Hit http://ppa.launchpad.net/edd/r-4.0/ubuntu focal InRelease   

  
Hit http://ppa.launchpad.net/marutter/rrutter4.0/ubuntu focal InRelease