anndata
anndata copied to clipboard
from anndata import AnnData fails with flit
In one instance of treating anndata as a dependency within flit, I now get:
from anndata import AnnData
-> ImportError: cannot import name 'AnnData' from 'anndata'
When I replace the import as follows
from anndata._core.anndata import AnnData
it all works fine again.
I vaguely remember we had these name resolution errors many years ago. I post this mostly for reference if someone else needs this workaround.
No action is necessary.
In one instance of treating anndata as a dependency within flit
I'm not sure what you mean here. Could you clarify?
Oh, I have a package that I install with flit, and anndata is a dependency. It all worked fine until yesterday, until this error started to appearing, either due to updates in pip, flit, or anndata. I can't really imagine that anndata is the only package that has their re-export not equal the original definition of the class, but I wouldn't know which other aspect of anndata triggers the error. A 100 other dependencies are installed fine.
If I understand more, I'll update here.
Ah, yeah I vaguely recall something like this. I think @grst ran into it.
I think this could ultimately be solved with a more robust versioning system, but also that's a big wormhole.
Is there a reason you install with flit directly and not pip? pip install -e should be mostly working now.
might be, but I don't remember at all, sorry!
On Wed, 16 Mar 2022 at 15:48, Isaac Virshup @.***> wrote:
Ah, yeah I vaguely recall something like this. I think @grst https://github.com/grst ran into it.
I think this could ultimately be solved with a more robust versioning system, but also that's a big wormhole.
Is there a reason you install with flit directly and not pip? pip install -e should be mostly working now.
— Reply to this email directly, view it on GitHub https://github.com/theislab/anndata/issues/733#issuecomment-1069209472, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABVZRV35F7XIWLGIKK3LZ7LVAHYCHANCNFSM5Q2EKEFQ . You are receiving this because you were mentioned.Message ID: @.***>
I think pip install -e doesn't recognize extras like doc, test when they're in pyproject.toml. Or am I getting something wrong?
pip install -e .[doc]
This also fails here on anndata despite being defined in https://github.com/theislab/anndata/blob/master/pyproject.toml.
That works for me. What's particularly weird for me is that it doesn't fail when the "extras" doesn't exist.
Maybe a newer pip is needed?
pip install -e .[doc]
this should work. If you use zsh (default on macOS), [ is shell syntax though. What if you try:
pip install -e '.[doc]'
Thank you, Phil! I think it was indeed just a lack of escaping [.
pip now works for me.
This issue has been automatically marked as stale because it has not had recent activity. Please add a comment if you want to keep the issue open. Thank you for your contributions!