Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

no_heavy_import test fails on =dandi-cli-0.59.0 due to numpy #1394

Open
TheChymera opened this issue Jan 25, 2024 · 6 comments
Open

no_heavy_import test fails on =dandi-cli-0.59.0 due to numpy #1394

TheChymera opened this issue Jan 25, 2024 · 6 comments
Assignees

Comments

@TheChymera
Copy link
Contributor

Full build log → https://ppb.chymera.eu/6b5527.log

@TheChymera TheChymera self-assigned this Jan 25, 2024
@yarikoptic
Copy link
Member

since it doesn't fail for us here -- would be for you to figure out I am afraid. I usually do something like (didn't test -- just typing but you will get the idea)

mkdir evilmods
echo "raise ImportError('gotcha')" >| evilmods/numpy.py
PYTHONPATH=$PWD/evilmods:$PYTHONPATH python -c "import dandi.cli.command"

and look at traceback on what imports that numpy and how come... e.g. do you patch anything?

@yarikoptic
Copy link
Member

@TheChymera ping on this so we know how to proceed on this one

@TheChymera
Copy link
Contributor Author

TheChymera commented Feb 1, 2024

@yarikoptic haven't figured out what's happening yet, don't close it.

@TheChymera
Copy link
Contributor Author

[deco]~/src/dandi-cli ❱ mkdir evilmods
[deco]~/src/dandi-cli ❱ echo "raise ImportError('gotcha')" >| evilmods/numpy.py
[deco]~/src/dandi-cli ❱ PYTHONPATH=$PWD/evilmods:$PYTHONPATH python -c "import dandi.cli.command"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/chymera/src/dandi-cli/dandi/cli/command.py", line 143, in <module>
    from .cmd_download import download  # noqa: E402
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/chymera/src/dandi-cli/dandi/cli/cmd_download.py", line 10, in <module>
    from ..dandiset import Dandiset
  File "/home/chymera/src/dandi-cli/dandi/dandiset.py", line 14, in <module>
    from .files import DandisetMetadataFile, LocalAsset, dandi_file, find_dandi_files
  File "/home/chymera/src/dandi-cli/dandi/files/__init__.py", line 23, in <module>
    from ._private import BIDSFileFactory, DandiFileFactory
  File "/home/chymera/src/dandi-cli/dandi/files/_private.py", line 18, in <module>
    from .bids import (
  File "/home/chymera/src/dandi-cli/dandi/files/bids.py", line 14, in <module>
    from .zarr import ZarrAsset
  File "/home/chymera/src/dandi-cli/dandi/files/zarr.py", line 17, in <module>
    from zarr_checksum.tree import ZarrChecksumTree
  File "/usr/lib/python3.11/site-packages/zarr_checksum/__init__.py", line 4, in <module>
    from zarr_checksum.generators import FileGenerator
  File "/usr/lib/python3.11/site-packages/zarr_checksum/generators.py", line 12, in <module>
    from zarr.storage import NestedDirectoryStore
  File "/usr/lib/python3.11/site-packages/zarr/__init__.py", line 2, in <module>
    from zarr.codecs import *
  File "/usr/lib/python3.11/site-packages/zarr/codecs.py", line 2, in <module>
    from numcodecs import *
  File "/usr/lib/python3.11/site-packages/numcodecs/__init__.py", line 27, in <module>
    from numcodecs.zlib import Zlib
  File "/usr/lib/python3.11/site-packages/numcodecs/zlib.py", line 5, in <module>
    from .compat import ndarray_copy, ensure_contiguous_ndarray
  File "/usr/lib/python3.11/site-packages/numcodecs/compat.py", line 8, in <module>
    import numpy as np
  File "/home/chymera/src/dandi-cli/evilmods/numpy.py", line 1, in <module>
    raise ImportError('gotcha')
ImportError: gotcha

It seems to be numcodecs which ultimately triggers this.

The import is here → https://github.com/zarr-developers/numcodecs/blob/0878717a3613d91a453fe3d3716aa9c67c023a8b/numcodecs/compat.py#L8 and all the imports that lead to it are at the top of their respective modules, not under if statements. So now I'm wondering why this doesn't trigger for anybody else 🤔

@yarikoptic
Copy link
Member

zarr_checksum is kinda the lead of the show here -- and I think whenever

gets released - might self-resolve. But I am surprised (although didn't look in detail) that testing here doesn't pick it up. I guess for now for your gentoo package you could just skip that test

@TheChymera
Copy link
Contributor Author

@yarikoptic

I guess for now for your gentoo package you could just skip that test

Oh yes, I already did that after I filed and referenced the issue. Just wanted to fix this now that I stumbled on it, but I guess it can wait...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants