我正在尝试打包我的python代码,以便在Anaconda云上发布。文件夹结构如下所示:
.
├── conda-recipe
│ ├── build.bat
│ ├── build.sh
│ └── meta.yaml
├── demos
│ ├── datasets
│ │ ├── com-amazon.all.dedup.cmty.txt
│ │ ├── com-amazon.ungraph.txt
│ │ ├── email-Eu-core-department-labels.txt
│ │ └── email-Eu-core.txt
│ ├── directed_example.ipynb
│ ├── email_eu_core_network_evaluation-Copy1.ipynb
│ ├── node_classification.ipynb
│ └── zacharys_karate_club_evaluation.ipynb
├── LICENSE.txt
├── README.md
├── setup.py
├── sten
│ ├── embedding.py
│ └── __init__.py
├── test
│ ├── __init__.py
│ └── test_system.py
├── zachary_computed.png
└── zachary_expected.pngmeta.yaml文件:
package:
name: sten
version: "0.1.0"
source:
path: ..
build:
number: 0
noarch: generic
requirements:
build:
- python >=3.7
- setuptools
run:
- python >=3.7
- pypardiso >=0.2.2
- numpy >=1.18.1
- networkx >=2.4
- scipy >=1.4.1
- markdown
test:
imports:
- sten.embedding
about:
home: https://github.com/monomonedula/simple-graph-embedding
license: Apache License 2.0
license_file: LICENSE.txt
summary: Simple deterministic algorithm for generating graph nodes topological embeddings.命令用于构建包(haasad是pypardiso包的通道的名称):conda build conda-recipe -c haasad构建成功,我已经将它上传到这里:https://anaconda.org/monomonedula/sten
但是,在安装了像这样的本地构建:conda install sten --use-local -c haasad和上传到云conda install -c monomonedula sten -c haasad的构建之后,我遇到了几个问题。
conda list中列出的(我已经双重检查了所有内容,我使用的是正确的解释器)。Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: \
Found conflicts! Looking for incompatible packages.
This can take several minutes. Press CTRL-C to abort.
failed
UnsatisfiableError: The following specifications were found to be incompatible with each other:
Output in format: Requested package -> Available versionsconda search sten -c monomonedula --info输出
sten 0.1.0 py38_0
-----------------
file name : sten-0.1.0-py38_0.tar.bz2
name : sten
version : 0.1.0
build : py38_0
build number: 0
size : 16 KB
license : Apache License 2.0
subdir : noarch
url : https://conda.anaconda.org/monomonedula/noarch/sten-0.1.0-py38_0.tar.bz2
md5 : 53661562513861f9433b252c8ae7b5f4
timestamp : 2020-05-23 19:24:36 UTC
dependencies:
- markdown
- networkx >=2.4
- numpy >=1.18.1
- pypardiso >=0.2.2
- python >=3.7
- scipy >=1.4.1
sten 0.1.0 py38_0
-----------------
file name : sten-0.1.0-py38_0.tar.bz2
name : sten
version : 0.1.0
build : py38_0
build number: 0
size : 16 KB
license : Apache License 2.0
subdir : noarch
url : https://conda.anaconda.org/monomonedula/noarch/sten-0.1.0-py38_0.tar.bz2
md5 : 53661562513861f9433b252c8ae7b5f4
timestamp : 2020-05-23 19:24:36 UTC
dependencies:
- markdown
- networkx >=2.4
- numpy >=1.18.1
- pypardiso >=0.2.2
- python >=3.7
- scipy >=1.4.1conda search stellargraph -c stellargraph --info输出
stellargraph 1.0.0 py_0
-----------------------
file name : stellargraph-1.0.0-py_0.tar.bz2
name : stellargraph
version : 1.0.0
build : py_0
build number: 0
size : 7.8 MB
license : Apache Software
subdir : noarch
url : https://conda.anaconda.org/stellargraph/noarch/stellargraph-1.0.0-py_0.tar.bz2
md5 : e62b9c897d0a5481159c1e7cb8024717
timestamp : 2020-05-05 07:54:44 UTC
dependencies:
- gensim >=3.4.0
- ipykernel
- ipython
- matplotlib >=2.2
- networkx >=2.2
- numpy >=1.14
- pandas >=0.24
- python >=3.6
- scikit-learn >=0.20
- scipy >=1.1.0
- tensorflow >=2.1.0我在这里遗漏了什么,我如何正确地包装它?
发布于 2020-05-29 21:06:05
问题在您的meta.yaml文件中。根据一个Anaconda博客文章
允许用户在conda包中分发文档、数据集和源代码。
和
Noarch包减少了在不同架构和Python版本上构建多个不同的纯Python包的开销,方法是在安装时整理平台和Python版本特定的差异。
因为您想要分发一个纯python包,所以应该使用noarch: python。另外,您不需要在python和build中设置run版本。我在下面包括了一个更新的meta.yaml。它还包括它中的构建脚本,因此您不再需要build.sh和build.bat文件。它还将许可证部分修复到conda将接受的内容(仍然是Apache2.0)。
package:
name: sten
version: "0.1.0"
source:
path: ..
build:
number: 0
noarch: python
script: {{ PYTHON }} setup.py install
requirements:
build:
- python
- setuptools
run:
- python
- pypardiso >=0.2.2
- numpy >=1.18.1
- networkx >=2.4
- scipy >=1.4.1
- markdown
test:
imports:
- sten.embedding
about:
home: https://github.com/monomonedula/simple-graph-embedding
license: Apache-2.0
license_family: Apache
license_file: LICENSE.txt
summary: Simple deterministic algorithm for generating graph nodes topological embeddings.下面是使用上面的meta.yaml文件构建和安装这个包的步骤:
git clone https://github.com/monomonedula/simple-graph-embedding
cd simple-graph-embedding/
git checkout 'refactor&cleanup'
# Replace contents of `meta.yaml`
rm conda-recipe/build.sh conda-recipe/build.bat
conda create --yes -n testing python=3.7 conda-build conda-verify
conda activate testing
conda-build --channel haasad .下面是我在3.7环境中安装软件包时所做的工作。您将找到指向sten-0.1.0-py_0.tar.bz2日志输出底部的完整路径。
conda install -n testing /home/jakub/miniconda3/envs/testing/conda-bld/noarch/sten-0.1.0-py_0.tar.bz2
conda activate testing
$CONDA_PREFIX/bin/python -c "import sten"我还在python3.8环境中测试了安装。
conda create --yes -n testing3.8 python=3.8
conda install -n testing3.8 /home/jakub/miniconda3/envs/testing/conda-bld/noarch/sten-0.1.0-py_0.tar.bz2
conda activate testing3.8
$CONDA_PREFIX/bin/python -c "import sten"conda install --use-local sten不是为我工作的
https://stackoverflow.com/questions/61985643
复制相似问题