【问题标题】:conda install in test environmentconda 安装在测试环境中
【发布时间】:2020-10-21 07:57:42
【问题描述】:

我尝试创建自己的(第一个)conda 包,最近几个晚上在 google、stack-overflow 和我的终端之间切换。我坚持以下几点:

我可以使用conda build . 从我的项目(名为mcm)目录成功构建。之后,我按预期在<my-dev-env>/conda-bld/noarch/mcm-v1.0a4-py_0.tar.bz2 中找到了压缩包。

现在我会发现在新环境中测试包是很自然的:

conda create -n test
conda activate test
conda install --use-local mcm

但是找不到包 - 可能是合乎逻辑的,因为test 不知道我的其他环境。我也从我的开发环境中尝试了相同的结果

conda install -n test --use-local mcm

错误总是如下:

Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.

PackagesNotFoundError: The following packages are not available from current channels:

  - mcm

... [list of channels follows]

当然,我可以使用实际 tarball 文件的路径进行安装,但它会排除依赖项,如 here 所述。

我的实际问题是如何做到这一点,但也(不)确认我的唠叨感觉我做错了。我也在conda-build 文档页面上阅读了很多内容,尤其是here

或者为自己的项目构建conda 包(不打算在工作同事之外发布)过度杀伤力,因为用setuptools 构建pip 包似乎容易得多?我刚刚受到使用pip 安装可能会破坏conda 依赖项的说法的影响。

【问题讨论】:

    标签: conda environment conda-build


    【解决方案1】:

    我发现了以下问题:https://github.com/conda/conda/issues/7024。这张票被标记为已关闭,但我似乎仍然对conda 4.8.3 有这个问题。

    好吧,那里提供的解决方法对我有用,例如

    $ conda install -c file:///home/.../miniconda3/envs/dev-env/conda-bld/ mcm
    

    这至少是第一步。

    现在,为了与亲爱的同事分享,我找到了这个: How can I host my own private conda repository?。理想情况下,这将位于文件服务器上,但在工作中,我们现在被 OneDrive 感染。也许这样也行。

    【讨论】:

      猜你喜欢
      • 2022-01-02
      • 2019-01-04
      • 2021-06-22
      • 1970-01-01
      • 2019-08-18
      • 1970-01-01
      • 2021-06-17
      • 1970-01-01
      • 2018-08-14
      相关资源
      最近更新 更多