Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

object 'sigma' not found whilst loading namespace 'vegan' #274

Closed
Qwarctick opened this issue Apr 24, 2018 · 9 comments
Closed

object 'sigma' not found whilst loading namespace 'vegan' #274

Qwarctick opened this issue Apr 24, 2018 · 9 comments

Comments

@Qwarctick
Copy link

Qwarctick commented Apr 24, 2018

Hi,

Tried to install the vegan package version 2.5-1 but got an error message (full message below) :
" object 'sigma' not found whilst loading namespace 'vegan' "

I tried multiple time and after start a new workspace but didn't work. I succeed to install the older version of the package (2.4-6)

Maybe I am doing something wrong, if yes, sorry in advance :)

Installing package into ‘/home/pnoel/R/x86_64-pc-linux-gnu-library/3.2’
(as ‘lib’ is unspecified)
--2018-04-24 12:15:12--  https://cran.rstudio.com/src/contrib/vegan_2.5-1.tar.gz
Résolution de cran.rstudio.com (cran.rstudio.com)… 54.192.79.156
Connexion à cran.rstudio.com (cran.rstudio.com)|54.192.79.156|:443… connecté.
requête HTTP transmise, en attente de la réponse… 200 OK
Taille : 2070664 (2,0M) [application/x-gzip]
Enregistre : «/tmp/Rtmpbbjopk/downloaded_packages/vegan_2.5-1.tar.gz»
  2000K .......... .......... ..                              100%  935K=3,1s

2018-04-24 12:15:15 (661 KB/s) - «/tmp/Rtmpbbjopk/downloaded_packages/vegan_2.5-1.tar.gz» enregistré [2070664/2070664]

* installing *source* package ‘vegan’ ...
** package ‘vegan’ correctement décompressé et sommes MD5 vérifiées
** libs
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG      -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c data2hill.c -o data2hill.o
gfortran   -fpic  -g -O2 -fstack-protector-strong  -c decorana.f -o decorana.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG      -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c getF.c -o getF.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG      -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c goffactor.c -o goffactor.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG      -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c init.c -o init.o
gfortran   -fpic  -g -O2 -fstack-protector-strong  -c monoMDS.f -o monoMDS.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG      -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c nestedness.c -o nestedness.o
gfortran   -fpic  -g -O2 -fstack-protector-strong  -c ordering.f -o ordering.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG      -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c pnpoly.c -o pnpoly.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG      -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c stepacross.c -o stepacross.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG      -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c vegdist.c -o vegdist.o
gcc -std=gnu99 -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o vegan.so data2hill.o decorana.o getF.o goffactor.o init.o monoMDS.o nestedness.o ordering.o pnpoly.o stepacross.o vegdist.o -llapack -lblas -lgfortran -lm -lquadmath -lgfortran -lm -lquadmath -L/usr/lib/R/lib -lR
installing to /home/pnoel/R/x86_64-pc-linux-gnu-library/3.2/vegan/libs
** R
** data
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded
Error : object 'sigma' not found whilst loading namespace 'vegan'
Erreur : le chargement a échoué
Exécution arrêtée
ERROR: loading failed
* removing ‘/home/pnoel/R/x86_64-pc-linux-gnu-library/3.2/vegan’
Warning in install.packages :
  installation of package ‘vegan’ had non-zero exit status

