You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Ubuntu 18.04新装R后依赖包安装及加载报错求助

Fixing R Package Installation & Loading Errors on Ubuntu 18.04

Hey there, let's break down and fix the issues you're facing with R packages like lubridate and forecast on Ubuntu 18.04.

What's Going Wrong?

Two main compatibility mismatches are causing your headaches:

  • stringi/lubridate failure: The stringi package (a dependency of lubridate) can't find libicui18n.so.57—this means your system is missing the required ICU library files.
  • forecast/curl failure: The curl R package is trying to use CURL_OPENSSL_3, but Ubuntu 18.04's default libcurl version doesn't support that (it uses an older CURL_OPENSSL_1.0.0 instead).

Step-by-Step Solutions

1. Fix the stringi/lubridate Missing Library Error

First, install the system-level ICU development library that stringi needs:

sudo apt-get update && sudo apt-get install libicu-dev

Then reinstall the stringi package from source to ensure it links correctly with your system's ICU:

install.packages("stringi", type = "source", repos = "http://cran.us.r-project.org")

After this, loading lubridate should work without the missing library error.

2. Resolve the forecast/curl Version Mismatch

Ubuntu 18.04 doesn't have the CURL_OPENSSL_3 version that the pre-built curl R package expects. We need to build curl from source using your system's existing libcurl:

Step 1: Install system libcurl development files

Make sure you have the latest libcurl dev package installed:

sudo apt-get install libcurl4-openssl-dev

Step 2: Reinstall curl R package with system libcurl

Fire up R and run this command to force building curl against your system's libcurl:

install.packages("curl", type = "source", configure.args = "--with-libcurl=/usr/lib/x86_64-linux-gnu/")

Step 3: Reinstall forecast

Now that curl is properly linked, reinstall the forecast package:

install.packages("forecast", repos = "http://cran.us.r-project.org")

You should now be able to load forecast without any issues:

library(forecast)

Quick Note on the BH Package Warning

That warning about std::auto_ptr being deprecated in the BH package is nothing to worry about—it's just a heads-up from the Boost library that an old feature is being phased out. It won't break any functionality, so you can safely ignore it.

内容的提问来源于stack exchange,提问作者Blairg23

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.29 08:05:50