跳转至

技术私房菜

这作者关于生物信息学、互联网 IT、运维开发、软件安装部署、测评使用等方向的文章集合,大部分为原创。

  1. 本节点的所有文章均来源于个人在 GitHub 的 “Digital-Garden” 仓库讨论区。

  2. 基于 GitHub Actions + 一系列 Python script 实现每天同步更新与部署。

正确的打开方式

这部分的文章内容仅仅代表我的个人观点,由于技术的更新,如果你发现有些内容已经失效或者错误,欢迎在评论区指出来,我希望我的文章能被别人整理能被修改,因为文章会有错误,也会需要时常更新。

为什么我不在微信公众号上写文章 - 陈皓

最重要的是,我希望我的文章和观点是有讨论的,希望我的文章能被指正和批评,最好是引发讨论和思辨,这样才会让我们每一个人都可以在交流中成长。很多时候,文章本身并没有什么太大的价值,而引发的讨论和思辨才更有价值,这是我认为文章传播最正确的姿势。


SciPy 安装无法识别 BLAS 和 LAPACK

这个问题出现在 import sklearn 时候,调用 from scipy.linalg import _flapack,出现 undefined symbol: sgeqrt_ 错误。

$ /ifs1/SoftWare/Python-3.10.16/bin/python3
Python 3.10.16 (main, Feb 11 2025, 13:45:26) [GCC 7.3.1 20180303 (Red Hat 7.3.1-5)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sklearn
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/ifs1/SoftWare/Python-3.10.16/lib/python3.10/site-packages/sklearn/__init__.py", line 82, in <module>
    from .base import clone
  File "/ifs1/SoftWare/Python-3.10.16/lib/python3.10/site-packages/sklearn/base.py", line 17, in <module>
    from .utils import _IS_32BIT
  File "/ifs1/SoftWare/Python-3.10.16/lib/python3.10/site-packages/sklearn/utils/__init__.py", line 29, in <module>
    from .fixes import parse_version, threadpool_info
  File "/ifs1/SoftWare/Python-3.10.16/lib/python3.10/site-packages/sklearn/utils/fixes.py", line 19, in <module>
    import scipy.stats
  File "/ifs1/SoftWare/Python-3.10.16/lib/python3.10/site-packages/scipy/stats/__init__.py", line 391, in <module>
    from .stats import *
  File "/ifs1/SoftWare/Python-3.10.16/lib/python3.10/site-packages/scipy/stats/stats.py", line 174, in <module>
    from scipy.spatial.distance import cdist
  File "/ifs1/SoftWare/Python-3.10.16/lib/python3.10/site-packages/scipy/spatial/__init__.py", line 101, in <module>
    from ._procrustes import procrustes
  File "/ifs1/SoftWare/Python-3.10.16/lib/python3.10/site-packages/scipy/spatial/_procrustes.py", line 9, in <module>
    from scipy.linalg import orthogonal_procrustes
  File "/ifs1/SoftWare/Python-3.10.16/lib/python3.10/site-packages/scipy/linalg/__init__.py", line 195, in <module>
    from .misc import *
  File "/ifs1/SoftWare/Python-3.10.16/lib/python3.10/site-packages/scipy/linalg/misc.py", line 4, in <module>
    from .lapack import get_lapack_funcs
  File "/ifs1/SoftWare/Python-3.10.16/lib/python3.10/site-packages/scipy/linalg/lapack.py", line 808, in <module>
    from scipy.linalg import _flapack
ImportError: /ifs1/SoftWare/Python-3.10.16/lib/python3.10/site-packages/scipy/linalg/_flapack.cpython-310-x86_64-linux-gnu.so: undefined symbol: sgeqrt_
>>>

这个错误的核心原因是:scipy.linalg._flapack 在运行时无法找到 LAPACK 函数的 sgeqrt_

用 AI 优化 mRNA 序列设计软件 LinearDesign 的一些尝试

在 OpenClaw 如火如荼,全民养虾的当下,聚焦一下自己更加关注的 AI 在编程中的应用场景 —— 在编程中如何让 AI 更好为自己服务。本次优化的 LinearDesign 代码也已经提交到 GitHub,感兴趣的小伙伴可以参考。

LinearDesign

LinearDesign 是百度自主研发的 mRNA 序列设计优化算法,其核心功能是同时优化 mRNA 的折叠自由能(MFE)和密码子适应指数(CAI),为研究人员提供专业的序列设计解决方案。

Bioconductor 西湖大学镜像无法下载安装 R 包

Bioconductor 为高通量基因组数据的分析和可视化提供开源工具。Bioconductor 多数软件包采用 R 统计编程语言开发。Bioconductor 每年释出两个版本,并有活跃的用户社区。

版本说明

由于 Bioconductor 的 rsync 上游会自行删除非最新的版本,大部分镜像站仅提供 Bioconductor 的当前最新版本和开发版本,只有少量镜像站点会保留过时的版本。目前已知西湖大学镜像站提供了历史版本的镜像。

详细讨论参见 tuna/issues#1969

问题

先看一下问题,在 R 里面直接配置配置西湖大学的 bioconductor 镜像站,执行 BiocManager::install 包安装提示 “cannot open URL”。

> options(BioC_mirror="https://mirrors.westlake.edu.cn/bioconductor")
> BiocManager::install("ChAMP")
Warning: unable to access index for repository https://mirrors.westlake.edu.cn/bioconductor/packages/3.18/bioc/src/contrib:
  cannot open URL 'https://mirrors.westlake.edu.cn/bioconductor/packages/3.18/bioc/src/contrib/PACKAGES'
Warning: unable to access index for repository https://mirrors.westlake.edu.cn/bioconductor/packages/3.18/data/annotation/src/contrib:
  cannot open URL 'https://mirrors.westlake.edu.cn/bioconductor/packages/3.18/data/annotation/src/contrib/PACKAGES'
Warning: unable to access index for repository https://mirrors.westlake.edu.cn/bioconductor/packages/3.18/data/experiment/src/contrib:
  cannot open URL 'https://mirrors.westlake.edu.cn/bioconductor/packages/3.18/data/experiment/src/contrib/PACKAGES'
Warning: unable to access index for repository https://mirrors.westlake.edu.cn/bioconductor/packages/3.18/workflows/src/contrib:
  cannot open URL 'https://mirrors.westlake.edu.cn/bioconductor/packages/3.18/workflows/src/contrib/PACKAGES'
Warning: unable to access index for repository https://mirrors.westlake.edu.cn/bioconductor/packages/3.18/books/src/contrib:
  cannot open URL 'https://mirrors.westlake.edu.cn/bioconductor/packages/3.18/books/src/contrib/PACKAGES'
Bioconductor version 3.18 (BiocManager 1.30.22), R 4.3.0 (2023-04-21)
Installing package(s) 'ChAMP'

Bioconductor 西湖大学镜像无法下载安装 R 包

Bioconductor 为高通量基因组数据的分析和可视化提供开源工具。Bioconductor 多数软件包采用 R 统计编程语言开发。Bioconductor 每年释出两个版本,并有活跃的用户社区。

版本说明

由于 Bioconductor 的 rsync 上游会自行删除非最新的版本,大部分镜像站仅提供 Bioconductor 的当前最新版本和开发版本,只有少量镜像站点会保留过时的版本。目前已知西湖大学镜像站提供了历史版本的镜像。

详细讨论参见 tuna/issues#1969

问题

先看一下问题,在 R 里面直接配置配置西湖大学的 bioconductor 镜像站,执行 BiocManager::install 包安装提示 “cannot open URL”。

> options(BioC_mirror="https://mirrors.westlake.edu.cn/bioconductor")
> BiocManager::install("ChAMP")
Warning: unable to access index for repository https://mirrors.westlake.edu.cn/bioconductor/packages/3.18/bioc/src/contrib:
  cannot open URL 'https://mirrors.westlake.edu.cn/bioconductor/packages/3.18/bioc/src/contrib/PACKAGES'
Warning: unable to access index for repository https://mirrors.westlake.edu.cn/bioconductor/packages/3.18/data/annotation/src/contrib:
  cannot open URL 'https://mirrors.westlake.edu.cn/bioconductor/packages/3.18/data/annotation/src/contrib/PACKAGES'
Warning: unable to access index for repository https://mirrors.westlake.edu.cn/bioconductor/packages/3.18/data/experiment/src/contrib:
  cannot open URL 'https://mirrors.westlake.edu.cn/bioconductor/packages/3.18/data/experiment/src/contrib/PACKAGES'
Warning: unable to access index for repository https://mirrors.westlake.edu.cn/bioconductor/packages/3.18/workflows/src/contrib:
  cannot open URL 'https://mirrors.westlake.edu.cn/bioconductor/packages/3.18/workflows/src/contrib/PACKAGES'
Warning: unable to access index for repository https://mirrors.westlake.edu.cn/bioconductor/packages/3.18/books/src/contrib:
  cannot open URL 'https://mirrors.westlake.edu.cn/bioconductor/packages/3.18/books/src/contrib/PACKAGES'
Bioconductor version 3.18 (BiocManager 1.30.22), R 4.3.0 (2023-04-21)
Installing package(s) 'ChAMP'

用 Docker 来解决 LinearDesign 的 GLIBC 版本过低问题

LinearDesign 介绍

LinearDesign 是一款用于优化 mRNA 设计的软件,旨在提高 mRNA 的稳定性和免疫原性。该项目由 He Zhang、Liang Zhang、Ang Lin 等研究人员开发,并已在 Nature杂志上发表相关研究成果。LinearDesign 通过算法优化 mRNA 序列,使其在保持高翻译效率的同时,具有更好的结构稳定性。

GitHub 地址:https://github.com/LinearDesignSoftware/LinearDesign

项目快速启动

确保你的系统满足以下依赖要求:
- Clang 11.0.0 或更高版本,或 GCC 4.8.5 或更高版本
- Python 2.7
- GLIBC≥2.29

glibc (GNU C Library) 是 GNU 发布的 C 标准运行库,是 Linux 系统中最底层、最核心的 API,几乎所有应用软件都依赖它。它主要负责封装 Linux 内核系统调用,并提供内存管理、字符串操作、文件操作等标准函数。

在 Ubuntu 18.04.6 LTS 中,GLIBC 最高只有 2.27,在不升级系统更新 GLIBC 风险太大,因此可以考虑用 Docker 的方式来解决 LinearDesign 的 GLIBC 版本过低问题。

用 Docker 来解决 LinearDesign 的 GLIBC 版本过低问题

LinearDesign 介绍

LinearDesign 是一款用于优化 mRNA 设计的软件,旨在提高 mRNA 的稳定性和免疫原性。该项目由 He Zhang、Liang Zhang、Ang Lin 等研究人员开发,并已在 Nature杂志上发表相关研究成果。LinearDesign 通过算法优化 mRNA 序列,使其在保持高翻译效率的同时,具有更好的结构稳定性。

GitHub 地址:https://github.com/LinearDesignSoftware/LinearDesign

项目快速启动

确保你的系统满足以下依赖要求:
- Clang 11.0.0 或更高版本,或 GCC 4.8.5 或更高版本
- Python 2.7
- GLIBC≥2.29

glibc (GNU C Library) 是 GNU 发布的 C 标准运行库,是 Linux 系统中最底层、最核心的 API,几乎所有应用软件都依赖它。它主要负责封装 Linux 内核系统调用,并提供内存管理、字符串操作、文件操作等标准函数。

在 Ubuntu 18.04.6 LTS 中,GLIBC 最高只有 2.27,在不升级系统更新 GLIBC 风险太大,因此可以考虑用 Docker 的方式来解决 LinearDesign 的 GLIBC 版本过低问题。

Python 包和项目管理工具 UV 安装与更新

uv 有人评价是近十年来 Python 生态出现的最好东西,它彻底改变了 Python 的安装和使用方式,尤其在快速解决依赖冲突(这对大型项目至关重要)方面,速度快得惊人。作为一个由 Astral 开发,用 Rust 编写,几乎可以在任何操作系统或平台上运行的免费的开源工具,个人在越来越多的开源模型、项目中都能看到它的身影,uv 似乎已经和 conda 成为了现在 Python 环境构建与管理的标配。

uv-fast
Installing Trio's dependencies with a warm cache.

官方文档 Installing uv 大多数都是先下载 install.sh,然后 sh install.sh 执行安装。

Python 包和项目管理工具 UV 安装与更新

uv 有人评价是近十年来 Python 生态出现的最好东西,它彻底改变了 Python 的安装和使用方式,尤其在快速解决依赖冲突(这对大型项目至关重要)方面,速度快得惊人。作为一个由 Astral 开发,用 Rust 编写,几乎可以在任何操作系统或平台上运行的免费的开源工具,个人在越来越多的开源模型、项目中都能看到它的身影,uv 似乎已经和 conda 成为了现在 Python 环境构建与管理的标配。

uv-fast
Installing Trio's dependencies with a warm cache.

官方文档 Installing uv 大多数都是先下载 install.sh,然后 sh install.sh 执行安装。