简体   繁体   English

Conda 骨架 pypi:ModuleNotFoundError:没有名为“numpy”的模块

[英]Conda skeleton pypi: ModuleNotFoundError: No module named 'numpy'

I'm trying to create a conda package from a package I've uploaded to PyPI, by following this tutorial .我正在尝试按照本教程从我上传到 PyPI 的包创建 conda 包。 I've downloaded and installed the latest Anaconda environment for Linux (Ubuntu 16.04).我已经为 Linux (Ubuntu 16.04) 下载并安装了最新的 Anaconda 环境。

After installing conda-build I am able to run the conda skeleton pypi click command as per the example, but running it for my own package mf2 , I encounter the error:安装conda-build我可以按照示例运行mf2 conda skeleton pypi click命令,但是为我自己的包mf2运行它,我遇到了错误:

ModuleNotFoundError: No module named 'numpy'

resulting in导致

Error: command failed: <anaconda_path>/python setup.py install

I've already tried to follow the advice from https://github.com/conda/conda/issues/824 but that hasn't helped me:我已经尝试遵循https://github.com/conda/conda/issues/824的建议,但这对我没有帮助:

$ conda install -n _build numpy

EnvironmentLocationNotFound: Not a conda environment: /scratch/anaconda3/envs/_build

$ conda install -n base numpy
Collecting package metadata (current_repodata.json): done
Solving environment: done

# All requested packages already installed.

How do I get get this to work?我如何得到它的工作? Is the problem that numpy is somehow not installed in the temporary environment it's creating? numpy 以某种方式未安装在它创建的临时环境中的问题是什么? If so, how do I make sure it does work?如果是这样,我如何确保它有效?

Full output:完整输出:

$ conda --version
conda 4.8.1

$ which python
/scratch/anaconda3/bin/python
$ python --version
Python 3.7.4

$ conda skeleton pypi mf2
Warning, the following versions were found for mf2
2019.11.2
2019.11.3
Using 2019.11.3
Use --version to specify a different version.
Using url https://files.pythonhosted.org/packages/cc/15/a2fe948e5fdbf9ca3c5e0c18631a1ec7268ff4dcb62b10e0f0b329cbfdce/mf2-2019.11.3.tar.gz (13 KB) for mf2.
Downloading mf2
PyPI URL:  https://files.pythonhosted.org/packages/cc/15/a2fe948e5fdbf9ca3c5e0c18631a1ec7268ff4dcb62b10e0f0b329cbfdce/mf2-2019.11.3.tar.gz
Unpacking mf2...
done
working in /tmp/tmp9da0e5rkconda_skeleton_mf2-2019.11.3.tar.gz
Collecting package metadata (repodata.json): ...working... done
Solving environment: ...working... done

## Package Plan ##

  environment location: /scratch/anaconda3/conda-bld/skeleton_1578498754522/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_place


The following NEW packages will be INSTALLED:

    _libgcc_mutex:    0.1-main               
    ca-certificates:  2019.11.27-0           
    certifi:          2019.11.28-py37_0      
    ld_impl_linux-64: 2.33.1-h53a641e_7      
    libedit:          3.1.20181209-hc058e9b_0
    libffi:           3.2.1-hd88cf55_4       
    libgcc-ng:        9.1.0-hdf63c60_0       
    libstdcxx-ng:     9.1.0-hdf63c60_0       
    ncurses:          6.1-he6710b0_1         
    openssl:          1.1.1d-h7b6447c_3      
    pip:              19.3.1-py37_0          
    python:           3.7.6-h0371630_1       
    pyyaml:           5.2-py37h7b6447c_0     
    readline:         7.0-h7b6447c_5         
    setuptools:       44.0.0-py37_0          
    sqlite:           3.30.1-h7b6447c_0      
    tk:               8.6.8-hbc83047_0       
    wheel:            0.33.6-py37_0          
    xz:               5.2.4-h14c3975_4       
    yaml:             0.1.7-had09818_2       
    zlib:             1.2.11-h7b6447c_3      

Preparing transaction: ...working... done
Verifying transaction: ...working... done
Executing transaction: ...working... done
Applying patch: '/tmp/tmp9da0e5rkconda_skeleton_mf2-2019.11.3.tar.gz/pypi-distutils.patch'
Trying to apply patch as-is
INFO:conda_build.source:Trying to apply patch as-is
INFO conda_build.source:apply_patch(596): Trying to apply patch as-is
patching file core.py
Hunk #1 succeeded at 167 with fuzz 2 (offset 1 line).
Traceback (most recent call last):
  File "setup.py", line 2, in <module>
    import mf2
  File "/tmp/tmp9da0e5rkconda_skeleton_mf2-2019.11.3.tar.gz/mf2-2019.11.3/mf2/__init__.py", line 9, in <module>
    from .multiFidelityFunction import MultiFidelityFunction
  File "/tmp/tmp9da0e5rkconda_skeleton_mf2-2019.11.3.tar.gz/mf2-2019.11.3/mf2/multiFidelityFunction.py", line 12, in <module>
    import numpy as np
ModuleNotFoundError: No module named 'numpy'
$PYTHONPATH = /tmp/tmp9da0e5rkconda_skeleton_mf2-2019.11.3.tar.gz/mf2-2019.11.3

Leaving build/test directories:
  Work:
 /scratch/anaconda3/conda-bld/skeleton_1578498754522/work 
  Test:
 /scratch/anaconda3/conda-bld/skeleton_1578498754522/test_tmp 
Leaving build/test environments:
  Test:
source activate  /scratch/anaconda3/conda-bld/skeleton_1578498754522/_test_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_ 
  Build:
source activate  /scratch/anaconda3/conda-bld/skeleton_1578498754522/_build_env 


Error: command failed: /scratch/anaconda3/conda-bld/skeleton_1578498754522/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_place/bin/python setup.py install

I suspect that the advice in that GitHub issue is rather outdated.我怀疑那个 GitHub 问题中的建议已经过时了。 The current version of conda skeleton pypi doesn't really care about the active environment nor does it use _build , but instead creates a temporary environment in which to attempt to install the package and eventually output a recipe.当前版本的conda skeleton pypi并不真正关心活动环境,也不使用_build ,而是创建一个临时环境,在其中尝试安装包并最终输出配方。 One can add additional requirements to the temporary environment using the --extra-specs flag.可以使用--extra-specs标志向临时环境添加其他要求。 In your case, this should be something like在您的情况下,这应该类似于

conda skeleton pypi --extra-specs numpy mf2

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM