'Conda dependencies do not install on local package build

I am building a Python package using conda-build. Right now, my structure looks like this:

- my_recipe/
    - meta.yaml
    - build.sh

And my meta.yaml reads thusly:

package:
  name: my_pkg
version: "0.2.0"

source:
  path: ../my_pkg

requirements:
  build:
    - python
    - setuptools
  run:
    - python
    - pandas
    - numpy
    - plotly
    - matplotlib
    - pyqtgraph
    - pyopengl
    - gdal
    - scipy
    - scikit-image

The package itself builds correctly when I run

conda-build my_recipe/

and it installs successfully when I run

conda install -n my_env --use-local ~/miniconda3/envs/my_env/conda-bld/linux-64/my_pkg-0.2.0-py36_0.tar.bz2

However, none of the dependencies listed under run seem to install along with the package. For example, when I import the package in Python it says that pandas could not be found.

Are my dependencies listed in the correct location? Do I also need to list the dependencies in setup.py? The documentation is not very clear on where this information should be.



Solution 1:[1]

As commented by @darthbith, using the --use-local flag with the package name,

conda install -n my_env --use-local my_pkg

works as intended. Using a path to a tarball directly triggers Conda to install without dependencies.

Solution 2:[2]

I found that using the --update-deps flag when installing a local package does install the package's dependencies, as expected. Like this:

conda install --use-local --update-deps my-package-name

Solution 3:[3]

I've had luck telling conda to treat the local directory as a channel:

conda install my-package-name -c file:///FULL_PATH_TO_CONDA/envs/my_env/conda-bld/

I figured this out based on instructions here, although note I didn't have to run conda index first because conda build had already created repodata.json files.

Solution 4:[4]

Specifying the channel works for me.

Actually, you don't even need to specify the full path. For instance, from the folder where the recipe is located (the meta.yaml and build.sh), I build my package with:

conda-build . --output-folder ./build

Then, I install the package with:

conda install my_package_name -c ./build

This will also install the dependencies specified in the meta.yaml. Here is how my meta.yaml looks like.

package:
  name: my_package_name
  version: 0.0.1

source:
  path: .

requirements:
  build:
    - python
    - setuptools

  run:
    - python
    - numpy
    - holopy
    - scikit-image

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 RobinDunn
Solution 3
Solution 4 Miotto