Install Rmosek under 3.4.4 using macOS - r

I'd like to install the packages Rmosek with R 3.4.4 version.
I have this problem:
* installing *source* package ‘Rmosek’ ...
** package ‘Rmosek’ successfully unpacked and MD5 sums checked
Configuring for a UNIX-alike platform (sub-architecture: "")
Found package 'Matrix' version 1.2.14
*** No variable 'PKG_MOSEKHOME' in environment - see configure-vars (configure.vars) argument ***
*** No variable 'PKG_MOSEKHOME' in ./src/setup/Localsys.txt file ***
*** Shell command 'mosek' was not recognized - please validate your installation of MOSEK ***
*** >> PATH = /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Library/TeX/texbin:/opt/X11/bin:/opt/local/bin ***
ERROR: configuration failed for package ‘Rmosek’
* removing ‘/Library/Frameworks/R.framework/Versions/3.4/Resources/library/Rmosek’
Warning in install.packages :
installation of package ‘Rmosek’ had non-zero exit status
The downloaded source packages are in
‘/private/var/folders/42/p9yl3yln6zn8dq_3zdd496kr0000gn/T/RtmpBe0vs2/downloaded_packages’

I solved my problem by this post: https://gist.github.com/mikelove/67ea44d5be5a053e599257fe357483dc#file-rmosek-L19
1) Download mosek from here:
https://www.mosek.com/downloads/
(I downloaded this to my ~/bin)
cd ~/bin
tar -xvf mosektoolslinux64x86.tar.bz2
2) Add this to your ~/.bashrc
export PATH=$PATH:/home/username/bin/mosek/8/tools/platform/linux64x86/bin
3) Get academic license:
https://www.mosek.com/products/academic-licenses/
Check email, put licsense file in ~/mosek
4) Install:
export PKG_MOSEKHOME=/home/username/bin/mosek/8/tools/platform/linux64x86
export PKG_MOSEKLIB=mosek64
Then in R:
install.packages("Rmosek", type="source", INSTALL_opts="--no-multiarch", repos="http://download.mosek.com/R/8")

Related

Errors when install_github was used for install package 'cindex' in Rstudio on windows machine

When I run the command install_github("chrchang/plink-ng", subdir="/2.0/cindex") in Rstudio, I get the following error message:
Downloading GitHub repo chrchang/plink-ng#HEAD
chrchang-plink-ng-b39d989/2.0/cindex/src/include: Can't create '\\\\?\\C:\\Users\\xxx\\AppData\\Local\\Temp\\Rtmp6PucTt\\remotes68581e00563b\\chrchang-plink-ng-b39d989\\2.0\\cindex\\src\\include'
chrchang-plink-ng-b39d989/2.0/pgenlibr/src/include: Can't create '\\\\?\\C:\\Users\\xxx\\AppData\\Local\\Temp\\Rtmp6PucTt\\remotes68581e00563b\\chrchang-plink-ng-b39d989\\2.0\\pgenlibr\\src\\include'
chrchang-plink-ng-b39d989/2.0/pgenlibr/src/libdeflate: Can't create '\\\\?\\C:\\Users\\xxx\\AppData\\Local\\Temp\\Rtmp6PucTt\\remotes68581e00563b\\chrchang-plink-ng-b39d989\\2.0\\pgenlibr\\src\\libdeflate'
chrchang-plink-ng-b39d989/2.0/pgenlibr/src/pgenlib_ffi_support.cpp: Can't create '\\\\?\\C:\\Users\\xxx\\AppData\\Local\\Temp\\Rtmp6PucTt\\remotes68581e00563b\\chrchang-plink-ng-b39d989\\2.0\\pgenlibr\\src\\pgenlib_ffi_support.cpp'
chrchang-plink-ng-b39d989/2.0/pgenlibr/src/pgenlib_ffi_support.h: Can't create '\\\\?\\C:\\Users\\xxx\\AppData\\Local\\Temp\\Rtmp6PucTt\\remotes68581e00563b\\chrchang-plink-ng-b39d989\\2.0\\pgenlibr\\src\\pgenlib_ffi_support.h'
chrchang-plink-ng-b39d989/2.0/pgenlibr/src/pvar_ffi_support.cpp: Can't create '\\\\?\\C:\\Users\\xxx\\AppData\\Local\\Temp\\Rtmp6PucTt\\remotes68581e00563b\\chrchang-plink-ng-b39d989\\2.0\\pgenlibr\\src\\pvar_ffi_support.cpp'
chrchang-plink-ng-b39d989/2.0/pgenlibr/src/pvar_ffi_support.h: Can't create '\\\\?\\C:\\Users\\xxx\\AppData\\Local\\Temp\\Rtmp6PucTt\\remotes68581e00563b\\chrchang-plink-ng-b39d989\\2.0\\pgenlibr\\src\\pvar_ffi_support.h'
chrchang-plink-ng-b39d989/2.0/pgenlibr/src/zstd: Can't create '\\\\?\\C:\\Users\\xxx\\AppData\\Local\\Temp\\Rtmp6PucTt\\remotes68581e00563b\\chrchang-plink-ng-b39d989\\2.0\\pgenlibr\\src\\zstd'
tar.exe: Error exit delayed from previous errors.
√ checking for file 'C:\Users\xxx\AppData\Local\Temp\Rtmp6PucTt\remotes68581e00563b\chrchang-plink-ng-b39d989\2.0\cindex/DESCRIPTION' ...
- preparing 'cindex':
√ checking DESCRIPTION meta-information ...
- cleaning src
- checking for LF line-endings in source and make files and shell scripts
- checking for empty or unneeded directories
- building 'cindex_0.2.tar.gz'
Installing package into ‘C:/Users/xxx/Documents/R/win-library/4.0’
(as ‘lib’ is unspecified)
* installing *source* package 'cindex' ...
** using staged installation
** libs
*** arch - i386
make: *** No rule to make target 'include/plink2_base.o', needed by 'cindex.dll'. Stop.
ERROR: compilation failed for package 'cindex'
* removing 'C:/Users/xxx/Documents/R/win-library/4.0/cindex'
错误: Failed to install 'cindex' from GitHub:
(由警告转换成)installation of package ‘C:/Users/xxx/AppData/Local/Temp/Rtmp6PucTt/file685860d615b0/cindex_0.2.tar.gz’ had non-zero exit status
此外: Warning message:
In utils::untar(tarfile, ...) :
‘tar.exe -xf "C:\Users\xxx\AppData\Local\Temp\Rtmp6PucTt\file68583f07ec.tar.gz" -C "C:/Users/xxx/AppData/Local/Temp/Rtmp6PucTt/remotes68581e00563b"’ returned error code 1*
install_github() on Windows 10 R does not seem to handle Git symlinks correctly. A workaround is to clone the repository and manually expand the symlinks in your copy.

