# Error: AttributeError 'dict' object has no attribute 'images'

**URL:** <https://discuss.huggingface.co/t/error-attributeerror-dict-object-has-no-attribute-images/22601>\
**Category:** Beginners\
**Created:** [September 6, 2022, 1:32am UTC](https://discuss.huggingface.co/t/error-attributeerror-dict-object-has-no-attribute-images/22601 "2022-09-06T01:32:51Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![dkackman](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/dkackman/32/56859_2.png) [@dkackman](https://discuss.huggingface.co/u/dkackman)\
**Post date:** [September 6, 2022, 1:32am UTC](https://discuss.huggingface.co/t/error-attributeerror-dict-object-has-no-attribute-images/22601/1 "2022-09-06T01:32:51Z")

</div>

I’m just trying the basics from the diffusers readme. Not sure if the install on my machine is somehow horked but every time I try the basic script I get this error the error below.

I’ve tried different conda environments as well as python 3.8.5 and 3.10 but am stumped.

```auto
Exception has occurred: AttributeError
'dict' object has no attribute 'images'

```

```python
from torch import autocast
from diffusers import StableDiffusionPipeline

pipe = StableDiffusionPipeline.from_pretrained("CompVis/stable-diffusion-v1-4", use_auth_token=True)
pipe = pipe.to("cuda")

prompt = "a photo of an astronaut riding a horse on mars"
with autocast("cuda"):
    image = pipe(prompt).images[0]  

```

_EDIT_  
This works.

```python
image = pipe(prompt)["sample"][0]

```

---

<div class="post-metadata">

**Author:** ![brurpo](https://avatars.discourse-cdn.com/v4/letter/b/b487fb/32.png) [@brurpo](https://discuss.huggingface.co/u/brurpo)\
**Post date:** [September 6, 2022, 4:12pm UTC](https://discuss.huggingface.co/t/error-attributeerror-dict-object-has-no-attribute-images/22601/2 "2022-09-06T16:12:24Z")

</div>

Same here, I will post here if I find a solution

---

<div class="post-metadata">

**Author:** ![dkackman](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/dkackman/32/56859_2.png) [@dkackman](https://discuss.huggingface.co/u/dkackman)\
**Post date:** [September 6, 2022, 8:34pm UTC](https://discuss.huggingface.co/t/error-attributeerror-dict-object-has-no-attribute-images/22601/3 "2022-09-06T20:34:55Z")

</div>

Please! Nothing shows up on the google or the github.

---

<div class="post-metadata">

**Author:** ![brurpo](https://avatars.discourse-cdn.com/v4/letter/b/b487fb/32.png) [@brurpo](https://discuss.huggingface.co/u/brurpo)\
**Post date:** [September 6, 2022, 9:04pm UTC](https://discuss.huggingface.co/t/error-attributeerror-dict-object-has-no-attribute-images/22601/4 "2022-09-06T21:04:54Z")

</div>

Got it, just change the following line:  
image = pipe(prompt).images[0]  
to:  
image = pipe(prompt)[“sample”][0]

---

<div class="post-metadata">

**Author:** ![dkackman](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/dkackman/32/56859_2.png) [@dkackman](https://discuss.huggingface.co/u/dkackman)\
**Post date:** [September 11, 2022, 2:34pm UTC](https://discuss.huggingface.co/t/error-attributeerror-dict-object-has-no-attribute-images/22601/5 "2022-09-11T14:34:05Z")

</div>

Looks like it was a change from 0.2.4 to 0.3.0. All the docs were probably from code and we were running form 0.2.4 from conda. conda now has 0.3.0

> **[Release v0.3.0: New API, Stable Diffusion pipelines, low-memory inference,...](https://github.com/huggingface/diffusers/releases/tag/v0.3.0)**
>
> 📚 Shiny new docs!
> Thanks to the community efforts for \[Docs\] and \[Type Hints\] we've started populating the Diffusers documentation pages with lots of helpful guides, links and API references.
> 📝 New...
