Datalad.api works in terminal ipython but not Jupyter lab; how to fix?

I forgot that you are trying it on a Mac. That %conda install command I suggested above won’t work for you then because on the page I linked to there isn’t a MacOS icon listed there under ‘Installers’, like it does here.

I cannot test what you need anyway because of the mac issue anyway. I’d be testing on a linux system.

You somehow need to point the environment running the notebook at where you installed git-annex on your computer. Usually a symbolic link is enough.
From what you have posted about stuff run in your notebooks, it looks like it is looking for stuff in ~/miniconda3/envs/test/lib/python3.7/site-packages/datalad/, but I suspect that was installed by pip. I don’t know though where the conda stuff would be placed in your file hierarchy. If you can determine where conda install stuff gets installed, you’d want to add to there the symbolic link from your local gut-annex install that you say works in the terminal. (I wonder for debugging if you need to think more general here and look for examples of ‘how to link Homebrew installations to Jupyter installs on a Mac’ or something like that, assuming you used Homebrew to install git-annex onto your Mac.)

If you have directions that said you could do this in a Jupyter notebook on a Mac that would be helpful to post. The Datalad documentation I looked at all talked about it being a command line program.