# ModuleNotFoundError import tiledbvcf in basics tutorial

**URL:** <https://forum.tiledb.com/t/modulenotfounderror-import-tiledbvcf-in-basics-tutorial/661>\
**Category:** Uncategorized\
**Created:** [February 19, 2024, 10:28pm UTC](https://forum.tiledb.com/t/modulenotfounderror-import-tiledbvcf-in-basics-tutorial/661 "2024-02-19T22:28:57Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sal](https://avatars.discourse-cdn.com/v4/letter/s/58f4c7/32.png) [@Sal](https://forum.tiledb.com/u/Sal)\
**Post date:** [February 19, 2024, 10:28pm UTC](https://forum.tiledb.com/t/modulenotfounderror-import-tiledbvcf-in-basics-tutorial/661/1 "2024-02-19T22:28:57Z")

</div>

New to tiledb. Got a tiledb cloud account with $10 credits. Executing the Notebook TileDB-VCF tutorial. Import tiledbvcf is erroring out. I shouldn’t even need this locally on my mac because I was trying to run it within the TileDB cloud. Anyways went ahead and installed conda and tiledbvcf successfully on my mac using the commands below:

[https://docs.conda.io/projects/conda/en/latest/user-guide/install/macos.html](https://docs.conda.io/projects/conda/en/latest/user-guide/install/macos.html)

```auto
conda create -n tiledbvcf
conda activate tiledbvcf
conda install -c conda-forge -c bioconda -c tiledb tiledbvcf-py

```

```auto
(tiledbvcf) awssal@sal-macbook ~ % python -c "import tiledbvcf; print(tiledbvcf.version)"
0.26.7

```

Still getting the same error ModuleNotFoundError import tiledbvcf . Anybody have a solution?

```auto
import os
import warnings
warnings.filterwarnings("ignore")
import tiledb
import tiledb.cloud
import tiledbvcf
import numpy as np

print(
    f"tiledb v{tiledb.version.version}\n"
    f"numpy v{np. __version__ }\n"
    f"tiledb-vcf v{tiledbvcf.version}\n"
    f"tiledb-cloud v{tiledb.cloud.version.version}\n"
)

```

* * *

```auto
ModuleNotFoundError Traceback (most recent call last)
Input In [1], in <cell line: 6>()
      4 import tiledb
      5 import tiledb.cloud
----> 6 import tiledbvcf
      7 import numpy as np
      9 print(
     10 f"tiledb v{tiledb.version.version}\n"
     11 f"numpy v{np. __version__ }\n"
     12 f"tiledb-vcf v{tiledbvcf.version}\n"
     13 f"tiledb-cloud v{tiledb.cloud.version.version}\n"
     14 )

```

`ModuleNotFoundError: No module named 'tiledbvcf'`

---

<div class="post-metadata">

**Author:** ![seth](https://avatars.discourse-cdn.com/v4/letter/s/f14d63/32.png) [@seth](https://forum.tiledb.com/u/seth)\
**Post date:** [February 19, 2024, 10:43pm UTC](https://forum.tiledb.com/t/modulenotfounderror-import-tiledbvcf-in-basics-tutorial/661/2 "2024-02-19T22:43:02Z")

</div>

Hello @Sal ! When running in TileDB Cloud notebooks we have three image options currently when launching a notebook, `Basic Data Science`, `Genomics` and `Geospatial`. Do you know which notebook image you were in when you were trying to run the tutorial that errored? You need to be in the `Genomics` image for `tiledbvcf` to be available.

TileDB Cloud also supports automatically selecting the notebook image for you for most tutorials. This works if you do not already have a notebook server running. Would you mind linking me to the tutorial you were trying to run and I’ll double check that it defaults to Genomics in the “Launch” button on the notebook details page.

For the module error on your macbook. Can you let me know, is the script you were running in the same conda environment as the one line `python -c "import tiledbvcf; print(tiledbvcf.version)"` you ran? Can you also let me know how you install `tiledb-cloud` was that with `pip`? I’m looking to try to see what might be different between when you ran the python command and then the script.

---

<div class="post-metadata">

**Author:** ![Sal](https://avatars.discourse-cdn.com/v4/letter/s/58f4c7/32.png) [@Sal](https://forum.tiledb.com/u/Sal)\
**Post date:** [February 19, 2024, 11:04pm UTC](https://forum.tiledb.com/t/modulenotfounderror-import-tiledbvcf-in-basics-tutorial/661/3 "2024-02-19T23:04:58Z")

</div>

> [quote=“seth, post:2, topic:661, full:true”]  
> Hello @Sal ! When running in TileDB Cloud notebooks we have three image options currently when launching a notebook, `Basic Data Science`, `Genomics` and `Geospatial`. Do you know which notebook image you were in when you were trying to run the tutorial that errored? You need to be in the `Genomics` image for `tiledbvcf` to be available.

I logged into the cloud console. It automatically selected a ‘Basic data science’ image and I opened up the tutorial\_tiledbvcf\_basics.ipynb. How do I switch to the ‘Genomics’ image ?

> TileDB Cloud also supports automatically selecting the notebook image for you for most tutorials. This works if you do not already have a notebook server running. Would you mind linking me to the tutorial you were trying to run and I’ll double check that it defaults to Genomics in the “Launch” button on the notebook details page.

[https://cloud.tiledb.com/server?id=b3e58b19-58b0-4e45-b4c6-6fcac6add3e0&name=tiledb\_101\_arrays&namespace=TileDB-Inc](https://cloud.tiledb.com/server?id=b3e58b19-58b0-4e45-b4c6-6fcac6add3e0&name=tiledb_101_arrays&namespace=TileDB-Inc)

For the module error on your macbook. Can you let me know, is the script you were running in the same conda environment as the one line `python -c "import tiledbvcf; print(tiledbvcf.version)"` you ran? Can you also let me know how you install `tiledb-cloud` was that with `pip`? I’m looking to try to see what might be different between when you ran the python command and then the script.  
[/quote]

> I did not install tiledb-cloud. I ran the python command from my terminal window on my mac. The TleBD-VCF tutorial Notebook I ran from the TileDB Cloud console.

---

<div class="post-metadata">

**Author:** ![Sal](https://avatars.discourse-cdn.com/v4/letter/s/58f4c7/32.png) [@Sal](https://forum.tiledb.com/u/Sal)\
**Post date:** [February 19, 2024, 11:10pm UTC](https://forum.tiledb.com/t/modulenotfounderror-import-tiledbvcf-in-basics-tutorial/661/4 "2024-02-19T23:10:01Z")

</div>

here is a screenshot of my browser

 ![Screenshot 2024-02-19 at 5.07.49 PM](https://canada1.discourse-cdn.com/flex035/uploads/tiledb/original/1X/7970d9e6e514882a4452e34e7f4382a8e32e7fbe.png)

---

<div class="post-metadata">

**Author:** ![seth](https://avatars.discourse-cdn.com/v4/letter/s/f14d63/32.png) [@seth](https://forum.tiledb.com/u/seth)\
**Post date:** [February 19, 2024, 11:15pm UTC](https://forum.tiledb.com/t/modulenotfounderror-import-tiledbvcf-in-basics-tutorial/661/5 "2024-02-19T23:15:50Z")

</div>

Thanks for the additional details @Sal . In TileDB Cloud the easiest way to switch notebook images is to click the “Shut down” button on the top right corner. After your notebook is shutdown, you can select “Compute” on the left hand side menu. From the compute screen you can then then select launch notebook and select the image type.

Compute screen:

 ![launch-server](https://canada1.discourse-cdn.com/flex035/uploads/tiledb/original/1X/297827b1461776e6ab58c7a5a30056b256948e5d.jpeg)

Select your region:

 ![launch-server-step-2](https://canada1.discourse-cdn.com/flex035/uploads/tiledb/original/1X/4c4e4d063e496977b41818fd61f179d7152a02dd.jpeg)

Select the notebook image type:

 ![launch-server-step-3](https://canada1.discourse-cdn.com/flex035/uploads/tiledb/original/1X/7142985efcb4ce4681e6d7a8ba720b30f4ec0c2a.png)

---

<div class="post-metadata">

**Author:** ![Sal](https://avatars.discourse-cdn.com/v4/letter/s/58f4c7/32.png) [@Sal](https://forum.tiledb.com/u/Sal)\
**Post date:** [February 19, 2024, 11:24pm UTC](https://forum.tiledb.com/t/modulenotfounderror-import-tiledbvcf-in-basics-tutorial/661/6 "2024-02-19T23:24:45Z")

</div>

Thanks Seth. I no longer get the ModuleNotFoundError: No module named ‘tiledbvcf’ now

---

<div class="post-metadata">

**Author:** ![Sal](https://avatars.discourse-cdn.com/v4/letter/s/58f4c7/32.png) [@Sal](https://forum.tiledb.com/u/Sal)\
**Post date:** [February 19, 2024, 11:28pm UTC](https://forum.tiledb.com/t/modulenotfounderror-import-tiledbvcf-in-basics-tutorial/661/7 "2024-02-19T23:28:58Z")

</div>

I am running this notebook cloud/public/TileDB-Inc/tutorial\_tiledbvcf\_basics.ipynb. And now its erroring out at step 8.

```auto
ds.create_dataset(vcf_attrs=batch1_uris[0], enable_allele_count=True, enable_variant_stats=True)

# verify the array exists
os.listdir(array_uri)

```

```auto
[E::hts_open_format] Failed to open file "vfs://s3://tiledb-inc-demo-data/examples/notebooks/vcfs/1kgp3-chr1/HG00096.bcf" : Resource temporarily unavailable
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
Input In [8], in <cell line: 1>()
----> 1 ds.create_dataset(vcf_attrs=batch1_uris[0], enable_allele_count=True, enable_variant_stats=True)
      3 # verify the array exists
      4 os.listdir(array_uri)

File /opt/conda/lib/python3.9/site-packages/tiledbvcf/dataset.py:674, in Dataset.create_dataset(self, extra_attrs, vcf_attrs, tile_capacity, anchor_gap, checksum_type, allow_duplicates, enable_allele_count, enable_variant_stats, compress_sample_dim, compression_level)
    671 self.writer.set_compression_level(compression_level)
    673 # This call throws an exception if the dataset already exists.
--> 674 self.writer.create_dataset()

RuntimeError: TileDB-VCF exception: Cannot convert header to string; bad VCF header.

```

Was I supposed to provide my own AWS storage ?

---

<div class="post-metadata">

**Author:** ![seth](https://avatars.discourse-cdn.com/v4/letter/s/f14d63/32.png) [@seth](https://forum.tiledb.com/u/seth)\
**Post date:** [February 20, 2024, 12:18am UTC](https://forum.tiledb.com/t/modulenotfounderror-import-tiledbvcf-in-basics-tutorial/661/8 "2024-02-20T00:18:21Z")

</div>

@Sal thanks for bringing this additional error up. The root cause is that the bucket where the example VCF files is stored is located in us-east-1. The notebook you launched was in us-west-2. A small adjustment to the tutorial was needed to ensure setting the region. I’ve updated the notebook, the change was in cell #7, adding a config of the region:

````auto
# We set the region to us-east-1 so we can load the example vcf files
ds = tiledbvcf.Dataset(uri=array_uri, mode="w", cfg=tiledbvcf.ReadConfig(tiledb_config={"vfs.s3.region": "us-east-1"}))
ds```
````

---

<div class="post-metadata">

**Author:** ![Sal](https://avatars.discourse-cdn.com/v4/letter/s/58f4c7/32.png) [@Sal](https://forum.tiledb.com/u/Sal)\
**Post date:** [February 20, 2024, 4:04am UTC](https://forum.tiledb.com/t/modulenotfounderror-import-tiledbvcf-in-basics-tutorial/661/9 "2024-02-20T04:04:01Z")

</div>

@seth Now it cannot find the second batch of VCF files in cell #14

```auto
%%time 
ds = tiledbvcf.Dataset(uri=array_uri, mode="w") #Incremental update to the array, previous data is not touched 
ds.ingest_samples(sample_uris = batch2_uris)

---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
File <timed exec>:2, in <module>

File /opt/conda/lib/python3.9/site-packages/tiledbvcf/dataset.py:841, in Dataset.ingest_samples(self, sample_uris, threads, total_memory_budget_mb, total_memory_percentage, ratio_tiledb_memory, max_tiledb_memory_mb, input_record_buffer_mb, avg_vcf_record_size, ratio_task_size, ratio_output_flush, scratch_space_path, scratch_space_size, sample_batch_size, resume, contig_fragment_merging, contigs_to_keep_separate, contigs_to_allow_merging, contig_mode, thread_task_size, memory_budget_mb, record_limit)
    839 if self.schema_version() < 4:
    840 self.writer.register_samples()
--> 841 self.writer.ingest_samples()

RuntimeError: TileDB-VCF exception: Error processing sample; URI 's3://tiledb-inc-demo-data/examples/notebooks/vcfs/1kgp3-chr1/HG00102.bcf' does not exist.

```
