Skip to content

Unable to install quantstrat from sources on MAC

4 messages · Leo Shpiz, Kyle Baron, David Winsemius

#
I did follow instructions for getting MAC tools and installed fortran.  I then tried installing quantstrat which failed but I tried from sources.  The installer was unable to find the gfortran which does exist on my system, but a different version.

https://cran.r-project.org/bin/macosx/tools/ <https://cran.r-project.org/bin/macosx/tools/>

Used above to load 
gfortran-4.2.3.pkg (OS X 10.5+, signed, 64-bit driver)

The fortran was installed in usr2 and I moved local to the usr directory and
then executed

export PATH=$PATH:/usr/local/bin

In RStudio I did the install and said yes from sources

install.packages("quantstrat",
repos="http://R-Forge.R-project.org <http://r-forge.r-project.org/>")
also installing the dependencies ?PerformanceAnalytics?, ?blotter?

Warning in install.packages :
 URL 'http://download.r-forge.r-project.org/bin/macosx/mavericks/contrib/3.3/PA <http://download.r-forge.r-project.org/bin/macosx/mavericks/contrib/3.3/PA>
CKAGES.gz': status was '404 Not Found'
Warning in install.packages :
 URL 'http://download.r-forge.r-project.org/bin/macosx/mavericks/contrib/3.3/PA <http://download.r-forge.r-project.org/bin/macosx/mavericks/contrib/3.3/PA>
CKAGES': status was '404 Not Found'
Warning in install.packages :
 unable to access index for repository
http://R-Forge.R-project.org/bin/macosx/mavericks/contrib/3.3: <http://r-forge.r-project.org/bin/macosx/mavericks/contrib/3.3:>
 cannot download all files
Packages which are only available in source form, and may need compilation of
 C/C++/Fortran: ?PerformanceAnalytics? ?blotter? ?quantstrat?
Do you want to attempt to install these from sources?
y/n: y
installing the source packages ?PerformanceAnalytics?, ?blotter?,
?quantstrat?

trying URL 'http://R-Forge.R-project.org/src/contrib/PerformanceAnalytics_1.4.40 <http://r-forge.r-project.org/src/contrib/PerformanceAnalytics_1.4.40>
00.tar.gz'
Content type 'application/x-gzip' length 2119678 bytes (2.0 MB)
==================================================
downloaded 2.0 MB

trying URL 'http://R-Forge.R-project.org/src/contrib/blotter_0.9.1741.tar.gz <http://r-forge.r-project.org/src/contrib/blotter_0.9.1741.tar.gz>'
Content type 'application/x-gzip' length 74117 bytes (72 KB)
==================================================
downloaded 72 KB

trying URL 'http://R-Forge.R-project.org/src/contrib/quantstrat_0.9.1739.tar.gz <http://r-forge.r-project.org/src/contrib/quantstrat_0.9.1739.tar.gz>'
Content type 'application/x-gzip' length 799472 bytes (780 KB)
==================================================
downloaded 780 KB

* installing *source* package ?PerformanceAnalytics? ...
** libs
gfortran-4.8  -fPIC -Wall -g -O2  -c  momentF.f90 -o momentF.o
make: gfortran-4.8: No such file or directory
make: *** [momentF.o] Error 1
ERROR: compilation failed for package ?PerformanceAnalytics?
* removing ?/Library/Frameworks/R.framework/Versions/3.3/Resources/library/Per
formanceAnalytics?
Warning in install.packages :
 installation of package ?PerformanceAnalytics? had non-zero exit status
ERROR: dependency ?PerformanceAnalytics? is not available for package
?blotter?
* removing ?/Library/Frameworks/R.framework/Versions/3.3/Resources/library/blo
tter?
Warning in install.packages :
 installation of package ?blotter? had non-zero exit status
ERROR: dependency ?blotter? is not available for package ?quantstrat?
* removing ?/Library/Frameworks/R.framework/Versions/3.3/Resources/library/qua
ntstrat?
Warning in install.packages :
 installation of package ?quantstrat? had non-zero exit status

The downloaded source packages are in
	?/private/var/folders/7l/dpy9h0ss2450qcp053x0_sk00000gn/T/Rtmp7zLZ6J/download
ed_packages?

Leo Shpiz
518-488-7326
#
Leo -
The link below has discussion of gfortran-4.8 for Mavericks-type
installs (scroll down a bit to the middle of the topic):

https://cran.r-project.org/doc/manuals/R-admin.html#macOS

If you're on El Capitan or Sierra go here:

https://cran.r-project.org/doc/manuals/R-admin.html#El-Capitan-and-Sierra

I think you should probably take the time to install the recommended
gfortran version.  That's what I do. If that's not possible, you can
see here:

https://cran.r-project.org/doc/manuals/R-admin.html#Customizing-package-compilation

for how to point R to whatever fortran compiler that you want to use.

Kyle





Kyle


On Sat, Jan 28, 2017 at 10:17 AM, Leo Shpiz via R-SIG-Mac
<r-sig-mac at r-project.org> wrote:

  
    
#
The error below said that the Fortran version being sought for compiling the packages was:

** libs
gfortran-4.8  -fPIC -Wall -g -O2  -c  momentF.f90 -o momentF.o
make: gfortran-4.8: No such file or directory
make: *** [momentF.o] Error 1

There is a link on the page you cited to a listing of source for various packages and gfortran 4.8 is one of them:

http://r.research.att.com/libs/

Beyond that I was unable to get successful compilation of the package related to failure of a dependency, 'blotter', to compile. That failure was reportedly as a result of failure to open PerformancAnalytics. I did at one time install Version: 1.4.4000 which is a higher number than the current CRAN version which fails to install as well.
If you want /usr/local/bin/ to be the _first_ place looked for the compilers to look you will use:

export PATH=/usr/local/bin:$PATH
I would have used (adding dependencies and making the URL simple):

install.packages("quantstrat", dependencies=TRUE, repos="http://r-forge.r-project.org/", type="source")

This did succeed eventually after a lot of unsuccessful attempts without error after installing the `highfrequency` package (which is the successor to RTAQ) and the `blotter` package both from source.

(I'm still unable to get a `library` call to load pkg-PerformanceAnalytics to be successful, so I don't know how stable these interlocking packages will be. I had previous had difficulty with loading that package, and these difficulties persist.)

Best of luck (but not entirely optimistic);

David.
David Winsemius
Alameda, CA, USA
#
I use Parallels on my iMAC and was able to install quantstrat from sources on the Windows 10.

I will continue to try to get the MAC version running.

Thanks for your help

Leo Shpiz
518-488-7326