Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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. However, there is one package that is on pip-only (not uploaded to Conda channel). How to include pip only package when using conda-build command?

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. How should I solve this problem?

This is the error I got for when running the conda build.

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

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?

like image 266
asiandudeCom Avatar asked Oct 30 '25 11:10

asiandudeCom


1 Answers

I looks around in the conda-build docs, and it looks like you can build a conda package using a wheel as a dependency. From the conda-build user guide docs:

To build a conda package from a wheel file, install the .whl file in the conda recipe's bld.bat or build.sh file.

You may download the .whl file in the source section of the conda recipe's meta.yaml file.

You may instead put the URL directly in the pip install command.

EXAMPLE: The conda recipe for TensorFlow has a pip install command in build.sh with the URL of a .whl file. The meta.yaml file does not download or list the .whl file.

Note

It is important to pip install only the one desired package. Whenever possible, install dependencies with conda and not pip.

We strongly recommend using the --no-deps option in the pip install command.

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. This wastes space in the package and increases the risk of file overlap, file clobbering, and broken packages.

like image 179
Derek Shoemaker Avatar answered Nov 02 '25 02:11

Derek Shoemaker