Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: module 'numpy' has no attribute 'str #2609

Open
sainsachiko opened this issue Mar 11, 2024 · 1 comment
Open

AttributeError: module 'numpy' has no attribute 'str #2609

sainsachiko opened this issue Mar 11, 2024 · 1 comment
Labels

Comments

@sainsachiko
Copy link

Get AttributeError: module 'numpy' has no attribute 'str' when trying to load pbmc data

adata = scvi.data.pbmc_dataset()
INFO     File data/gene_info_pbmc.csv already downloaded                                                           
INFO     File data/pbmc_metadata.pickle already downloaded                                                         
INFO     File data/pbmc8k/filtered_gene_bc_matrices.tar.gz already downloaded                                      
INFO     Extracting tar file                                                                                       
INFO     Removing extracted data at data/pbmc8k/filtered_gene_bc_matrices                                          
INFO     File data/pbmc4k/filtered_gene_bc_matrices.tar.gz already downloaded                                      
INFO     Extracting tar file                                                                                       
INFO     Removing extracted data at data/pbmc4k/filtered_gene_bc_matrices                                          
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
[<ipython-input-9-2b688d4bab92>](https://localhost:8080/#) in <cell line: 1>()
      1 if dataset_name == "PBMC_10K":
----> 2     adata = scvi.data.pbmc_dataset()  # 11990 × 3346
      3     ori_batch_col = "batch"
      4     adata.obs["celltype"] = adata.obs["str_labels"].astype("category")
      5     adata.var = adata.var.set_index("gene_symbols")

2 frames
[/usr/local/lib/python3.10/dist-packages/numpy/__init__.py](https://localhost:8080/#) in __getattr__(attr)
    317             # And future warnings for those that will change, but also give
    318             # the AttributeError
--> 319             warnings.warn(
    320                 f"In the future `np.{attr}` will be defined as the "
    321                 "corresponding NumPy scalar.", FutureWarning, stacklevel=2)

AttributeError: module 'numpy' has no attribute 'str'.
`np.str` was a deprecated alias for the builtin `str`. To avoid this error in existing code, use `str` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.str_` here.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
    https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations```

#### Versions:
1.16.4
@martinkim0
Copy link
Contributor

Hi, could you double check what scvi-tools version you have installed and let me know? Our latest release is 1.1.2. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants