0

The "recipe" for conda-build may specify to run a test. The basic test imports the package just built. This test fails for me, but when I try to run it manually, everything works fine...

In my meta.yaml:

test:
  imports:
    - foo

This is how build fails:

export PREFIX=/home/wvxvw/anaconda3/conda-bld/foo_1624876704722/_test_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol
export SRC_DIR=/home/wvxvw/anaconda3/conda-bld/foo_1624876704722/test_tmp
Traceback (most recent call last):
  File "/home/wvxvw/anaconda3/conda-bld/foo_1624876704722/test_tmp/run_test.py", line 2, in <module>
    import foo
ModuleNotFoundError: No module named 'foo'
import: 'foo'
Tests failed for foo-0.1.1-py38hd844fa7_0.tar.bz2 - moving package to /home/wvxvw/anaconda3/conda-bld/broken

If I then do:

conda create --name test-foo python=x.x
conda activate test-foo
conda install --offline /home/wvxvw/anaconda3/conda-bld/broken/foo-0.1.1-py38hd844fa7_0.tar.bz2
python
import sys
sys.path = sys.path[1:]  # to make sure current directory isn't on the path
import foo
foo.__spec__
# Prints: ModuleSpec(name='foo', loader=<_frozen_importlib_external.ExtensionFileLoader object at 0x7f17428519a0>, origin='/home/wvxvw/anaconda3/envs/test-foo/lib/python3.8/site-packages/foo.cpython-38-x86_64-linux-gnu.so')

So, it's there, everything's fine. The package was built correctly... why is conda-build not able to import it?

wvxvw
  • 8,089
  • 10
  • 32
  • 61
  • Could you include the full `meta.yaml`? E.g., wondering if the run requirements are odd. Perhaps trying running `conda-build` with the `--dirty` flag to debug the testing environment. – merv Jun 29 '21 at 00:14
  • @merv run only includes `numpy`. You can see the full file here: https://github.com/wvxvw/pylibjpeg-openjpeg/tree/wvxvw/conda-build/conda-pkg . I don't really understand what `--dirty` is supposed to do, but I'll try. – wvxvw Jun 29 '21 at 05:39

0 Answers0