2

I am trying to build a package using the "conda build fibtestpackage" command.

The "fibtestpackage" is built using Cython, hence in the .sh file I have the command:

python setup.py build_ext --inplace

Even though the Build ends successfully, and the output is as expected:


Fetching packages ... fibtestpackage-1.0.0 100% |################################| Time: 0:00:00 3.03 MB/s

Extracting packages ... [ COMPLETE ] |##################################################| 100%

Linking packages ... [ COMPLETE ] |##################################################| 100%


the one test I have in the YAML file fails. The only test I have looks like this:


test:
  # Python imports
  imports:
      - fibtestpackage
      #- numpy
      #- samplers

Hence, its an import error,

ImportError: No module named fibtestpackage

My first guess for why there is an importerror is because the .SO, .C, and .PYX files generated by the build (and the other files of the library) are NOT being place into the anaconda/lib/python2.7/site-packages/ folder where the other modules are located. Do I need to specify this in the shell file or should this be covered by the "python setup.py build_ext --inplace" command?

My second guess is that there are two different versions of conda (after updating) in the distribution,

1) Python 2.7.8 |Anaconda 2.1.0 (64-bit)| (default, Aug 21 2014, 18:22:21)

2) Python 2.7.8 |Continuum Analytics, Inc.| (default, Aug 21 2014, 18:22:21)

Could this be causing the issue? Perhaps the build environment is installing libraries in the wrong one?

Thank you in advance for your help!

4

1 回答 1

2

Conda build 创建了一个构建 conda 环境,称为_build(通常在 ~/anaconda/envs/_build 中),您应该在其中安装所有内容。对于 Python,python setup.py install如果您将 Python 作为构建依赖项包含在 meta 中,通常这样做就足够了。 yaml,因为python它将是安装在_build环境中的一个,它将安装在那里。

在构建结束时,conda build 将构建环境中的所有新文件包装起来,并从中创建一个 conda 包。如果有一个测试阶段,它会删除_build环境并创建一个名为 的测试环境,_test并在那里安装和运行包。

要调试此问题,请尝试在 ~/anaconda/envs/_test 中运行 Python。

在您的情况下,问题可能python setup.py build_ext --inplace实际上并未安装文件,它只是构建它们。在构建结束时检查它说有多少文件。如果有 0,那么这就是问题所在。

于 2014-10-29T19:14:35.123 回答