datalad / datalad-next

DataLad extension for new functionality and improved user experience
https://datalad.org
Other
7 stars 8 forks source link

[WARNING] Could not load extension 'next': ImportError(cannot import name 'Dataset' from partially initialized module 'datalad.api' #703

Closed FeHoff closed 4 months ago

FeHoff commented 4 months ago

I get the following warning but the dataset is setup with the yoda procedure as expected.

❯ dl create -c yoda TEST
[INFO   ] Running procedure cfg_yoda 
[INFO   ] == Command start (output follows) ===== 
[WARNING] Could not load extension 'next': ImportError(cannot import name 'Dataset' from partially initialized module 'datalad.api' (most likely due to a circular import) (/home/fhoffstaedter/datalad_venv/lib/python3.9/site-packages/datalad/api.py)) 
[INFO   ] == Command exit (modification check follows) =====                               
run(ok): /home/fhoffstaedter/DATA_TMP/TEST (dataset) [/home/fhoffstaedter/datalad_venv/bin/pyt...]
create(ok): /home/fhoffstaedter/DATA_TMP/TEST (dataset)
action summary:
  create (ok: 1)
  run (ok: 1)
datalad create -c yoda TEST  7.06s user 2.16s system 95% cpu 9.611 total
❯ cd TEST; dl run-procedure cfg_yoda
[INFO   ] Running procedure cfg_yoda 
[INFO   ] == Command start (output follows) ===== 
[WARNING] Could not load extension 'next': ImportError(cannot import name 'Dataset' from partially initialized module 'datalad.api' (most likely due to a circular import) (/home/fhoffstaedter/datalad_venv/lib/python3.9/site-packages/datalad/api.py)) 
[INFO   ] == Command exit (modification check follows) =====                               
run(ok): /home/fhoffstaedter/DATA_TMP/TEST (dataset) [/home/fhoffstaedter/datalad_venv/bin/pyt...]
datalad run-procedure cfg_yoda  5.98s user 1.42s system 97% cpu 7.565 total
❯ dl --version
datalad 1.0.2
❯ python
Python 3.9.2 (default, Feb 28 2021, 17:03:44) 
[GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from datalad.distribution.dataset import require_dataset 
>>> from datalad.utils import create_tree 
>>> 
>>> ds = require_dataset('.') 
>>> ds
Dataset('/home/fhoffstaedter/DATA_TMP/TEST')
>>> ds.status()
[WARNING] Could not load extension 'next': ImportError(cannot import name 'Dataset' from partially initialized module 'datalad.api' (most likely due to a circular import) (/home/fhoffstaedter/datalad_venv/lib/python3.9/site-packages/datalad/api.py)) 
nothing to save, working tree clean
mih commented 4 months ago

I can replicate this. I have determined the behavior to change after the merge of https://github.com/datalad/datalad-next/pull/669

Specifically, c5b36205ca67c785461d6162104ca8dc478b1075 is still working, but 096a567e36202efe1f1afba250b0b1f62f2af7fc is not. The breakage is still present post-1.4.0 in a8123960eb31227def060fc232f0f811731a62e5

It got fixed via 905b99bd6c3e2c436ba87d097838a06d3ae37eeb in https://github.com/datalad/datalad-next/pull/701

Ping @christian-monch