Conda骨架pypi:ModuleNotFoundError:没有名为'numpy'的模块 [英] Conda skeleton pypi: ModuleNotFoundError: No module named 'numpy'

查看:94
本文介绍了Conda骨架pypi:ModuleNotFoundError:没有名为'numpy'的模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图通过遵循

I'm trying to create a conda package from a package I've uploaded to PyPI, by following this tutorial. I've downloaded and installed the latest Anaconda environment for Linux (Ubuntu 16.04).

在安装 conda-build 之后,我可以按照示例运行 conda框架pypi click 命令,但可以在我自己的软件包 mf2 <下运行它/code>,我遇到错误:

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:

ModuleNotFoundError: No module named 'numpy'

导致

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

我已经尝试遵循> https://github.com/conda的建议/conda/issues/824 ,但这对我没有帮助:

I've already tried to follow the advice from https://github.com/conda/conda/issues/824 but that hasn't helped me:

$ 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.

如何获得此效果?是否以某种方式未在其创建的临时环境中安装numpy的问题?如果是这样,我如何确保它能正常工作?

How do I get get this to work? Is the problem that numpy is somehow not installed in the temporary environment it's creating? If so, how do I make sure it does work?

完整输出:

$ 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

推荐答案

我怀疑该GitHub问题中的建议已过时.当前版本的 conda框架pypi 并不真正在意活动环境,也不使用 _build ,而是创建一个临时环境来尝试安装软件包并最终输出一个食谱.可以使用-extra-specs 标志向临时环境添加其他要求.您的情况应该是这样

I suspect that the advice in that GitHub issue is rather outdated. 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. One can add additional requirements to the temporary environment using the --extra-specs flag. In your case, this should be something like

conda skeleton pypi --extra-specs numpy mf2

这篇关于Conda骨架pypi:ModuleNotFoundError:没有名为'numpy'的模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