how to install in R CvM2SL2Test package (Cramer-von Mises Two Sample Test)

I am trying to install the following package CvM2SL2Test in R, but i do not manage to do it. I have tried from CRAN, but it seems that it is not available anymore. In the end, i have tried locally (downloading the package from http://ftp.naist.jp/pub/CRAN/src/contrib/Archive/CvM2SL2Test/) but i am obtaining the following error:
Installing package into ‘C:/Users/David/Documents/R/win-library/3.4’
(as ‘lib’ is unspecified)
* installing *source* package 'CvM2SL2Test' ...
** package 'CvM2SL2Test' successfully unpacked and MD5 sums checked
** libs
*** arch - i386
Warning: comando ejecutado 'make -f "C:/PROGRA~1/R/R-34~1.4/etc/i386/Makeconf" -f "C:/PROGRA~1/R/R-34~1.4/share/make/winshlib.mk" SHLIB_LDFLAGS='$(SHLIB_CXXLDFLAGS)' SHLIB_LD='$(SHLIB_CXXLD)' SHLIB="CvM2SL2Test.dll" OBJECTS="CvM2SL2Test.o XCVM.o XCVMTailProb.o XCVMTailProb_EQ.o XCVMTailProb_NE1.o XCVMTailProb_NE2.o XCvMTest.o XFreqFunct.o"' tiene estatus 127
ERROR: compilation failed for package 'CvM2SL2Test'
* removing 'C:/Users/David/Documents/R/win-library/3.4/CvM2SL2Test'
In R CMD INSTALL
Warning in install.packages :
running command '"C:/PROGRA~1/R/R-34~1.4/bin/x64/R" CMD INSTALL -l "C:\Users\David\Documents\R\win-library\3.4" "C:/Users/David/Downloads/CvM2SL2Test_2.0-1.tar.gz"' had status 1
Warning in install.packages :
installation of package ‘C:/Users/David/Downloads/CvM2SL2Test_2.0-1.tar.gz’ had non-zero exit status
Given that i am using windows 10, i have extracted the folder, and used the extention .zip. Then i have been able to obtain the following result:
Installing package into ‘C:/Users/David/Documents/R/win-library/3.4’
(as ‘lib’ is unspecified)
package ‘CvM2SL2Test’ successfully unpacked and MD5 sums checked
However, when using like library(‘CvM2SL2Test’), I see the following:
library('CvM2SL2Test')
Error in library("CvM2SL2Test") :
‘CvM2SL2Test’ is not a valid installed package
I do not know how to install propery this package in windows 10 in order to use it properly, how can i do it?
Thanks in advance.
You appear to have a problem running the make command. This probably indicates that you don't have the R Tools collection (see https://cloud.r-project.org/bin/windows/Rtools/) installed, or it is not installed properly.

'termstrc' was removed from CRAN, tried installing from .tar file - how do I install 'termstrc' I need it for another program

* installing *source* package 'termstrc' ...
** libs
*** arch - i386
Warning in system(cmd) : 'make' not found
ERROR: compilation failed for package 'termstrc'
* removing 'C:/Program Files/R/R-3.5.1/library/termstrc'
In R CMD INSTALL
Warning in install.packages :
installation of package ‘C:/Users/DANIEL~1/DOWNLO~1/termstrc_1.3.7 (1).tar.gz’ had non-zero exit status
If you want to build R packages from source, you need to have the proper tools like compiler etc. installed. You seem to be using Windows, which is particularly difficult in that respect. The necessary tools have therefore been collected as Rtools package: https://cran.r-project.org/bin/windows/Rtools/. You will have to install that in order to build the package.

Error when installing gpclib

R version 3.2.1
I downloaded gpclib_1.5-5.tar.gz from http://cran.r-project.org/web/packages/gpclib/index.html and attempted to install the package with
install.packages("D:/GIS/gpclib_1.5-5.tar.gz", repos = NULL, type = "source")
I get the error
* installing *source* package 'gpclib' ...
** package 'gpclib' successfully unpacked and MD5 sums checked
** libs
*** arch - i386
Warning: running command 'make -f "D:/R/R-3.2.1/etc/i386/Makeconf" -f "D:/R/R-3.2.1/share/make/winshlib.mk" SHLIB="gpclib.dll" OBJECTS="Rgpc.o gpc.o"' had status 127
ERROR: compilation failed for package 'gpclib'
* removing 'D:/R/R-3.2.1/library/gpclib'
Warning in install.packages :
running command '"D:/R/R-3.2.1/bin/x64/R" CMD INSTALL -l "D:\R\R-3.2.1\library" "D:/GIS/gpclib_1.5-5.tar.gz"' had status 1
Warning in install.packages :
installation of package ‘D:/GIS/gpclib_1.5-5.tar.gz’ had non-zero exit status
How do I troubleshoot this?
Extra Information
I am ultimately trying to create heat maps, and am following this tutorial
http://spatialanalysis.co.uk/wp-content/uploads/2013/04/james_cheshire_ggplot_intro_blog.pdf
You'll need to install Rtools to install the R compiler libraries:
http://cran.r-project.org/bin/windows/Rtools/
Otherwise, R will have issues compiling from source code.

ERROR: a 'NAMESPACE' file is required

I am trying to install some R packages on a Linux machine using
R CMD INSTALL -l <ourRlibrarylocation> <path where I saved the packagename.tar.gz file>
and I see an error message:
ERROR: a 'NAMESPACE' file is required
I am using R 3.0.1. Please help, I am new to R and just downloaded these packages for customers.
One example:
R CMD INSTALL -l /abcde/R/R-3.0.0/library /home/RFILES/PKG/UScensus2000tract_0.03.tar.gz
* installing *source* package âUScensus2000tractâ ...
ERROR: a 'NAMESPACE' file is required
* removing â/abcde/R/R-3.0.0/library/UScensus2000tractâ
According to the R documentation for writing extensions, all packages destined for version 3.0.0 and later must contain a NAMESPACE file. If you download an R package that gives you the above error, here's what you should try:
Untar the package:
tar -xvf the_package.tar.gz
Add a NAMESPACE file with the line exportPattern( "." ):
cd the_package
echo 'exportPattern( "." )' > NAMESPACE
cd ..
Re-tar the package:
tar -zcf the_package.tar.gz the_package
Try and install it again.
Hope that helps.
I actually just hit the same thing when compiling R-3.0.1. It looks to be that the package version that I was using was out of date. This was for proto:
# /var/local/R-3.0.1/bin/R CMD INSTALL -l /var/local/R-3.0.1/lib64/R/library proto_0.3-9.2.tar.gz
* installing *source* package ‘proto’ ...
ERROR: a 'NAMESPACE' file is required
* removing ‘/var/local/R-3.0.1/lib64/R/library/proto’
But there was a newer version for proto (0.3-10) which worked fine:
# ../var/local/R-3.0.1/bin/R CMD INSTALL -l ../var/local/R-3.0.1/lib64/R/library proto_0.3-10.tar.gz
* installing *source* package ‘proto’ ...
** package ‘proto’ successfully unpacked and MD5 sums checked
** R
** demo
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
‘proto.Rnw’
‘protoref.Rnw’
** testing if installed package can be loaded
* DONE (proto)
I had an older install of R (2.15), which the older proto package worked with:
# /var/local/R-2.15.0/bin/R CMD INSTALL -l /var/local/R-2.15.0/lib64/R/library proto_0.3-9.2.tar.gz
* installing *source* package 'proto' ...
** Creating default NAMESPACE file
** R
** demo
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
'proto.Rnw'
'protoref.Rnw'
** testing if installed package can be loaded
It looks like the older version of R actually creates the missing NAMESPACE file, but the new version bails. Hope this helps you!
I found the following link more useful:
How should I deal with "package 'xxx' is not available (for R version x.y.z)" warning?
6. The package is out of date
It may have been archived (if it is no longer maintained and no longer passes R CMD check tests).
In this case, you can load an old version of the package using install_version()
library(devtools)
install_version("foobarbaz", "0.1.2")
An alternative is to install from the github CRAN mirror.
library(devtools)
install_github("cran/foobarbaz")
One can now use remotes::install_url() or remotes::install_local().
It installs dependencies and generates the NAMESPACE file automatically.

Resources