semPlot не устанавливается в R/Rstudio на MacOS 11.4, потому что OpenMx не устанавливается и это зависимость

я бегу R 3.6.1 в среде Anaconda (это не позволит мне перейти на v4) и попытаться установить, чтобы сопровождать lavaanкоторый установлен нормально. Вот пакеты, которые я установил:

      library(psych)   # for Chronbach's alpha calculation
library(psychTools)
library(lavaan)
library(knitr)
library(tidyverse)
library(haven)
library(labelled)
library(kableExtra)
library(survey)
library(srvyr)
library(scales)

Я пробовал много разных способов установки, последний был прямо из репозитория github: SachaEpskamp/semPlot, который, по словам одного человека из stackoverflow, сработал для них. После примерно 10000 строк предупреждений и ошибок, прокручивающихся по моей консоли так быстро, что я не мог их отследить, последняя попытка в итоге привела к следующему:

      The downloaded source packages are in
    ‘/private/var/folders/8_/ql9yb6nn4076n1y9vptzpqwm0000gp/T/RtmpvagRhg/downloaded_packages’
Updating HTML index of packages in '.Library'
Making 'packages.html' ... done
✓  checking for file ‘/private/var/folders/8_/ql9yb6nn4076n1y9vptzpqwm0000gp/T/RtmpvagRhg/remotes164e53982f159/SachaEpskamp-semPlot-a2ee9df/DESCRIPTION’ ...
─  preparing ‘semPlot’:
✓  checking DESCRIPTION meta-information ...
─  checking for LF line-endings in source and make files and shell scripts
─  checking for empty or unneeded directories
─  building ‘semPlot_1.1.4.tar.gz’
   
ERROR: dependency ‘OpenMx’ is not available for package ‘semPlot’
* removing ‘/Users/sjgenco/opt/anaconda3/envs/r_env/lib/R/library/semPlot’
Warning messages:
1: In i.p(...) : installation of package ‘OpenMx’ had non-zero exit status
2: In i.p(...) :
  installation of package ‘/var/folders/8_/ql9yb6nn4076n1y9vptzpqwm0000gp/T//RtmpvagRhg/file164e543b3278e/semPlot_1.1.4.tar.gz’ had non-zero exit status

Я не знаю, виноват ли это, или OpenMX а также semPlot может страдать от той же проблемы, но я получаю тот же результат, когда пытаюсь установить его ... тысячи строк (и около 20 минут бесплодной работы), прежде чем он просто исчезнет, ​​без каких-либо ошибок, просто «ненулевой статус выхода».

Я читал много похожих вопросов здесь, на SO, но у большинства из них не найден какой-то зависимый пакет, например glasso или же XMLотсутствует компилятор fortran, но у меня нет подобных ссылок в моем выводе, и все эти пакеты у меня все равно установлены. У меня просто куча таких выводов (это из неуспешного OpenMx попытка установки:

      In file included from povRAM.cpp:2:
In file included from ./omxExpectation.h:32:
In file included from ./omxDefines.h:21:
In file included from /Users/xxxxxxxxx/opt/anaconda3/envs/r_env/lib/R/library/Rcpp/include/Rcpp.h:27:
In file included from /Users/xxxxxxxxx/opt/anaconda3/envs/r_env/lib/R/library/Rcpp/include/RcppCommon.h:120:
In file included from /Users/xxxxxxxxx/opt/anaconda3/envs/r_env/lib/R/library/Rcpp/include/Rcpp/proxy/proxy.h:22:
/Users/xxxxxxxxx/opt/anaconda3/envs/r_env/lib/R/library/Rcpp/include/Rcpp/proxy/NamesProxy.h:32:21: warning: definition of implicit copy constructor for 'NamesProxy' is deprecated because it has a user-declared copy assignment operator [-Wdeprecated-copy]
        NamesProxy& operator=(const NamesProxy& rhs) {
                    ^
/Users/xxxxxxxxx/opt/anaconda3/envs/r_env/lib/R/library/Rcpp/include/Rcpp/proxy/NamesProxy.h:83:16: note: in implicit copy constructor for 'Rcpp::NamesProxyPolicy<Rcpp::Vector<19, PreserveStorage> >::NamesProxy' first required here
        return NamesProxy( static_cast<CLASS&>(*this) ) ;
               ^
/Users/xxxxxxxxx/opt/anaconda3/envs/r_env/lib/R/library/Rcpp/include/Rcpp/api/meat/module/Module.h:35:11: note: in instantiation of member function 'Rcpp::NamesProxyPolicy<Rcpp::Vector<19, PreserveStorage> >::names' requested here
            info.names() = names ;
                 ^
In file included from povRAM.cpp:3:
In file included from ./path.h:6:
./polynomial.h:26:2: warning: definition of implicit copy assignment operator for 'Monomial<double>' is deprecated because it has a user-declared copy constructor [-Wdeprecated-copy]
        Monomial(const Monomial<F> &from) { coeff = from.coeff; exponent = from.exponent; }
        ^
/Users/xxxxxxxxx/opt/anaconda3/envs/r_env/bin/../include/c++/v1/__tree:1691:39: note: in implicit copy assignment operator for 'Monomial<double>' first required here
            __cache.__get()->__value_ = *__first;
                                      ^
/Users/xxxxxxxxx/opt/anaconda3/envs/r_env/bin/../include/c++/v1/__tree:1648:9: note: in instantiation of function template specialization 'std::__1::__tree<Monomial<double>, std::__1::less<Monomial<double> >, std::__1::allocator<Monomial<double> > >::__assign_multi<std::__1::__tree_const_iterator<Monomial<double>, std::__1::__tree_node<Monomial<double>, void *> *, long> >' requested here
        __assign_multi(__t.begin(), __t.end());
        ^
/Users/xxxxxxxxx/opt/anaconda3/envs/r_env/bin/../include/c++/v1/set:538:21: note: in instantiation of member function 'std::__1::__tree<Monomial<double>, std::__1::less<Monomial<double> >, std::__1::allocator<Monomial<double> > >::operator=' requested here
            __tree_ = __s.__tree_;
                    ^
./polynomial.h:183:13: note: in instantiation of member function 'std::__1::set<Monomial<double>, std::__1::less<Monomial<double> >, std::__1::allocator<Monomial<double> > >::operator=' requested here
                monomials = erg.monomials;
                          ^
povRAM.cpp:299:16: note: in instantiation of member function 'Polynomial<double>::operator+=' requested here
                        polyRep[nn] += term;
                                    ^
95 warnings and 7 errors generated.
make: *** [/Users/xxxxxxxxx/opt/anaconda3/envs/r_env/lib/R/etc/Makeconf:175: povRAM.o] Error 1
ERROR: compilation failed for package ‘OpenMx’
* removing ‘/Users/xxxxxxxxx/opt/anaconda3/envs/r_env/lib/R/library/OpenMx’
Warning in install.packages :
  installation of package ‘OpenMx’ had non-zero exit status

The downloaded source packages are in
    ‘/private/var/folders/8_/ql9yb6nn4076n1y9vptzpqwm0000gp/T/Rtmp8fpYnY/downloaded_packages’
Updating HTML index of packages in '.Library'
Making 'packages.html' ... done

Предупреждение, которое появляется снова и снова во всех этих выходных данных, следующее:

      warning: definition of implicit copy constructor ...

как в:

      /Users/xxxxxxxxx/opt/anaconda3/envs/r_env/lib/R/library/Rcpp/include/Rcpp/proxy/NamesProxy.h:32:21: warning: definition of implicit copy constructor for 'NamesProxy' is deprecated because it has a user-declared copy assignment operator [-Wdeprecated-copy]
        NamesProxy& operator=(const NamesProxy& rhs) {
                    ^

или это

      /Users/xxxxxxxxx/opt/anaconda3/envs/r_env/lib/R/library/Rcpp/include/Rcpp/proxy/AttributeProxy.h:33:25: warning: definition of implicit copy constructor for 'AttributeProxy' is deprecated because it has a user-declared copy assignment operator [-Wdeprecated-copy]
            AttributeProxy& operator=(const AttributeProxy& rhs){
                            ^

или это

      /Users/xxxxxxxxx/opt/anaconda3/envs/r_env/lib/R/library/RcppEigen/include/Eigen/src/SparseCore/SparsePermutation.h:162:1: note: candidate template ignored: could not match 'InverseImpl' against 'Transpose'
operator*(const SparseMatrixBase<SparseDerived>& matrix, const InverseImpl<PermutationType, PermutationStorage>& tperm)
^
povRAM.cpp:157:24: error: use of undeclared identifier 'curProd'
                        if (tx == 1) prev = curProd.nonZeros();
                                            ^

Это просто большой беспорядок, и я понятия не имею, что происходит, почему и что с этим делать. Есть предположения?

2 ответа

Вероятно, ваши проблемы вызваны запуском R через Anaconda. Следуя этим шагам, я успешно установил OpenMX и semPlot без ошибок на macOS 11.4 / Rv4.0, но вам придется попробовать, чтобы узнать, будут ли они работать на conda R3.6.3.

  1. Установите xcode из магазина приложений (инструкции по установке xcode ), затем установите / переустановите инструменты командной строки xcode из терминала:
      # To delete an existing command line tools installation:
sudo rm -rf /Library/Developer/CommandLineTools

# To install the command line tools
sudo xcode-select --install
  1. Установите gcc & llvm через Homebrew (инструкция по установке Homebrew ) или, если у вас уже установлены gcc и llvm, перейдите к шагу 3.
      # WARNING: This can take several hours
brew install gcc
brew install llvm
  1. Если у вас уже установлены gcc и llvm через Homebrew:
      brew cleanup
brew update
brew upgrade
brew reinstall gcc
brew reinstall llvm
  1. Свяжите некоторые заголовки с / usr / local / include
      sudo ln -s /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/* /usr/local/include/

# You can ignore warnings like this:
#ln: /usr/local/include//tcl.h: File exists
#ln: /usr/local/include//tclDecls.h: File exists
#ln: /usr/local/include//tclPlatDecls.h: File exists
#ln: /usr/local/include//tclTomMath.h: File exists
#ln: /usr/local/include//tclTomMathDecls.h: File exists
#ln: /usr/local/include//tk.h: File exists
#ln: /usr/local/include//tkDecls.h: File exists
#ln: /usr/local/include//tkPlatDecls.h: File exists
  1. Проверьте свою версию gfortran ( cd /usr/local/gfortran/lib/gcc/x86_64-apple-darwin19/; ls) затем отредактируйте свой ~/.R/Makevars файл (если у вас нет файла с именем Makevars в твоей ~/.R/ каталог или эквивалентный каталог conda R, создайте его) и включите только эти строки:
      LOC = /usr/local/gfortran
CC=$(LOC)/bin/gcc -fopenmp
CXX=$(LOC)/bin/g++ -fopenmp
CXX11 = $(LOC)/bin/g++ -fopenmp

CFLAGS=-g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe
CXXFLAGS=-g -O3 -Wall -pedantic -std=c++11 -mtune=native -pipe
LDFLAGS=-L$(LOC)/lib -Wl,-rpath,$(LOC)/lib
CPPFLAGS=-I$(LOC)/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include

# (check that the version of gfortran - in this case 10.2.0 - matches the version specified in FLIBS)
FLIBS=-L/usr/local/gfortran/lib/gcc/x86_64-apple-darwin19/10.2.0 -L/usr/local/gfortran/lib -lgfortran -lquadmath -lm
CXX1X=/usr/local/gfortran/bin/g++
CXX98=/usr/local/gfortran/bin/g++
CXX11=/usr/local/gfortran/bin/g++
CXX14=/usr/local/gfortran/bin/g++
CXX17=/usr/local/gfortran/bin/g++
  1. Откройте R и установите пакеты (при запросе скомпилируйте из источника = "Да"):
      install.packages("qgraph")
install.packages("OpenMx")
devtools::install_github("SachaEpskamp/semPlot")

Тогда, надеюсь, все загрузится так, как должно.

Спасибо за подробный совет. Сначала я попытался исправить это в своей среде Anaconda, запустив conda forgeустановка в моем r_env из терминала. Он установлен, но ему также удалось сломать мою установку RStudio, чтобы она больше не открывалась. Хорошо, урок усвоен. Я удалил весь свой r_env в Anaconda и последовал совету @MrFlick по установке чистых новых версий R и RStudio с их официальных сайтов загрузки. Когда я открыл свое новое приложение RStudio, я смог установить semPlot, который установил свою зависимость OpenMxБез промедления. Снова в деле.

Другие вопросы по тегам