The downloaded source packages are in
	‘/tmp/Rtmpbbjopk/downloaded_packages’```
@jarioksa
Copy link
Contributor

It very badly looks that your R is too old, and we failed to test vegan with older R: the generic function sigma is exported from stats NAMESPACE, and vegan only provides methods for this generic. It seems that sigma was introduced in R version 3.3-0, and you seem to be building for 3.2 version of R.

We should have checked vegan with older version of R and updated the version dependendency if needed. We'll fix that in DESCRIPTION.

jarioksa pushed a commit that referenced this issue Apr 24, 2018
reported as github issue #274. We failed to check vegan with
older version of R and gave false promise of 3.1.0 compatibility.

I could not check 3.3.0 compatibility though: R 3.3.0 had a broken
configure script which failed to understand that zlib version
1.2.11 (installed) > 1.2.5 (required).
@jarioksa
Copy link
Contributor

It is possible to get around this problem with the following:

diff --git a/R/influence.cca.R b/R/influence.cca.R
index abdaa9e4..9940c79c 100644
--- a/R/influence.cca.R
+++ b/R/influence.cca.R
@@ -37,6 +37,11 @@
 ## statistic this would be residual of WA/LC regression with little or
 ## no meaning.
 
+## sigma generic was introduced in R 3.3.0
+
+if (getRversion() < "3.3.0")
+    sigma <- function(object, ...) UseMethod("sigma")
+
 `sigma.cca` <-
     function(object, type = c("response", "canoco"), ...)
 {

This will allow installing vegan on R 3.2.x. However, sigma cannot be used from the user session without changing NAMESPACE and exporting sigma -- vegan functions using sigma will work, though.

This is an alternative fix for 2.5-2 instead of increasing dependency on R version.

@Qwarctick
Copy link
Author

My bad sorry,
After an upgrade of R version, it work.
Really sorry for the loss of time :/

@oguzhanogreden
Copy link

oguzhanogreden commented Apr 26, 2018

It happens that people are stuck with old versions, due to using infrastructure managed by institutions etc. Would it be feasible to stick to the alternative fix of @jarioksa ? In any case, thanks for the manual fix :)

@jarioksa
Copy link
Contributor

jarioksa commented Apr 26, 2018

The problem seems to be in documentation: I can have conditional definition of sigma generic in a function (like above), and I can conditionally export of sigma from the NAMESPACE, but I have not yet figured out how to get a conditional documentation in man/influence.cca.Rd which should either have or not have an \alias{sigma}.

@jarioksa
Copy link
Contributor

@oguzhanogreden : I agree, and I know the situation. I cannot provide full compatibility but with R 3.3.0. series, but I can provide partial compatibility and passing tests to R 3.2.0. Currently we have yearly major releases meaning that 3.3.0 is from April 2016 and 3.2.0 is from April 2015, while vegan 2.4-6 was dependent on R 3.1.0 from 2014.

The new features that do not work with R 3.1.0 are:

  • new sigma.cca function needs generic sigma which is available from R 3.3.0.
  • documentation used \doi{} macro for references, and this is available from R 3.2.0.

For sigma.cca I can have a work-around that almost works, but it may be that direct use of sigma(m) for a "cca" object m will fail, and you should call it as vegan:::sigma.cca(m). However, the vegan functions that internally call sigma will work (for instance, rstudent(m)).

I'll see how much can I do.

@jarioksa jarioksa reopened this Apr 27, 2018
@oguzhanogreden
Copy link

I must say that this looks like some amount of work and I don't find it reasonable to expect you to put enerhy into these, especially since the solution is provided here. The early comment was just to let you know of one perspective, in case it would be easy to fix.

I faced this due to vegan being imported in another package, which I'm using for a simulation study. For managing the code of the study I used packrat. While moving into high performance computing environment, vegan started failing packrat::restore() due to old R version. I solved it manually unpacking vegan, modifying the code and installing manually, which is straight-forward enough.

@jarioksa
Copy link
Contributor

Commit 954461e fixes most issues in this thread:

  • vegan is dependent on R 3.2.0 (instead of 3.3.0). We cannot keep the old 3.1.0 dependency because of documentation macros.
  • In R < 3.3.0 vegan defines a generic sigma(). This is non-exported, but allows sigma() work within vegan:::rstandard.cca and vegan::ordiresids. The generic sigma() is not exported because then it should be documented, and I haven't found a way of having conditional \alias{} in help files.
  • sigma.cca is exported in R < 3.3.0 and can be called as sigma.cca(). It is not exported, but declared as a method for the generic sigma in R >= 3.3.0. I think this is a minor nuisance.

jarioksa pushed a commit that referenced this issue May 9, 2019
vegan 2.5-5 depends on R (>= 3.4.0) and we can remove the hacks
for sigma.cca in R (<= 3.3.0). Final fix for issue #274 workarounds.
@jarioksa
Copy link
Contributor

jarioksa commented May 9, 2019

vegan_2.5-5 will depend on R 3.4.0 which makes these 2.5-2 sigma.cca workarounds unnecessary, and the sigma function will work just like any other method.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants