简体   繁体   English

使用 conda-build 构建 conda 包时如何包含 pip-only 包?

[英]How to include pip-only package when building conda package by using conda-build?

I would like to build a Conda package for my project.我想为我的项目构建一个 Conda 包。 However, there is one package that is on pip-only (not uploaded to Conda channel).但是,有一个包仅在 pip 上(未上传到 Conda 频道)。 How to include pip only package when using conda-build command?使用 conda-build 命令时如何仅包含 pip 包?

I tried using Conda skeleton to build a package from PyPI URL but it doesn't work because the file on PyPI site is a .whl file instead of a tar.gz file like in the conda skeleton tutorial.我尝试使用 Conda 框架从 PyPI URL 构建包,但它不起作用,因为 PyPI 站点上的文件是 .whl 文件,而不是 conda 框架教程中的 tar.gz 文件。 How should I solve this problem?我应该如何解决这个问题?

This is the error I got for when running the conda build.这是我在运行 conda 构建时遇到的错误。

conda_build.exceptions.DependencyNeedsBuildingError: Unsatisfiable dependencies for platform osx-64: {'plaidml'}

and for skeleton build for plaidml package by using conda skeleton pypi plaidml-keras以及使用conda skeleton pypi plaidml-keras为 plaidml 包构建conda skeleton pypi plaidml-keras

Error: No source urls found for plaidml-keras

Is there a good practice of how to include the pip only package when building conda package?在构建 conda 包时,是否有关于如何包含 pip only 包的好做法?

I looks around in the conda-build docs, and it looks like you can build a conda package using a wheel as a dependency.我在 conda-build 文档中环顾四周,看起来您可以使用轮子作为依赖项构建 conda 包。 From the conda-build user guide docs :来自conda-build 用户指南文档

To build a conda package from a wheel file, install the .whl file in the conda recipe's bld.bat or build.sh file.要从轮文件构建 conda 包,请在 conda 配方的 bld.bat 或 build.sh 文件中安装 .whl 文件。

You may download the .whl file in the source section of the conda recipe's meta.yaml file.您可以在 conda recipe 的 meta.yaml 文件的源部分下载 .whl 文件。

You may instead put the URL directly in the pip install command.您可以将 URL 直接放在 pip install 命令中。

EXAMPLE: The conda recipe for TensorFlow has a pip install command in build.sh with the URL of a .whl file.示例:TensorFlow 的 conda 配方在 build.sh 中有一个 pip install 命令,其中包含 .whl 文件的 URL。 The meta.yaml file does not download or list the .whl file. meta.yaml 文件不会下载或列出 .whl 文件。

Note笔记

It is important to pip install only the one desired package.仅 pip install 一个所需的包很重要。 Whenever possible, install dependencies with conda and not pip.尽可能使用 conda 而不是 pip 安装依赖项。

We strongly recommend using the --no-deps option in the pip install command.我们强烈建议在 pip install 命令中使用 --no-deps 选项。

If you run pip install without the --no-deps option, pip will often install dependencies in your conda recipe and those dependencies will become part of your package.如果您在没有 --no-deps 选项的情况下运行 pip install,pip 通常会在您的 conda 配方中安装依赖项,并且这些依赖项将成为您的包的一部分。 This wastes space in the package and increases the risk of file overlap, file clobbering, and broken packages.这会浪费包中的空间并增加文件重叠、文件损坏和包损坏的风险。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 构建 conda 包:必须使用 conda-build > 2.0 重新构建该包 - Building conda package: The package must be rebuilt with conda-build > 2.0 Jenkins在构建conda程序包时不包含引用的文件 - Jenkins doesn't include refrenced files when building conda package 如何在我的 jupyter 笔记本上安装仅在 pip 上可用而不在 conda 上可用的包? - How to install a package on my jupyter notebook that is only available on pip and not in conda? 如何使用 pip 在 conda 环境中安装“mat73”package? - How to install “mat73” package in a conda environment using pip? 在 conda 环境中使用 pip 是否仅在该 conda 环境中安装 package? - Using pip in a conda envirnment, does that install the package within that conda environment only? 当使用 conda-build 构建 conda 包并且我的代码使用纯 python 库时,我需要在 meta.yaml 文件中放入 build/host/run 什么? - When building conda packages using conda-build and my code uses pure python libraries, what do I need to put in build/host/run in the meta.yaml file? 在 Conda 环境中,如何升级安装了 pip 的包? - In Conda environment, how to upgrade a package that is pip installed? Conda软件包构建错误 - Conda package build error conda-build 和依赖解析 - conda-build and dependency resolution 如何通过 conda-build 配方安装 pip 包? - How do I install pip packages through a conda-build recipe?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM