Mazin Abdelghany
2021-Apr-23 01:43 UTC
[R-sig-Debian] Unable to install some R packages in Ubuntu 20.04--internal compiler error: Segmentation fault
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 <edd at debian.org> 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 <file:///usr/share/doc/gcc-9/README.Bugs> 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 <file:///usr/share/doc/gcc-9/README.Bugs> 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 > > Ahhhhhhhhhhhhh. 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 at rob:~$ docker run --rm -ti rocker/r-bspm:20.04 bash > root at 6f02540917d0:/# apt update -qq # refresh indices > 71 packages can be upgraded. Run 'apt list --upgradable' to see them. > root at 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 > > > Fetched 0 B in 0s (0 B/s) > > > Reading package lists... Done > Building dependency tree > Reading state information... Done > Get:1 http://ppa.launchpad.net/c2d4u.team/c2d4u4.0+/ubuntu focal/main > amd64 r-cran-fansi amd64 0.4.2-1cran1.2004.0 [176 kB] > > Get:2 http://ppa.launchpad.net/c2d4u.team/c2d4u4.0+/ubuntu focal/main > amd64 r-cran-utf8 amd64 1.2.1-1cran1.2004.0 [122 kB] > > Fetched 298 kB in 0s (0 B/s) > > > Selecting previously unselected package r-cran-fansi. > (Reading database ... 20588 files and directories currently installed.) > Preparing to unpack .../r-cran-fansi_0.4.2-1cran1.2004.0_amd64.deb ... > Unpacking r-cran-fansi (0.4.2-1cran1.2004.0) ... > Selecting previously unselected package r-cran-utf8. > Preparing to unpack .../r-cran-utf8_1.2.1-1cran1.2004.0_amd64.deb ... > Unpacking r-cran-utf8 (1.2.1-1cran1.2004.0) ... > Setting up r-cran-fansi (0.4.2-1cran1.2004.0) ... > Setting up r-cran-utf8 (1.2.1-1cran1.2004.0) ... > root at 6f02540917d0:/# > > You could do the same via 'sudo apt install r-cran-utf8 r-cran-fansi' > without > 'bspm' if you just set up the PPA. > > Good luck, Dirk > > > > | Output of gcc -v: > | ``` > | Using built-in specs. > | COLLECT_GCC=gcc > | COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/9/lto-wrapper > | OFFLOAD_TARGET_NAMES=nvptx-none:hsa > | OFFLOAD_TARGET_DEFAULT=1 > | Target: x86_64-linux-gnu > | Configured with: ../src/configure -v --with-pkgversion='Ubuntu > | 9.3.0-17ubuntu1~20.04' > | --with-bugurl=file:///usr/share/doc/gcc-9/README.Bugs > | --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,gm2 > | --prefix=/usr --with-gcc-major-version-only --program-suffix=-9 > | --program-prefix=x86_64-linux-gnu- --enable-shared > --enable-linker-build-id > | --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix > | --libdir=/usr/lib --enable-nls --enable-clocale=gnu > | --enable-libstdcxx-debug --enable-libstdcxx-time=yes > | --with-default-libstdcxx-abi=new --enable-gnu-unique-object > | --disable-vtable-verify --enable-plugin --enable-default-pie > | --with-system-zlib --with-target-system-zlib=auto --enable-objc-gc=auto > | --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 > | --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic > | > --enable-offload-targets=nvptx-none=/build/gcc-9-HskZEa/gcc-9-9.3.0/debian/tmp-nvptx/usr,hsa > | --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu > | --host=x86_64-linux-gnu --target=x86_64-linux-gnu > | Thread model: posix > | gcc version 9.3.0 (Ubuntu 9.3.0-17ubuntu1~20.04) > | ``` > | > | Output of sessionInfo() in R: > | ``` > | R version 4.0.5 (2021-03-31) > | Platform: x86_64-pc-linux-gnu (64-bit) > | Running under: Ubuntu 20.04.2 LTS > | > | Matrix products: default > | BLAS: /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3 > | LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/liblapack.so.3 > | > | locale: > | [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C > | LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 > | [5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 > | LC_PAPER=en_US.UTF-8 LC_NAME=C > | [9] LC_ADDRESS=C LC_TELEPHONE=C > | LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C > | > | attached base packages: > | [1] stats graphics grDevices utils datasets methods base > | > | loaded via a namespace (and not attached): > | [1] compiler_4.0.5 tools_4.0.5 > | ``` > | > | Thanks all for your help and advice. > | Best, > | Mazin > | > | [[alternative HTML version deleted]] > | > | _______________________________________________ > | R-SIG-Debian mailing list > | R-SIG-Debian at r-project.org > | https://stat.ethz.ch/mailman/listinfo/r-sig-debian > > -- > https://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org >[[alternative HTML version deleted]]
Dirk Eddelbuettel
2021-Apr-23 03:29 UTC
[R-sig-Debian] Unable to install some R packages in Ubuntu 20.04--internal compiler error: Segmentation fault
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 <edd at debian.org> 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 <file:///usr/share/doc/gcc-9/README.Bugs> 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 <file:///usr/share/doc/gcc-9/README.Bugs> 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 | > | > Ahhhhhhhhhhhhh. 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 at rob:~$ docker run --rm -ti rocker/r-bspm:20.04 bash | > root at 6f02540917d0:/# apt update -qq # refresh indices | > 71 packages can be upgraded. Run 'apt list --upgradable' to see them. | > root at 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 | > | > | > Fetched 0 B in 0s (0 B/s) | > | > | > Reading package lists... Done | > Building dependency tree | > Reading state information... Done | > Get:1 http://ppa.launchpad.net/c2d4u.team/c2d4u4.0+/ubuntu focal/main | > amd64 r-cran-fansi amd64 0.4.2-1cran1.2004.0 [176 kB] | > | > Get:2 http://ppa.launchpad.net/c2d4u.team/c2d4u4.0+/ubuntu focal/main | > amd64 r-cran-utf8 amd64 1.2.1-1cran1.2004.0 [122 kB] | > | > Fetched 298 kB in 0s (0 B/s) | > | > | > Selecting previously unselected package r-cran-fansi. | > (Reading database ... 20588 files and directories currently installed.) | > Preparing to unpack .../r-cran-fansi_0.4.2-1cran1.2004.0_amd64.deb ... | > Unpacking r-cran-fansi (0.4.2-1cran1.2004.0) ... | > Selecting previously unselected package r-cran-utf8. | > Preparing to unpack .../r-cran-utf8_1.2.1-1cran1.2004.0_amd64.deb ... | > Unpacking r-cran-utf8 (1.2.1-1cran1.2004.0) ... | > Setting up r-cran-fansi (0.4.2-1cran1.2004.0) ... | > Setting up r-cran-utf8 (1.2.1-1cran1.2004.0) ... | > root at 6f02540917d0:/# | > | > You could do the same via 'sudo apt install r-cran-utf8 r-cran-fansi' | > without | > 'bspm' if you just set up the PPA. | > | > Good luck, Dirk | > | > | > | > | Output of gcc -v: | > | ``` | > | Using built-in specs. | > | COLLECT_GCC=gcc | > | COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/9/lto-wrapper | > | OFFLOAD_TARGET_NAMES=nvptx-none:hsa | > | OFFLOAD_TARGET_DEFAULT=1 | > | Target: x86_64-linux-gnu | > | Configured with: ../src/configure -v --with-pkgversion='Ubuntu | > | 9.3.0-17ubuntu1~20.04' | > | --with-bugurl=file:///usr/share/doc/gcc-9/README.Bugs | > | --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,gm2 | > | --prefix=/usr --with-gcc-major-version-only --program-suffix=-9 | > | --program-prefix=x86_64-linux-gnu- --enable-shared | > --enable-linker-build-id | > | --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix | > | --libdir=/usr/lib --enable-nls --enable-clocale=gnu | > | --enable-libstdcxx-debug --enable-libstdcxx-time=yes | > | --with-default-libstdcxx-abi=new --enable-gnu-unique-object | > | --disable-vtable-verify --enable-plugin --enable-default-pie | > | --with-system-zlib --with-target-system-zlib=auto --enable-objc-gc=auto | > | --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 | > | --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic | > | | > --enable-offload-targets=nvptx-none=/build/gcc-9-HskZEa/gcc-9-9.3.0/debian/tmp-nvptx/usr,hsa | > | --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu | > | --host=x86_64-linux-gnu --target=x86_64-linux-gnu | > | Thread model: posix | > | gcc version 9.3.0 (Ubuntu 9.3.0-17ubuntu1~20.04) | > | ``` | > | | > | Output of sessionInfo() in R: | > | ``` | > | R version 4.0.5 (2021-03-31) | > | Platform: x86_64-pc-linux-gnu (64-bit) | > | Running under: Ubuntu 20.04.2 LTS | > | | > | Matrix products: default | > | BLAS: /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3 | > | LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/liblapack.so.3 | > | | > | locale: | > | [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C | > | LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 | > | [5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 | > | LC_PAPER=en_US.UTF-8 LC_NAME=C | > | [9] LC_ADDRESS=C LC_TELEPHONE=C | > | LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C | > | | > | attached base packages: | > | [1] stats graphics grDevices utils datasets methods base | > | | > | loaded via a namespace (and not attached): | > | [1] compiler_4.0.5 tools_4.0.5 | > | ``` | > | | > | Thanks all for your help and advice. | > | Best, | > | Mazin | > | | > | [[alternative HTML version deleted]] | > | | > | _______________________________________________ | > | R-SIG-Debian mailing list | > | R-SIG-Debian at r-project.org | > | https://stat.ethz.ch/mailman/listinfo/r-sig-debian | > | > -- | > https://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org | > | | [[alternative HTML version deleted]] | | _______________________________________________ | R-SIG-Debian mailing list | R-SIG-Debian at r-project.org | https://stat.ethz.ch/mailman/listinfo/r-sig-debian -- https://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org