【问题标题】:conda-build error: Directory '.' is not installable. Neither 'setup.py' nor 'pyproject.toml' foundconda-build 错误:目录“。”不可安装。未找到“setup.py”和“pyproject.toml”
【发布时间】:2021-12-06 16:31:54
【问题描述】:

大家好,

我正在尝试为我编写的一个小程序构建一个 conda 包。当我运行conda-build 时,我收到错误 Directory '.' is not installable. Neither 'setup.py' nor 'pyproject.toml' found.

我已经研究了几个小时(在这里找到了类似的问题,但都没有解决我的问题)并使用了 meta.yaml 文件(如下),但我没有设法让它工作。有谁知道这里会发生什么?

meta.yaml:

{% set name = "genview" %}
{% set version = "1.0" %}

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

source:
  git_url: https://github.com/EbmeyerSt/GEnView.git

build: 
  number: 0
  script: python -m pip install --no-deps --ignore-installed .

requirements:
  host:
    - pip
    - python=3.6
  run:
    - python=3.6
    - pip
    - pandas
    - biopython >=1.68
    - numpy
    - time
    - sqlite
    - argparse
    - prodigal
    - diamond
    - blast
    - cd-hit
    - fasttree

test:
  commands:
          - genview_create_db.py --help

about:
  home: https://github.com/EbmeyerSt/GEnView.git
  license: GPLv3.0
  license_family: GPL3
  summary: Visualization tool for genomic sequences surrounding a gene

目录结构:

../genview:
  -script.py
  -Readme.txt
   /conda_receipe:
     -meta.yaml

为了构建包,我从 genview 目录运行 conda-build /conda_receipe。有谁知道这里发生了什么?任何线索将不胜感激!

【问题讨论】:

    标签: python pip anaconda conda conda-build


    【解决方案1】:

    根据打包方案,您的项目中需要setup.pypyproject.toml。它们是生成包的配置文件。

    如果要使用setup.py文件,最好使用setuptools

    from setuptools import setup
    
    setup(...)  # add your setuptools options
    

    (请参阅setuptools 用法here 的参考)。

    但是,如果您想改用pyproject.toml,可以参考build 项目。您必须编写pyprojet.toml 文件(类似于INI 的文件)。

    repository 上查看使用这些文件的示例。它使用了这两个文件,因此请看一下它以了解一下。

    【讨论】:

    • 感谢您的回答!我很困惑 - 我在问题中发布的收据(meta.yaml)不应该用于安装而不是 setup.py 吗?这至少是我解释docs.conda.io/projects/conda-build/en/latest/user-guide/recipes/… 的方式?另一方面,conda 文档 (docs.conda.io/projects/conda-build/en/latest/user-guide/…) 使用 setup.py 但没有解释它应该包含什么...
    • 在您链接的用户指南上,他们隐含地使用setup.py(在bld.batbuild.sh 文件上)。 setup.py 提供了 setuptools 选项来构建包元数据(作者、分类器、描述等)。该文件是标准化的,您至少应该在该文件上提供import setuptools; setup()
    • 你是对的,添加了一个setup.py,错误就解决了!
    猜你喜欢
    • 2021-09-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多