# Error message cannot import name 'set\_verbosity' from 'scvi.\_settings' when importing scvi

**URL:** https://discourse.scverse.org/t/error-message-cannot-import-name-set-verbosity-from-scvi-settings-when-importing-scvi/1474
**Category:** scvi-tools
**Tags:** scvi
**Created:** [May 31, 2023, 10:09pm UTC](https://discourse.scverse.org/t/error-message-cannot-import-name-set-verbosity-from-scvi-settings-when-importing-scvi/1474 "2023-05-31T22:09:19Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![katarinavalentincic](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.scverse.org/katarinavalentincic/32/672_2.png) [@katarinavalentincic](https://discourse.scverse.org/u/katarinavalentincic)
#### Post date: [May 31, 2023, 10:09pm UTC](https://discourse.scverse.org/t/error-message-cannot-import-name-set-verbosity-from-scvi-settings-when-importing-scvi/1474/1 "2023-05-31T22:09:19Z")

</div>

I’ve had problems importing scvi, so I’ve created a new conda environment just for integration and downloaded just scvi-tools and scanpy, however I still get an error message while trying to import scvi: ---------------------------------------------------------------------------

ImportError Traceback (most recent call last)

Cell In[10], line 3

**1** import numpy as np

**2** import scanpy as sc

----\> 3 import scvi

**4** import anndata as ann

File [~/miniconda3/envs/scvi-env/lib/python3.9/site-packages/scvi/ **init**.py:14](https://vscode-remote+ssh-002dremote-002b88-002e200-002e30-002e162.vscode-resource.vscode-cdn.net/data/home/katarinav/human_pancreas_data/~/miniconda3/envs/scvi-env/lib/python3.9/site-packages/scvi/ __init__.py:14)

**11** import warnings

**12** from logging import NullHandler

—\> 14 from .\_settings import set\_verbosity, set\_seed

**16** logger = logging.getLogger( **name** )

**17** logger.addHandler(NullHandler())

ImportError: cannot import name ‘set\_verbosity’ from ‘scvi.\_settings’. Has anyone had a similar problem? I am new to coding, so I might have overlooked something.

---

<div class="post-metadata">

### Author: ![martinkim0](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.scverse.org/martinkim0/32/881_2.png) [@martinkim0](https://discourse.scverse.org/u/martinkim0)
#### Post date: [May 31, 2023, 11:04pm UTC](https://discourse.scverse.org/t/error-message-cannot-import-name-set-verbosity-from-scvi-settings-when-importing-scvi/1474/2 "2023-05-31T23:04:06Z")

</div>

Hi, looks like you might be using a previous version of scvi-tools. Could you install the latest version (0.20.3) and see if the problem still persists?

---

<div class="post-metadata">

### Author: ![katarinavalentincic](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.scverse.org/katarinavalentincic/32/672_2.png) [@katarinavalentincic](https://discourse.scverse.org/u/katarinavalentincic)
#### Post date: [May 31, 2023, 11:17pm UTC](https://discourse.scverse.org/t/error-message-cannot-import-name-set-verbosity-from-scvi-settings-when-importing-scvi/1474/3 "2023-05-31T23:17:47Z")

</div>

Before I’ve just installed it with conda forge but now I’ve specified the version and it actually solved the error. Thank you so much!

---

<div class="post-metadata">

### Author: ![martinkim0](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.scverse.org/martinkim0/32/881_2.png) [@martinkim0](https://discourse.scverse.org/u/martinkim0)
#### Post date: [May 31, 2023, 11:29pm UTC](https://discourse.scverse.org/t/error-message-cannot-import-name-set-verbosity-from-scvi-settings-when-importing-scvi/1474/4 "2023-05-31T23:29:48Z")

</div>

Great, glad it worked!

---

<div class="post-metadata">

### Author: ![jmathew9](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.scverse.org/jmathew9/32/829_2.png) [@jmathew9](https://discourse.scverse.org/u/jmathew9)
#### Post date: [October 9, 2023, 3:26pm UTC](https://discourse.scverse.org/t/error-message-cannot-import-name-set-verbosity-from-scvi-settings-when-importing-scvi/1474/5 "2023-10-09T15:26:15Z")

</div>

Hi,  
Even I was getting the same error while trying to import scvi on colab. I tried installing version 0.20.3. Installation was successful, but now when I am importing scvi I am getting another error:

ImportError Traceback (most recent call last)

in \<cell line: 1\>()  
----\> 1 import scvi

2 scvi.settings.seed = 0

* * *

## 5 frames

[/usr/local/lib/python3.10/dist-packages/scvi/data/\_utils.py](https://localhost:8080/#) in 11 import scipy.sparse as sp\_sparse

12 from anndata import AnnData

—\> 13 from anndata.\_core.sparse\_dataset import SparseDataset

14

15 # TODO use the experimental api once we lower bound to anndata 0.8

ImportError: cannot import name ‘SparseDataset’ from ‘anndata.\_core.sparse\_dataset’ (/usr/local/lib/python3.10/dist-packages/anndata/\_core/sparse\_dataset.py)

Importing scvi was working until few days ago. But today when I tried running I got the above error.  
To solve it, I tried upgrading scvi, but after upgrading I started getting the error - cannot import name ‘set verbosity’ from ‘scvi.\_settings’.  
But after installing the specific version 0.20.3, I am getting the first error again(cannot import name ‘SparseDataset’ from ‘anndata.\_core.sparse\_dataset’). Can you help me with this?

---

<div class="post-metadata">

### Author: ![martinkim0](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.scverse.org/martinkim0/32/881_2.png) [@martinkim0](https://discourse.scverse.org/u/martinkim0)
#### Post date: [October 9, 2023, 4:58pm UTC](https://discourse.scverse.org/t/error-message-cannot-import-name-set-verbosity-from-scvi-settings-when-importing-scvi/1474/6 "2023-10-09T16:58:12Z")

</div>

Hi, thank you for bringing up this issue. This is due to the new AnnData 0.10.0 release, which we are working on to get supported. For now, you can fix this by installing an AnnData version \< 0.10.0.

---

<div class="post-metadata">

### Author: ![jmathew9](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.scverse.org/jmathew9/32/829_2.png) [@jmathew9](https://discourse.scverse.org/u/jmathew9)
#### Post date: [October 9, 2023, 7:47pm UTC](https://discourse.scverse.org/t/error-message-cannot-import-name-set-verbosity-from-scvi-settings-when-importing-scvi/1474/7 "2023-10-09T19:47:23Z")

</div>

Thanks! It works now.
