What happens when importing lamindb and the instance is not yet setup?

Hide code cell content
!lamin disconnect
 no instance loaded
# !pip install 'lamindb[jupyter]'
import lamindb as ln
import pytest
! not connected, call: ln.connect('account/name')

If you try to use lamindb, it will raise an InstanceNotSetupError and ask you to init or load an instance via the python API.

Hide code cell content
with pytest.raises(ln.setup.errors.CurrentInstanceNotConfigured):
    ln.track()
ln.setup.init(storage="./testsetup")
 initialized lamindb: testuser1/testsetup

Now we can access functionality:

ln.track("2lhqA4uTKSFP0000")
 created Transform('2lhqA4uTKSFP0000'), started new Run('Ll4JrmAP...') at 2025-07-01 20:16:17 UTC
 notebook imports: lamindb==1.7a1 pytest==8.4.1

Let us try to init another instance in the same Python session.

ln.setup.init(storage="./testsetup2")
 initialized lamindb: testuser1/testsetup2
assert ln.setup.settings.instance.name == "testsetup2"
!lamin delete --force testsetup
!lamin delete --force testsetup2
 deleting instance testuser1/testsetup
 deleting instance testuser1/testsetup2