5

I'm new to building conda package. I've uploaded the package to PyPI, so I followed this documentation about building conda from pip package. It works when I tried building pyinstrument from pip, but I got the following error when I tried building my package.

conda_build.exceptions.DependencyNeedsBuildingError: Unsatisfiable dependencies for platform osx-64: {"torch[version='>=0.4']"}

I found a similar issue here, but adding channel didn't fix my issue since pytorch exists in default channel.

Here is my meta.yml file:

{% set name = "scvi" %}
{% set version = "0.1.2" %}
{% set file_ext = "tar.gz" %}
{% set hash_type = "sha256" %}
{% set hash_value = "ca87155662d85605f86c5e86b7b9f64d881b882177b9642fff8f0ea215c6cb1a" %}

package:
  name: '{{ name|lower }}'
  version: '{{ version }}'

source:
  fn: '{{ name }}-{{ version }}.{{ file_ext }}'
  url: https://pypi.io/packages/source/{{ name[0] }}/{{ name }}/{{ name }}-{{ version }}.{{ file_ext }}
  '{{ hash_type }}': '{{ hash_value }}'

build:
  number: 0
  script: python setup.py install --single-version-externally-managed --record=record.txt

requirements:
  run:
    - python 3.6
    - setuptools
    - numpy>=1.0
    - torch>=0.4
    - matplotlib>=2.0
    - scikit-learn>=0.18
    - scipy>=1.0
    - h5py>=2.8
    - pandas>=0.2
    - loompy>=2.0

test:
  imports:
    - scvi
    - scvi.dataset
    - scvi.metrics
    - scvi.models
  requires:
    - pytest

about:
  home: https://github.com/YosefLab/scVI
  license: MIT
  license_family: MIT
  license_file: 'LICENSE'
  summary: Single-cell Variational Inference
  description: Single-cell Variational Inference
  doc_url: https://scvi.readthedocs.io
  dev_url: https://github.com/YosefLab/scVI

Any possible solutions or suggestions on which direction I should look into would be very helpful. Thanks!

darthbith
  • 18,484
  • 9
  • 60
  • 76
Yining.L
  • 133
  • 7

1 Answers1

7

Turns out that there's a bug in the automatically generated meta.yml file by running conda skeleton pypi {package name}. In meta.yml, it should be pytorch instead of torch.

Yining.L
  • 133
  • 7
  • 6
    Well, it's not a bug. The problem is that pytorch is distributed as `torch` on `pypi`, and `pytorch` on `conda`, and it's installed as `torch` on the filesystem. So the `skeleton` program couldn't have possibly known about it. I have just went through the same process of not being able to figure out why conda wasn't finding `torch`, until I realized the mismatch between the two distribution names. What a mess. But I'm glad you too have figured it out! – stason Sep 26 '18 at 03:59