Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 如何修复自定义conda程序包的conda UnsatifiableError?_Python_Python 3.x_Anaconda_Conda_Conda Build - Fatal编程技术网

Python 如何修复自定义conda程序包的conda UnsatifiableError?

Python 如何修复自定义conda程序包的conda UnsatifiableError?,python,python-3.x,anaconda,conda,conda-build,Python,Python 3.x,Anaconda,Conda,Conda Build,我正在尝试打包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-depa

我正在尝试打包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.png

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 .
包:
姓名:sten
版本:“0.1.0”
资料来源:
路径:。。
建造:
编号:0
noarch:通用
要求:
建造:
-python>=3.7
-设置工具
运行:
-python>=3.7
-pypardiso>=0.2.2
-numpy>=1.18.1
-networkx>=2.4
-scipy>=1.4.1
-降价
测试:
进口:
-sten
关于:
主页:https://github.com/monomonedula/simple-graph-embedding
许可证:Apache许可证2.0
许可证文件:license.txt
概要:生成图节点拓扑嵌入的简单确定性算法。
我用于构建包的命令(haasad是pypardiso包的通道名称):
conda build conda recipe-c haasad
构建成功,我已将其上载到此处:

但是,在安装后,使用两种本地版本,例如:
conda install sten--使用local-c haasad
并将构建上传到云端
conda install-c monomonedula sten-c haasad
我遇到了几个问题

  • 当使用python 3.7时,我无法导入我的包,即使它列在
    conda list
    中(我已经仔细检查了所有内容,我使用的是正确的解释器)
  • 使用Python3.8时,我可以导入并使用它,但由于未知原因,我无法安装stellargraph。错误消息:
conda 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.1
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
conda搜索星图-c星图--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.1
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


我在这里遗漏了什么以及如何正确地打包它?

问题出在您的
meta.yaml
文件中。根据一份报告:

Noarch通用包允许用户在conda包中分发文档、数据集和源代码

Noarch-Python包通过在安装时整理平台和Python版本特定的差异,减少了在不同体系结构和Python版本上构建多个不同纯Python包的开销

因为要分发纯python包,所以应该使用
noarch:python
。另外,您不需要在
build
run
中设置
python
版本。我在下面添加了一个更新的
meta.yaml
。它还包含构建脚本,因此您不再需要
build.sh
build.bat
文件。它还将许可证部分修复为conda可以接受的内容(仍然是Apache2.0)

以下是我使用上述
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环境中安装软件包的步骤。您将在
conda build
日志输出的底部找到
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安装--使用本地sten
对我不起作用--有一个关于它的问题。

您正在尝试安装到现有环境中吗?如果是这样,可能是以前安装的某些软件包与新版本冲突。如果使用
conda create
而不是
conda install
,会发生什么情况?@StuartBerg我每次都在使用一个干净的新环境。