Why I can not install anything on R?
4
0
Entering edit mode
6.1 years ago
Za ▴ 140

Sorry, I asked this question in bioinformatics too and googled a lot but still my problem exists

after updating R, whatever package I am trying to install gives me the same error

ld: warning: directory not found for option '-L/usr/local/gfortran/lib/gcc/x86_64-apple-darwin15/6.1.0'
ld: library not found for -lgfortran
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [RcppEigen.so] Error 1
ERROR: compilation failed for package ‘RcppEigen’
* removing ‘/Library/Frameworks/R.framework/Versions/3.5.1-MRO/Resources/library/RcppEigen’
Warning in install.packages :
  installation of package ‘RcppEigen’ had non-zero exit status

The downloaded source packages are in
    ‘/private/var/folders/4v/31py55vj2rlbpy4qcv2gqt2m0000gq/T/RtmpIyjaEZ/downloaded_packages’

How I can install R packages like already please?

R software error • 18k views
ADD COMMENT
0
Entering edit mode

Are you using Rstudio?

ADD REPLY
0
Entering edit mode

Yes I am using RStudio

ADD REPLY
0
Entering edit mode

Try to purge R completely by running these commands in terminal (not in R).

https://stackoverflow.com/a/24981651/3691040

Also delete the RStudio.app from your Applications.

ADD REPLY
0
Entering edit mode

Moderator note:

I'm separating out some comment threads to try and stop everything nesting too deeply.

ADD REPLY
0
Entering edit mode

Sorry what is the solution please?

Thank you

ADD REPLY
0
Entering edit mode

The answer already provided by Genomax and Steve should be fine - they work for most people. As you do not favour the Python solution, you should follow the advice of Genomax.

From your current position, do the following:

  1. Uninstall Microsoft R and standard R (and ensure 100% that they are uninstalled - do not just delete directories)
  2. Download latest version from CRAN and install (pkg file)
  3. Update R Studio (Help > Check for Updates)

Unfortunately, we are all remote from you, so, we cannot see the specific actions that you are taking.

ADD REPLY
0
Entering edit mode

If you download R separately, it is crucial that it installs to a 'normal' place, so that RStudio can find the R binary. Else you will need to direct RStudio to whereever R is.

This is why I suggest you allow RStudio to do it for you to avoid confusion.

ADD REPLY
0
Entering edit mode

Sorry I removed everything and I installed latest version of R 3.5.1 that for me did not work so I installed R 3.3.3 but again the same problem

* installing *source* package ‘digest’ ...
** package ‘digest’ successfully unpacked and MD5 sums checked
** libs
/usr/local/clang4/bin/clang -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG  -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include    -fPIC  -Wall -mtune=core2 -g -O2  -c aes.c -o aes.o
make: /usr/local/clang4/bin/clang: No such file or directory
make: *** [aes.o] Error 1
ERROR: compilation failed for package ‘digest’
* removing ‘/Library/Frameworks/R.framework/Versions/3.3/Resources/library/digest’
Warning in install.packages :
  installation of package ‘digest’ had non-zero exit status

The downloaded source packages are in
    ‘/private/var/folders/4v/31py55vj2rlbpy4qcv2gqt2m0000gq/T/RtmpVINAYd/downloaded_packages’
>

I can not install any package yet :( :( :(

ADD REPLY
0
Entering edit mode

You need to install C libraries. Take a look here: https://embeddedartistry.com/blog/2017/2/20/installing-clangllvm-on-osx

ADD REPLY
0
Entering edit mode

Za : You may be gone for the day but did you install the two tools mentioned in: https://cran.r-project.org/bin/macosx/tools/

ADD REPLY
0
Entering edit mode

Thank you, yes, just yesterday as you suggested I installed clang and gfortran my iMAC is Yosemite 10.5.5 and I tried to install the compatible versions but again I am facing

Do you want to install from sources the packages which need compilation?
y/n: y
Packages which are only available in source form, and may need compilation of C/C++/Fortran: ‘fansi’ ‘promises’
Do you want to attempt to install these from sources?
y/n: 


make: /usr/local/clang4/bin/clang++: No such file or directory
make: *** [Date.o] Error 1
ERROR: compilation failed for package ‘Rcpp’
* removing ‘/Library/Frameworks/R.framework/Versions/3.3/Resources/library/Rcpp’
ADD REPLY
0
Entering edit mode

You are using a ~ 8+ year old operating system that has not been maintained for a long time. It is quite possible that that could be the root cause of all the issues you have been experiencing.

Are you sure clang was installed without any errors?

ADD REPLY
0
Entering edit mode

Sorry, I just double clicked on clang-6.0.0.pkg and installed that. I checked for gcc

eduroam-int-dhcp-97-95-149:~ admin$ gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 6.1.0 (clang-602.0.53) (based on LLVM 3.6.0svn)
Target: x86_64-apple-darwin14.5.0
Thread model: posix
eduroam-int-dhcp-97-95-149:~ admin$

The graphics card of my own mac failed so I transferred my data from failed mac to this mac by a cable;

This is a Yosemite 10.10.5 version mac

Whatever R package I am trying to install if any need to be compiled I will get error

> install.packages("ggplot2")

  There is a binary version available but the source version is later:
        binary source needs_compilation
ggplot2  2.2.1  3.0.0             FALSE

installing the source package ‘ggplot2’

trying URL 'https://cran.rstudio.com/src/contrib/ggplot2_3.0.0.tar.gz'
Content type 'application/x-gzip' length 2847050 bytes (2.7 MB)
==================================================
downloaded 2.7 MB

* installing *source* package ‘ggplot2’ ...
** package ‘ggplot2’ successfully unpacked and MD5 sums checked
** R
** data
*** moving datasets to lazyload DB
** inst
** preparing package for lazy loading
Error : object ‘enexprs’ is not exported by 'namespace:rlang'
ERROR: lazy loading failed for package ‘ggplot2’
* removing ‘/Library/Frameworks/R.framework/Versions/3.3/Resources/library/ggplot2’
Warning in install.packages :
  installation of package ‘ggplot2’ had non-zero exit status

The downloaded source packages are in
    ‘/private/var/folders/4v/31py55vj2rlbpy4qcv2gqt2m0000gq/T/RtmpAiNK12/downloaded_packages’
>
ADD REPLY
0
Entering edit mode

Looks like you need to install latest version of rlang (https://github.com/tidyverse/ggplot2/issues/2732 ).

This also may be relevant: https://community.rstudio.com/t/unable-to-install-any-packages/13053/3

ADD REPLY
2
Entering edit mode
6.1 years ago
GenoMax 147k

Since you chose to install Microsoft's version of R for Mac (which apparently is subtly different) you may be running into these things.

Perhaps you should consider getting rid of all older versions of R. Start with a fresh CRAN install of latest R and then reinstall the packages you need.

ADD COMMENT
0
Entering edit mode

Thank you, I removed R.framework folder even but again I have R. I don't know how to remove R permanently :(

ADD REPLY
1
Entering edit mode

Did you remove all folders starting at R.framework in Frameworks ?

ADD REPLY
0
Entering edit mode

Yes I removed R.framework but again

> .libPaths()
[1] "/Library/Frameworks/R.framework/Versions/3.5.1-MRO/Resources/library"
>

I don't know where this R is because in this address I can not locate any R

ADD REPLY
1
Entering edit mode

What do you get with which R?

ADD REPLY
0
Entering edit mode
> which R
Error: unexpected symbol in "which R"
>
ADD REPLY
1
Entering edit mode

Please exit out of R and then run that command on system prompt.

If you had removed every folder under R.framework then there should be no R program on your computer. Which does not seem to be the case.

ADD REPLY
0
Entering edit mode

Sorry I am sure I have removed R.framework

But still in terminal I have R 3.5.1 microsoft

Microsoft R Open 3.5.1
The enhanced R distribution from Microsoft
Microsoft packages Copyright (C) 2018 Microsoft Corporation

Multithreaded BLAS/LAPACK libraries detected. Using 2 cores for math algorithms.

Default CRAN mirror snapshot taken on 2018-08-01.
See: https://mran.microsoft.com/.

>
ADD REPLY
1
Entering edit mode

Is that what you get when you run which R in plain terminal prompt?

ADD REPLY
0
Entering edit mode

Yes @genomax

In terminal

> which R
Error: unexpected symbol in "which R"
>
ADD REPLY
1
Entering edit mode

Does your system prompt look like >? That looks to me like the prompt in R which was why I was confused.

What does find /Library/Frameworks/ -name "R.framework" -print show? It should show nothing if you have truly removed all versions of R.

ADD REPLY
0
Entering edit mode
> find /Library/Frameworks/ -name "R.framework" -print
Error: unexpected string constant in "find /Library/Frameworks/ -name "R.framework""
>
ADD REPLY
1
Entering edit mode

I have a feeling you are still inside a R terminal and not the actual system terminal program. Can you open a fresh terminal window (apple key + space --> terminal --> new terminal window/tab) and run that command?

ADD REPLY
0
Entering edit mode

You were right

Last login: Thu Oct 11 17:48:55 on ttys000
eduroam-int-dhcp-97-95-149:~ admin$ find /Library/Frameworks/ -name "R.framework" -print
/Library/Frameworks//R.framework
eduroam-int-dhcp-97-95-149:~ admin$ 

eduroam-int-dhcp-97-95-149:~ admin$ which r
/usr/local/bin/r
eduroam-int-dhcp-97-95-149:~ admin$
ADD REPLY
2
Entering edit mode

Looks like you still have the R.framework directory.

Note: Only do the following if you are not tired and can fully concentrate.

sudo mv /Library/Frameworks/R.framework /Library/Frameworks/R.framework.bak

Now grab a new copy of the R installer from CRAN or use the conda alternative below you choice.

ADD REPLY
0
Entering edit mode

Thank you, likely I got rid of that annoying R

Last login: Thu Oct 11 18:29:26 on ttys000
eduroam-int-dhcp-97-95-149:~ admin$ sudo mv /Library/Frameworks/R.framework /Library/Frameworks/R.framework.bak
Password:
eduroam-int-dhcp-97-95-149:~ admin$ which r
eduroam-int-dhcp-97-95-149:~ admin$ find /Library/Frameworks/ -name "R.framework" -print
eduroam-int-dhcp-97-95-149:~ admin$
ADD REPLY
0
Entering edit mode

Sorry, I downloaded R from CRAN and installed that but when I am trying to launch RStudio, says that Unable to locate R binary by scanning standard locations

Also in terminal that does not recognise R

eduroam-int-dhcp-97-95-149:~ admin$ r
-bash: r: command not found
eduroam-int-dhcp-97-95-149:~ admin$
ADD REPLY
0
Entering edit mode

Try capital 'R'.

You installed from here: https://cran.r-project.org/bin/macosx/ ?

ADD REPLY
0
Entering edit mode

Yes I downloaded from where you are pointing and R.frameork folder created and inside that is 3.5

Last login: Thu Oct 11 18:49:46 on ttys000
eduroam-int-dhcp-97-95-149:~ admin$ R
-bash: R: command not found
eduroam-int-dhcp-97-95-149:~ admin$ 


eduroam-int-dhcp-97-95-149:~ admin$ which r
eduroam-int-dhcp-97-95-149:~ admin$
ADD REPLY
0
Entering edit mode

Don't bother. Reinstall RStudio, and let it do it for you. Rstudio will install R at the same time if you take it from their site I believe.

First, purge and R installations you have, so that your new Rstudio install doesnt get confused.

ADD REPLY
0
Entering edit mode

I reinstalled RStudio right now, When I tried to launch that without being open told

Unable to locate R binary by scanning standard locations
ADD REPLY
0
Entering edit mode

That's probably because you installed R separately from CRAN and it's gone somewhere unusual.

ADD REPLY
2
Entering edit mode
6.1 years ago
GenoMax 147k

Install the fortran libraries/clang package mentioned from the tools page: https://cran.r-project.org/bin/macosx/tools/

ADD COMMENT
0
Entering edit mode

Sorry, after installing

fortran libraries/clang package

 > devtools::install_github("rstudio/httpuv")
    Downloading GitHub repo rstudio/httpuv@master
    from URL https://api.github.com/repos/rstudio/httpuv/zipball/master
    Installation failed: Could not find build tools necessary to build httpuv
    > 
    > 
    >
ADD REPLY
2
Entering edit mode
6.1 years ago
steve ★ 3.5k

As an alternative, you might try installing R into conda instead (full Anaconda download here, slimmed down Miniconda download here). This has become my preferred method of installing R and its packages, since it is much easier to install and manage specific versions of R and its packages. Here is an example installation command using conda: conda install -y -c r r-base=3.4.3 r=3.4.3 r-reshape2=1.4.3 r-ggplot2=2.2.1. Of course this means you will need to activate conda every time you want to use R, and Google to find if the package you want is available on conda. Looks like the package you are trying to install is available for conda here

ADD COMMENT
0
Entering edit mode

This is _the_ best solution IMO. Much better than the deinstall-reinstall-whyIsntMyProjectWorkingAnymore workflow

ADD REPLY
2
Entering edit mode

Perhaps. But it is going to leave a whole bunch of old crap around. We are in the cleanup phase for now. Once that is done this may be the best way.

ADD REPLY
0
Entering edit mode

Sorry but I don't anything in Python and that creates a super courses of error

ADD REPLY
1
Entering edit mode

Assuming you are on a Mac or Linux system (appears to be Mac based on your error messages), you don't actually have to mess with any Python stuff to do this if you install conda in batch mode; the command would look something like this: wget https://repo.continuum.io/miniconda/Miniconda3-latest-MacOSX-x86_64.sh && bash Miniconda3-latest-MacOSX-x86_64.sh -b -p $HOME/conda. This would install a fresh conda in your home directory and will not affect any system Python stuff.

ADD REPLY
0
Entering edit mode

Thank you I installed conda; sorry what is the next step now because I got error when trying to install

Last login: Fri Oct 12 14:37:29 on ttys001
eduroam-int-dhcp-97-95-149:~ admin$ conda install -y -c r r-base=3.4.3 r=3.4.3 r-reshape2=1.4.3 r-ggplot2=2.2.1
-bash: conda: command not found
eduroam-int-dhcp-97-95-149:~ admin$ conda
-bash: conda: command not found
eduroam-int-dhcp-97-95-149:~ admin$ conda install -c conda-forge r-rcppeigen 
-bash: conda: command not found
eduroam-int-dhcp-97-95-149:~ admin$
ADD REPLY
1
Entering edit mode

you have to activate conda first. You should do this from the directory that you installed conda into. The command is usually source conda/bin/activate. To deactivate it, you would run source deactivate

ADD REPLY
0
Entering edit mode

Thanks a lot, I activated that but seurat is not for conda for mac :( :(

(base) eduroam-int-dhcp-97-20-212:bin admin$ conda install -c bioconda r-seurat-scripts 
Solving environment: failed

PackagesNotFoundError: The following packages are not available from current channels:

  - r-seurat-scripts
  - r-seurat[version='>=2.3.1']
  - r-cowplot
  - r-seurat-scripts
  - r-seurat[version='>=2.3.1']
  - r-diffusionmap
  - r-seurat-scripts
  - r-seurat[version='>=2.3.1']
  - r-dosnow
  - r-seurat-scripts
  - r-seurat[version='>=2.3.1']
  - r-dtw
  - r-seurat-scripts
  - r-seurat[version='>=2.3.1']
  - r-ggridges
  - r-seurat-scripts
  - r-seurat[version='>=2.3.1']
  - r-hdf5r
  - r-seurat-scripts
  - r-seurat[version='>=2.3.1']
  - r-ica
  - r-seurat-scripts
  - r-seurat[version='>=2.3.1']
  - r-metap
  - r-seurat-scripts
  - r-seurat[version='>=2.3.1']
  - r-pbapply
  - r-seurat-scripts
  - r-seurat[version='>=2.3.1']
  - r-rcppprogress
  - r-seurat-scripts
  - r-seurat[version='>=2.3.1']
  - r-sdmtools
  - r-seurat-scripts
  - r-seurat[version='>=2.3.1']
  - r-tclust

Current channels:

  - https://conda.anaconda.org/bioconda/osx-64
  - https://conda.anaconda.org/bioconda/noarch
  - https://repo.anaconda.com/pkgs/main/osx-64
  - https://repo.anaconda.com/pkgs/main/noarch
  - https://repo.anaconda.com/pkgs/free/osx-64
  - https://repo.anaconda.com/pkgs/free/noarch
  - https://repo.anaconda.com/pkgs/r/osx-64
  - https://repo.anaconda.com/pkgs/r/noarch
  - https://repo.anaconda.com/pkgs/pro/osx-64
  - https://repo.anaconda.com/pkgs/pro/noarch
ADD REPLY
2
Entering edit mode

They are, they just arent in the bioconda channel it seems:

https://bioconda.github.io/recipes/r-seurat-scripts/README.html

conda install r-seurat-scripts

ADD REPLY
1
Entering edit mode
6.1 years ago
Za ▴ 140

Thank you for your kindly efforts in helping me, all

Some parts of problem solved by updating Yosemite mac 10.10.1 to high Sierra but still I have getting error with compiling things

ADD COMMENT
1
Entering edit mode

if you just updated your Mac, you may have to open Xcode and click some buttons to enable all developer tools, or check for Xcode system updates

ADD REPLY
0
Entering edit mode

Sorry, when in terminal I type r

says that

Fatal error: MAX_NUM_DLLS bigger than 153 may exhaust open files limit

I typed

-iMac:~ admin$ ulimit -S -n 15000

now error gone but RStudio is just a white area without sign

I don't know what happened for my R

ADD REPLY

Login before adding your answer.

Traffic: 1614 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6