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

基于environment.yml创建Conda环境时遇到的问题

问题描述

我尝试从UQnet项目的environment.yml文件创建Conda环境,执行命令:

conda env create -f environment.yml

过程前期看似正常,但最终报错终止。我也曾尝试通过Anaconda Navigator创建环境,还卸载了Anaconda、删除临时文件后重新安装,从头操作仍存在问题。以下是具体错误信息:

Channels:
 - defaults
Platform: win-64
Collecting package metadata (repodata.json): done
Solving environment: failed
Channels:
 - defaults
Platform: win-64
Collecting package metadata (repodata.json): done
Solving environment: failed

LibMambaUnsatisfiableError: Encountered problems while solving:
  - nothing provides requested wurlitzer 2.1.0**
  - nothing provides requested unixodbc 2.3.9**
  - nothing provides requested secretstorage 3.3.1**
  - nothing provides requested readline 8.1**
  - nothing provides requested patchelf 0.12**
  - nothing provides requested pango 1.45.3**
  - nothing provides requested ncurses 6.2**
  - nothing provides requested libxcb 1.14**
  - nothing provides requested libuuid 1.0.3**
  - nothing provides requested libtool 2.4.6**
  - nothing provides requested libstdcxx-ng 9.1.0**
  - nothing provides requested libgfortran-ng 7.3.0**
  - nothing provides requested libgcc-ng 9.1.0**
  - nothing provides requested libffi 3.3**
  - nothing provides requested libev 4.33**
  - nothing provides requested libedit 3.1.20210216**
  - nothing provides requested ld_impl_linux-64 2.33.1**
  - nothing provides requested jbig 2.1**
  - nothing provides requested harfbuzz 2.8.0**
  - nothing provides requested gstreamer 1.14.0**
  - nothing provides requested gst-plugins-base 1.14.0**
  - nothing provides requested gmp 6.2.1**
  - nothing provides requested glib 2.68.1**
  - nothing provides requested fontconfig 2.13.1**
  - nothing provides requested dbus 1.13.18**
  - package pyzmq-20.0.0-py36hd77b12b_1 requires zeromq >=4.3.3,<4.3.4.0a0, but none of the providers can be installed
  - package libglib-2.78.4-ha17d25a_0 requires zlib >=1.2.13,<1.3.0a0, but none of the providers can be installed

Could not solve for environment specs
The following packages are incompatible
├─ cairo 1.16.0**  is installable with the potential options
│  ├─ cairo 1.16.0 would require
│  │  └─ glib >=2.69.1,<3.0a0  with the potential options
│  │     ├─ glib 2.78.4 would require
│  │     │  └─ libglib 2.78.4 ha17d25a_0, which requires
│  │     │     └─ zlib >=1.2.13,<1.3.0a0 , which can be installed;
│  │     └─ glib 2.69.1 would require
│  │        └─ pcre >=8.45,<9.0a0 , which can be installed;
│  └─ cairo 1.16.0 would require
│     └─ fontconfig >=2.14.1,<3.0a0 , which requires
│        └─ expat >=2.4.9,<3.0a0 , which can be installed;
├─ dbus 1.13.18**  does not exist (perhaps a typo or a missing channel);
├─ expat 2.3.0**  is not installable because it conflicts with any installable versions previously reported;
├─ fontconfig 2.13.1**  does not exist (perhaps a typo or a missing channel);
├─ glib 2.68.1**  does not exist (perhaps a typo or a missing channel);
├─ gmp 6.2.1**  does not exist (perhaps a typo or a missing channel);
├─ gst-plugins-base 1.14.0**  does not exist (perhaps a typo or a missing channel);
├─ gstreamer 1.14.0**  does not exist (perhaps a typo or a missing channel);
├─ harfbuzz 2.8.0**  does not exist (perhaps a typo or a missing channel);
├─ jbig 2.1**  does not exist (perhaps a typo or a missing channel);
├─ ld_impl_linux-64 2.33.1**  does not exist (perhaps a typo or a missing channel);
├─ libedit 3.1.20210216**  does not exist (perhaps a typo or a missing channel);
├─ libev 4.33**  does not exist (perhaps a typo or a missing channel);
├─ libffi 3.3**  does not exist (perhaps a typo or a missing channel);
├─ libgcc-ng 9.1.0**  does not exist (perhaps a typo or a missing channel);
├─ libgfortran-ng 7.3.0**  does not exist (perhaps a typo or a missing channel);
├─ libstdcxx-ng 9.1.0**  does not exist (perhaps a typo or a missing channel);
├─ libtool 2.4.6**  does not exist (perhaps a typo or a missing channel);
├─ libuuid 1.0.3**  does not exist (perhaps a typo or a missing channel);
├─ libxcb 1.14**  does not exist (perhaps a typo or a missing channel);
├─ ncurses 6.2**  does not exist (perhaps a typo or a missing channel);
├─ pango 1.45.3**  does not exist (perhaps a typo or a missing channel);
├─ patchelf 0.12**  does not exist (perhaps a typo or a missing channel);
├─ pcre 8.44**  is not installable because it conflicts with any installable versions previously reported;
├─ pyzmq 20.0.0**  is installable and it requires
│  └─ zeromq >=4.3.3,<4.3.4.0a0 , which can be installed;
├─ readline 8.1**  does not exist (perhaps a typo or a missing channel);
├─ secretstorage 3.3.1**  does not exist (perhaps a typo or a missing channel);
├─ unixodbc 2.3.9**  does not exist (perhaps a typo or a missing channel);
├─ wurlitzer 2.1.0**  does not exist (perhaps a typo or a missing channel);
├─ zeromq 4.3.4**  is not installable because it conflicts with any installable versions previously reported;
└─ zlib 1.2.11**  is not installable because it conflicts with any installable versions previously reported.
解决方案

核心问题很明确:这个environment.yml是Linux平台的配置文件,你在Windows(win-64)环境执行,很多Linux专属的系统级依赖包在Windows的Conda渠道里根本不存在,比如ld_impl_linux-64、libgcc-ng、unixodbc这些都是Linux特有的组件。

可以按以下步骤解决:

  1. 清理environment.yml中的Linux专属依赖
    • 直接删除所有错误提示里标注“不存在”的包,包括wurlitzer、unixodbc、secretstorage、readline、patchelf、pango、ncurses、libxcb、libuuid、libtool、libstdcxx-ng、libgfortran-ng、libgcc-ng、libffi、libev、libedit、ld_impl_linux-64、jbig、harfbuzz、gstreamer、gst-plugins-base、gmp、glib、fontconfig、dbus。
    • 调整版本冲突的包:比如把zlib的版本改为>=1.2.13,把zeromq改成符合pyzmq要求的>=4.3.3,<4.3.4.0a0版本,或者直接去掉版本号,让Conda自动匹配兼容版本。
  2. 添加conda-forge渠道
    Windows上很多包在默认的defaults渠道没有,执行创建命令时指定conda-forge渠道:
    conda env create -f environment.yml -c conda-forge
    
  3. 手动创建环境并安装核心依赖
    如果修改配置文件仍有问题,直接手动搭建环境,再逐步安装项目必需的核心包:
    conda create -n uqnet python=3.6
    conda activate uqnet
    # 逐个安装项目核心依赖(比如numpy、pytorch等,参考原yml里的核心业务包)
    conda install numpy pytorch torchvision ... -c conda-forge
    

提示:原项目的配置是针对Linux环境编写的,Windows上无法完全复刻,重点保留项目运行必须的Python业务包即可,系统级依赖直接忽略。


内容的提问来源于stack exchange,提问作者Kώστας Κούδας

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.20 23:07:06