# Docker build problem in Python

**URL:** <https://forums.docker.com/t/docker-build-problem-in-python/135459>\
**Category:** Docker Hub\
**Tags:** build\
**Created:** [April 6, 2023, 2:13pm UTC](https://forums.docker.com/t/docker-build-problem-in-python/135459 "2023-04-06T14:13:53Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mdmr0609](https://avatars.discourse-cdn.com/v4/letter/m/c67d28/32.png) [@mdmr0609](https://forums.docker.com/u/mdmr0609)\
**Post date:** [April 6, 2023, 2:13pm UTC](https://forums.docker.com/t/docker-build-problem-in-python/135459/1 "2023-04-06T14:13:53Z")

</div>

Hello,

i am trying to build a Docker-Desktop-Image for my Python Skript but when it gets to installing the Python packages, i get the Error:

```auto
ERROR: Could not find a version that satisfies the requirement aiohttp==3.8.4 (from versions: none)
ERROR: No matching distribution found for aiohttp==3.8.4
WARNING: There was an error checking the latest version of pip.

```

aiohttp is just an example, it is the same for other libraries like pandas.  
I also checked the version of pip (3.11). I use Windows-Container (v. 4.13.1).  
The Dockerfile looks like:

```auto
FROM python:3.11
COPY . /app
WORKDIR /app
RUN pip install -r requirements.txt
CMD ["python", "./app.py"]

```

It works, when I dont use Python Libraries.

---

<div class="post-metadata">

**Author:** ![rimelek](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/rimelek/32/41602_2.png) [@rimelek](https://forums.docker.com/u/rimelek)\
**Post date:** [April 6, 2023, 11:53pm UTC](https://forums.docker.com/t/docker-build-problem-in-python/135459/2 "2023-04-06T23:53:05Z")

</div>

Libraries can support different versions for different Python versions. To find out what is the latest supported version the easiest way I know is installing without version constraint and running `pip freeze` to get the version of the installed library so you can add that to the requirements file.

> [@mdmr0609](#):
>
> version of pip (3.11).

That is the version of PYthon, not pip the error is probably caused by the python version.

Ps: I added code blocks to your post, please use code formatting next time to help us to understand your question more easily.

> [@How to format your forum posts](https://forums.docker.com/t/how-to-format-your-forum-posts/127295):
>
> The Docker forum is using [Discourse](https://www.discourse.org/), which supports several ways to format your posts: Markdown; see [commonmark.org/help](https://commonmark.org/help/) for an interactive tutorial BBCode A small selection of HTML Any combination of the above Blank lines for formatting and readability Quite often you’ll need an empty line above specific formatting to make it work. You also need to type blank lines to create proper paragraphs; just pressing Return once and then typing a new block of text right below a previous block only …

---

<div class="post-metadata">

**Author:** ![mdmr0609](https://avatars.discourse-cdn.com/v4/letter/m/c67d28/32.png) [@mdmr0609](https://forums.docker.com/u/mdmr0609)\
**Post date:** [April 11, 2023, 9:04am UTC](https://forums.docker.com/t/docker-build-problem-in-python/135459/3 "2023-04-11T09:04:02Z")

</div>

Thank you for your response. I created the requirements.txt with pip freeze \> requirements.txt, so python created the .txt-file itself. I looked up so many sites but i could not find any solution yet. I tried a Code without Python libraries and it worked.

---

<div class="post-metadata">

**Author:** ![rimelek](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/rimelek/32/41602_2.png) [@rimelek](https://forums.docker.com/u/rimelek)\
**Post date:** [April 12, 2023, 4:36pm UTC](https://forums.docker.com/t/docker-build-problem-in-python/135459/4 "2023-04-12T16:36:01Z")

</div>

> [@mdmr0609](#):
>
> I created the requirements.txt with pip freeze \> requirements.txt, so python created the .txt-file itself

Did you run that command inside the container? If you ran it on the host you could have got a different result which doesn’t work in the container especially if the python version on the host is not the same as in the container, but the best is running it in the container.
