# No module named 'matplotlib' on hailctl dataproc

**URL:** <https://discuss.hail.is/t/no-module-named-matplotlib-on-hailctl-dataproc/1759>\
**Category:** Hail Query & hailctl\
**Created:** [October 29, 2020, 5:38pm UTC](https://discuss.hail.is/t/no-module-named-matplotlib-on-hailctl-dataproc/1759 "2020-10-29T17:38:20Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![lilliank](https://avatars.discourse-cdn.com/v4/letter/l/ecc23a/32.png) [@lilliank](https://discuss.hail.is/u/lilliank)\
**Post date:** [October 29, 2020, 5:38pm UTC](https://discuss.hail.is/t/no-module-named-matplotlib-on-hailctl-dataproc/1759/1 "2020-10-29T17:38:20Z")

</div>

I seem to not be able to run a  
`import matplotlib.pyplot as plt`  
on a hail dataproc. Numpy, scipy, and other packages are working, and matplotlib is installed on my computer. Is there somewhere on the vm that I can run a pip install matplotlib?

Thanks!

---

<div class="post-metadata">

**Author:** ![tpoterba](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.hail.is/tpoterba/32/61_2.png) [@tpoterba](https://discuss.hail.is/u/tpoterba)\
**Post date:** [October 29, 2020, 5:48pm UTC](https://discuss.hail.is/t/no-module-named-matplotlib-on-hailctl-dataproc/1759/2 "2020-10-29T17:48:45Z")

</div>

You can pass packages to install at cluster creation time with `--pkgs`, e.g. `--pkgs matplotlib`.

If you’re using a jupyter notebook running on an existing cluster, you can run shell commands in a jupyter cell:

```auto
! pip install matplotlib

```

---

<div class="post-metadata">

**Author:** ![lilliank](https://avatars.discourse-cdn.com/v4/letter/l/ecc23a/32.png) [@lilliank](https://discuss.hail.is/u/lilliank)\
**Post date:** [October 29, 2020, 5:50pm UTC](https://discuss.hail.is/t/no-module-named-matplotlib-on-hailctl-dataproc/1759/3 "2020-10-29T17:50:42Z")

</div>

I ran a  
`! pip install matplotlib`  
and got the error:  
`/bin/sh: 1: pip: not found `

---

<div class="post-metadata">

**Author:** ![tpoterba](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.hail.is/tpoterba/32/61_2.png) [@tpoterba](https://discuss.hail.is/u/tpoterba)\
**Post date:** [October 29, 2020, 5:51pm UTC](https://discuss.hail.is/t/no-module-named-matplotlib-on-hailctl-dataproc/1759/4 "2020-10-29T17:51:32Z")

</div>

try `python3 -m pip install matplotlib`?

---

<div class="post-metadata">

**Author:** ![lilliank](https://avatars.discourse-cdn.com/v4/letter/l/ecc23a/32.png) [@lilliank](https://discuss.hail.is/u/lilliank)\
**Post date:** [October 29, 2020, 5:57pm UTC](https://discuss.hail.is/t/no-module-named-matplotlib-on-hailctl-dataproc/1759/5 "2020-10-29T17:57:29Z")

</div>

I get the same error, that there is no module named pip. I also tried taking out the pip, after which the error was no module named install

I am currently restarting the cluster with the `--pkgs matplotlib` tag

---

<div class="post-metadata">

**Author:** ![tpoterba](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.hail.is/tpoterba/32/61_2.png) [@tpoterba](https://discuss.hail.is/u/tpoterba)\
**Post date:** [October 29, 2020, 5:58pm UTC](https://discuss.hail.is/t/no-module-named-matplotlib-on-hailctl-dataproc/1759/6 "2020-10-29T17:58:49Z")

</div>

Looking at our init scripts, it appears the Python installation running the notebook is `/opt/conda/default/bin/python`. So I think `/opt/conda/default/bin/python -m pip install matplotlib` should work

---

<div class="post-metadata">

**Author:** ![lilliank](https://avatars.discourse-cdn.com/v4/letter/l/ecc23a/32.png) [@lilliank](https://discuss.hail.is/u/lilliank)\
**Post date:** [October 29, 2020, 6:44pm UTC](https://discuss.hail.is/t/no-module-named-matplotlib-on-hailctl-dataproc/1759/7 "2020-10-29T18:44:21Z")

</div>

Restarting the cluster with the pkgs tag worked, thank you so much!
