Windows环境下R中仅psych包无法安装的问题求助
Hey there, let's troubleshoot this psych package installation problem you're facing. From the error messages you shared, the core issue is that your R version (3.6.3) is too old to support the latest versions of mnormt (a required dependency for psych), and even after installing Rtools, the dependency gap is blocking the installation. Here are a few actionable solutions:
1. Upgrade R to the Latest Stable Version (Recommended)
R 3.6.3 dates back to 2020, and most modern packages (including mnormt and psych) have dropped support for such old versions. Upgrading R will resolve the dependency mismatch entirely:
- Uninstall your current R version from Windows Settings.
- Download and install the latest R release.
- Open RStudio again, then run:
This will automatically pull the compatible binary versions ofinstall.packages("psych")psychand all its dependencies, no compilation needed.
2. Install Older, R 3.6-Compatible Versions of mnormt and psych
If you can't upgrade R right now, you'll need to install legacy versions of the packages that work with R 3.6.3:
Step 1: Install the compatible mnormt version
First, install devtools (if you don't have it already) to access older package versions:
install.packages("devtools")
Then install the mnormt version that supports R 3.6:
devtools::install_version("mnormt", version = "2.0.2")
If devtools gives you trouble, you can also manually download the mnormt_2.0.2.tar.gz file from the CRAN archive, then install it locally with:
install.packages("path/to/mnormt_2.0.2.tar.gz", repos = NULL, type = "source")
Step 2: Install the matching psych version
Once mnormt is installed, install the older psych version that's compatible with R 3.6:
devtools::install_version("psych", version = "1.9.12.31")
This is the binary version mentioned in your error message, and it will work with the mnormt version you just installed.
3. Verify Rtools Configuration (If You Stick to Source Installation)
Even though you installed Rtools, it might not be properly configured in your system path:
- Run this in R to check if Rtools is detected:
devtools::find_rtools() - If it returns
FALSE, manually add the Rtoolsbinandmingw_64/bindirectories to your Windows system PATH (e.g.,C:/Rtools/binandC:/Rtools/mingw_64/bin), then restart RStudio.
Bonus Check: Avoid OneDrive Library Path Issues
Your package library is stored in an OneDrive folder, which can sometimes cause file permission or sync conflicts. If you still run into issues after trying the above, try installing to a local non-synced folder:
install.packages("psych", lib = "C:/R/Library")
内容的提问来源于stack exchange,提问作者Katja Peganc

