I deleted all of my R packages and libraries in a lapse of judgement and now I am in a limbo where I cannot either fully uninstall or fully install R Studio


#1

I was trying to figure out why I wasn't able to use fread in R or even pull up its documentation when I was doing it perfectly fine just a moment ago and in sheer frustration, I ended up calling all of its installation directories using libPaths() and deleting all of it, because I couldn't figure out how to uninstall it on Ubuntu. Now, I can't install it by downloading the installation package, nor can I install it using sudo apt-get install r-base-core, nor can I even remove or uninstall it. I made a big mistake. Apparently fread isn't even part of base R or R Studio, so while I still don't know why it was working one second and not the next, I apparently didn't even need to go around deleting it all, even though it gave me a sense of satisfaction.

Can anyone help? How can I get R to work again on my laptop?


#2

Just to clarify some of the "it"s— what happens if you try to download R from here:
https://cran.r-project.org/src/base/R-3/

PS RStudio is just an IDE, (see FAQ below for disambiguation), so first thing's first, figuring out where/how to get R on your system


#3

Okay, I tried installing R according to the instructions. I received a number of error messages after calling make

collect2: error: ld returned 1 exit status
Makefile:145: recipe for target 'R.bin' failed
make[3]: *** [R.bin] Error 1
make[3]: Leaving directory '/home/arta/Downloads/R-3.5.1/src/main'
Makefile:137: recipe for target 'R' failed
make[2]: *** [R] Error 2
make[2]: Leaving directory '/home/arta/Downloads/R-3.5.1/src/main'
Makefile:28: recipe for target 'R' failed
make[1]: *** [R] Error 1
make[1]: Leaving directory '/home/arta/Downloads/R-3.5.1/src'
Makefile:60: recipe for target 'R' failed
make: *** [R] Error 1

re: the difference between R and RStudio, I deleted both; thank you for helping me clarify this


#4

I still cannot install RStudio and still cannot start R in terminal. Here is the error message I get when I try:

$ R
/usr/bin/R: line 238: /usr/lib/R/etc/ldpaths: No such file or directory
ERROR: R_HOME ('/usr/lib/R') not found

#5

collect2: error: ld returned 1 exit status

Is there an error earlier than this one specifying an undefined reference, by chance?


#6

Yes,

/home/arta/Downloads/R-3.5.1/src/main/platform.c:3076: undefined reference to `u_getVersion_58'
/home/arta/Downloads/R-3.5.1/src/main/platform.c:3077: undefined reference to `u_versionToString_58'
util.o: In function `resetICUcollator':
/home/arta/Downloads/R-3.5.1/src/main/util.c:1952: undefined reference to `ucol_close_58'
util.o: In function `do_ICUset':
/home/arta/Downloads/R-3.5.1/src/main/util.c:2030: undefined reference to `ucol_close_58'
/home/arta/Downloads/R-3.5.1/src/main/util.c:2063: undefined reference to `ucol_setStrength_58'
/home/arta/Downloads/R-3.5.1/src/main/util.c:2038: undefined reference to `uloc_setDefault_58'
/home/arta/Downloads/R-3.5.1/src/main/util.c:2042: undefined reference to `ucol_open_58'
/home/arta/Downloads/R-3.5.1/src/main/util.c:2039: undefined reference to `uloc_setDefault_58'
/home/arta/Downloads/R-3.5.1/src/main/util.c:2065: undefined reference to `ucol_setAttribute_58'
util.o: In function `do_ICUget':
/home/arta/Downloads/R-3.5.1/src/main/util.c:2088: undefined reference to `ucol_getLocaleByType_58'
util.o: In function `Rf_Scollate':
/home/arta/Downloads/R-3.5.1/src/main/util.c:2130: undefined reference to `uiter_setUTF8_58'
/home/arta/Downloads/R-3.5.1/src/main/util.c:2131: undefined reference to `uiter_setUTF8_58'
/home/arta/Downloads/R-3.5.1/src/main/util.c:2133: undefined reference to `ucol_strcollIter_58'
/home/arta/Downloads/R-3.5.1/src/main/util.c:2111: undefined reference to `uloc_setDefault_58'
/home/arta/Downloads/R-3.5.1/src/main/util.c:2114: undefined reference to `ucol_open_58'


#7

Ok, so I think this will be helpful…to someone who knows this part of the stack better than I do (which isn't saying much)! :grimacing:

I'm finding vaguely useful material with these error messages, but I'm guessing that there's something a bit more general than the paths I'm going down. I'll keep looking, though.


#8

Okay, thank you. I really wish I didn't act so rashly but this is what happens, I guess.


#9

Do you have the dependencies to build R installed? (Have you built R from source before?)

What do you get if you run something like apt-get build-dep r-base-core?


#10

I once deleted my FORTRAN compiler. :flushed:
No clue how, but, hey, I guess these things happen!


#11

Do you have the dependencies to build R installed? (Have you built R from source before?)

I don't know what that means, unfortunately. I just reinstalled R per Mara's recommendation by downloading one of the R packages above and then calling /.configure followed by make, but I don't know if that did anything, especially since I get the same error message when I try to run R in terminal.

What do you get if you run something like apt-get build-dep r-base-core ?

root@lappy-486:~# apt-get build-dep r-base-core
Reading package lists... Done
E: You must put some 'source' URIs in your sources.list

#12

Interesting. It looks like your list of apt repos got removed. (Or you need to run apt-get update). See the following for a related SO post:

You do need to run make install after you run make in order to install R. If you can share the output from make (or any errors that it produced), that can help determine if the build was successful or not. Otherwise, make install should install the R that you built with ./configure and make. The install location (i.e. where the binary will exist) is dependent on the parameters that you used with ./configure

If you're interested in reading more about the "building R from source" process, you can find information here:

And in the context of RStudio Connnect, but potentially helpful just the same: http://docs.rstudio.com/connect/admin/getting-started.html#r-source


#13
$ make install
make[1]: Entering directory '/home/arta/Downloads/R-3.5.1/m4'
make[1]: Nothing to be done for 'install'.
make[1]: Leaving directory '/home/arta/Downloads/R-3.5.1/m4'
make[1]: Entering directory '/home/arta/Downloads/R-3.5.1/tools'
make[1]: Nothing to be done for 'install'.
make[1]: Leaving directory '/home/arta/Downloads/R-3.5.1/tools'
make[1]: Entering directory '/home/arta/Downloads/R-3.5.1/doc'
installing doc ...
mkdir -p -- /usr/local/lib/R/doc
mkdir: cannot create directory '/usr/local/lib/R/doc': Permission denied
Makefile:104: recipe for target 'installdirs' failed
make[1]: *** [installdirs] Error 1
make[1]: Leaving directory '/home/arta/Downloads/R-3.5.1/doc'
Makefile:95: recipe for target 'install' failed
make: *** [install] Error 1

Above is the result of running make install.

I followed the first link you sent me and enabled the use of source code (at least, that's what I think I did). I then ran sudo apt-get install r-base-core and this was the result:

root@lappy-486:~# sudo apt-get install r-base-core
Reading package lists... Done
Building dependency tree       
Reading state information... Done
r-base-core is already the newest version (3.4.4-1ubuntu1).
0 upgraded, 0 newly installed, 0 to remove and 93 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Setting up install-info (6.5.0.dfsg.1-2) ...
python2: can't open file '=': [Errno 2] No such file or directory
dpkg: error processing package install-info (--configure):
 installed install-info package post-installation script subprocess returned error exit status 2
Errors were encountered while processing:
 install-info
E: Sub-process /usr/bin/dpkg returned an error code (1)

I followed the second link you sent me and ran sudo apt-get build-dep r-base and this was my output:

root@lappy-486:~# sudo apt-get build-dep r-base
Reading package lists... Done
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
  bison fonts-lmodern libbison-dev libcairo-script-interpreter2 libcairo2-dev
  libcurl4-openssl-dev libjbig-dev libmime-charset-perl libpango1.0-dev
  libpixman-1-dev libpotrace0 libptexenc1 libsombok3 libsynctex1 libtexlua52
  libtexluajit2 libtext-unidecode-perl libtiff5-dev libtiffxx5
  libunicode-linebreak-perl libxcb-render0-dev libxcb-shm0-dev libzzip-0-13
  mpack preview-latex-style tcl8.6 tcl8.6-dev tex-common texinfo texlive-base
  texlive-binaries texlive-extra-utils texlive-fonts-extra
  texlive-fonts-recommended texlive-generic-recommended texlive-latex-base
  texlive-latex-extra texlive-latex-recommended texlive-pictures
  texlive-plain-generic tk8.6 tk8.6-dev xvfb
0 upgraded, 43 newly installed, 0 to remove and 93 not upgraded.
1 not fully installed or removed.
Need to get 472 MB of archives.
After this operation, 1,273 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://us.archive.ubuntu.com/ubuntu bionic/main amd64 tex-common all 6.09 [33.0 kB]
Get:2 http://us.archive.ubuntu.com/ubuntu bionic/main amd64 libbison-dev amd64 2:3.0.4.dfsg-1build1 [339 kB]
Get:3 http://us.archive.ubuntu.com/ubuntu bionic/main amd64 bison amd64 2:3.0.4.dfsg-1build1 [266 kB]
Get:4 http://us.archive.ubuntu.com/ubuntu bionic/main amd64 fonts-lmodern all 2.004.5-3 [4,551 kB]
Get:5 http://us.archive.ubuntu.com/ubuntu bionic/main amd64 libcairo-script-interpreter2 amd64 1.15.10-2 [53.4 kB]
Get:6 http://us.archive.ubuntu.com/ubuntu bionic/main amd64 libpixman-1-dev amd64 0.34.0-2 [244 kB]
Get:7 http://us.archive.ubuntu.com/ubuntu bionic/main amd64 libxcb-render0-dev amd64 1.13-1 [18.4 kB]
Get:8 http://us.archive.ubuntu.com/ubuntu bionic/main amd64 libxcb-shm0-dev amd64 1.13-1 [6,676 B]
Get:9 http://us.archive.ubuntu.com/ubuntu bionic/main amd64 libcairo2-dev amd64 1.15.10-2 [626 kB]
Get:10 http://us.archive.ubuntu.com/ubuntu bionic-updates/main amd64 libcurl4-openssl-dev amd64 7.58.0-2ubuntu3.2 [295 kB]
Get:11 http://us.archive.ubuntu.com/ubuntu bionic/universe amd64 libmime-charset-perl all 1.012.2-1 [30.9 kB]
Get:12 http://us.archive.ubuntu.com/ubuntu bionic-updates/main amd64 libpango1.0-dev amd64 1.40.14-1ubuntu0.1 [288 kB]
Get:13 http://us.archive.ubuntu.com/ubuntu bionic/main amd64 libpotrace0 amd64 1.14-2 [17.4 kB]
Get:14 http://us.archive.ubuntu.com/ubuntu bionic/main amd64 libptexenc1 amd64 2017.20170613.44572-8build1 [34.5 kB]
Get:15 http://us.archive.ubuntu.com/ubuntu bionic/universe amd64 libsombok3 amd64 2.4.0-1 [27.2 kB]
Get:16 http://us.archive.ubuntu.com/ubuntu bionic/main amd64 libsynctex1 amd64 2017.20170613.44572-8build1 [41.3 kB]
Get:17 http://us.archive.ubuntu.com/ubuntu bionic/main amd64 libtexlua52 amd64 2017.20170613.44572-8build1 [91.0 kB]
Get:18 http://us.archive.ubuntu.com/ubuntu bionic/main amd64 libtexluajit2 amd64 2017.20170613.44572-8build1 [230 kB]
Get:19 http://us.archive.ubuntu.com/ubuntu bionic/universe amd64 libtext-unidecode-perl all 1.30-1 [99.0 kB]
Get:20 http://us.archive.ubuntu.com/ubuntu bionic/main amd64 libjbig-dev amd64 2.1-3.1build1 [25.2 kB]
Get:21 http://us.archive.ubuntu.com/ubuntu bionic/main amd64 libtiffxx5 amd64 4.0.9-5 [5,804 B]
Get:22 http://us.archive.ubuntu.com/ubuntu bionic/main amd64 libtiff5-dev amd64 4.0.9-5 [273 kB]
Get:23 http://us.archive.ubuntu.com/ubuntu bionic/universe amd64 libunicode-linebreak-perl amd64 0.0.20160702-1build2 [96.6 kB]
Get:24 http://us.archive.ubuntu.com/ubuntu bionic-updates/main amd64 libzzip-0-13 amd64 0.13.62-3.1ubuntu0.18.04.1 [26.0 kB]
Get:25 http://us.archive.ubuntu.com/ubuntu bionic/universe amd64 mpack amd64 1.6-8.2 [35.5 kB]
Get:26 http://us.archive.ubuntu.com/ubuntu bionic/main amd64 preview-latex-style all 11.91-1ubuntu1 [185 kB]
Get:27 http://us.archive.ubuntu.com/ubuntu bionic/main amd64 tcl8.6 amd64 8.6.8+dfsg-3 [14.4 kB]
Get:28 http://us.archive.ubuntu.com/ubuntu bionic/main amd64 tcl8.6-dev amd64 8.6.8+dfsg-3 [887 kB]
Get:29 http://us.archive.ubuntu.com/ubuntu bionic/universe amd64 texinfo amd64 6.5.0.dfsg.1-2 [752 kB]
Get:30 http://us.archive.ubuntu.com/ubuntu bionic/main amd64 texlive-binaries amd64 2017.20170613.44572-8build1 [8,174 kB]
Get:31 http://us.archive.ubuntu.com/ubuntu bionic/main amd64 texlive-base all 2017.20180305-1 [18.7 MB]
Get:32 http://us.archive.ubuntu.com/ubuntu bionic/main amd64 texlive-latex-base all 2017.20180305-1 [951 kB]
Get:33 http://us.archive.ubuntu.com/ubuntu bionic/universe amd64 texlive-extra-utils all 2017.20180305-2 [20.9 MB]
Get:34 http://us.archive.ubuntu.com/ubuntu bionic/universe amd64 texlive-fonts-extra all 2017.20180305-2 [354 MB]
Get:35 http://us.archive.ubuntu.com/ubuntu bionic/universe amd64 texlive-fonts-recommended all 2017.20180305-1 [5,262 kB]
Get:36 http://us.archive.ubuntu.com/ubuntu bionic/universe amd64 texlive-plain-generic all 2017.20180305-2 [23.6 MB]
Get:37 http://us.archive.ubuntu.com/ubuntu bionic/universe amd64 texlive-generic-recommended all 2017.20180305-1 [15.9 kB]
Get:38 http://us.archive.ubuntu.com/ubuntu bionic/main amd64 texlive-latex-recommended all 2017.20180305-1 [14.9 MB]
Get:39 http://us.archive.ubuntu.com/ubuntu bionic/universe amd64 texlive-pictures all 2017.20180305-1 [4,026 kB]
Get:40 http://us.archive.ubuntu.com/ubuntu bionic/universe amd64 texlive-latex-extra all 2017.20180305-2 [10.6 MB]
Get:41 http://us.archive.ubuntu.com/ubuntu bionic/main amd64 tk8.6 amd64 8.6.8-4 [12.3 kB]
Get:42 http://us.archive.ubuntu.com/ubuntu bionic/main amd64 tk8.6-dev amd64 8.6.8-4 [679 kB]
Get:43 http://us.archive.ubuntu.com/ubuntu bionic/universe amd64 xvfb amd64 2:1.19.6-1ubuntu4 [784 kB]
Fetched 472 MB in 1min 27s (5,450 kB/s)                                        
Extracting templates from packages: 100%
Preconfiguring packages ...
Setting up install-info (6.5.0.dfsg.1-2) ...
python2: can't open file '=': [Errno 2] No such file or directory
dpkg: error processing package install-info (--configure):
 installed install-info package post-installation script subprocess returned error exit status 2
Errors were encountered while processing:
 install-info
E: Sub-process /usr/bin/dpkg returned an error code (1)
E: Failed to process build dependencies

#14

I tried running the ./configure, make and make install commands as root in the directory of the downloaded R 3.5.1 package and got the following error messages:

for ./configure:

configure: error: libcurl >= 7.22.0 library and headers are required with support for https

for make

collect2: error: ld returned 1 exit status
Makefile:145: recipe for target 'R.bin' failed
make[3]: *** [R.bin] Error 1
make[3]: Leaving directory '/home/arta/Downloads/R-3.5.1/src/main'
Makefile:137: recipe for target 'R' failed
make[2]: *** [R] Error 2
make[2]: Leaving directory '/home/arta/Downloads/R-3.5.1/src/main'
Makefile:28: recipe for target 'R' failed
make[1]: *** [R] Error 1
make[1]: Leaving directory '/home/arta/Downloads/R-3.5.1/src'
Makefile:60: recipe for target 'R' failed
make: *** [R] Error 1

for make install

/usr/bin/install: cannot stat 'NEWS.rds': No such file or directory
help2man: can't get `--version' info from ../bin/R
Makefile:45: recipe for target 'R.1' failed
make[1]: *** [R.1] Error 127
make[1]: Leaving directory '/home/arta/Downloads/R-3.5.1/doc'
Makefile:95: recipe for target 'install' failed
make: *** [install] Error 1


#15

Eek! This looks like some serious borking of the apt system. A few ways forward:

  • Try to iterate on fixing the apt system. apt-get build-dep r-base is showing you the dependencies that you need in order to build R from source. If you can debug apt-get install install-info, for instance, which currently fails, you will be one step closer to having all of the dependencies needed to build R
  • Try to install the build dependencies from source... I don't recommend this, as you would be signing up for a decent amount of trouble
  • Abandon your system / reinstall Ubuntu / other nuclear options

You were right to try with root, but usually if you encounter an error in the ./configure then make will fail. And an error in make suggests that make install will probably fail. So it's usually best to focus on one at a time.

In particular,

This suggests that you need libcurl. You can see that sudo apt-get build-dep r-base tried to install libcurl4-openssl-dev, which would have resolved this dependency. If you can get all of the sudo apt-get build-dep r-base to succeed, you will be in a good spot for either installing R from apt or building R from source!

EDIT: Another thing worth checking out - maybe try playing with / fixing python2. It looks like you may have messed up your system version of python? That always spells trouble!


#16

EDIT: Another thing worth checking out - maybe try playing with / fixing python2. It looks like you may have messed up your system version of python? That always spells trouble!

I set python2 to be an environment variable using sudo -H gedit /etc/environment a while ago and have since deleted that line, saved that file and restarted my computer to no avail. Calling python2 in terminal still runs python 2.7. I really don't feel like I have enough experience to successfully do any of the other things you listed. I might try a little bit to get sudo apt-get build-dep r-base to work a little bit longer, but honestly, it seems like nuclear option might be my best bet, unfortunately. Thanks again, friend-o.


#17

My pleasure! I have to admit, the nuclear options are usually my default as well after banging at things for a while. So much weird stuff can happen in that lower system level :slight_smile:

It's not all loss though! Think of all the helpful knowledge you have gained through this experience :smiley: