0

I am getting a Error:

Downloading pytz-2024.1-py2.py3-none-any.whl (505 kB)
ERROR: Ignored the following versions that require a different python version: 1.19.4 Requires-Python >=3.5, <3.9; 2.5.2 Requires-Python !=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,<3.9dev,>=2.7
ERROR: Could not find a version that satisfies the requirement pywin32==306 (from versions: none)
ERROR: No matching distribution found for pywin32==306

I want to run my code for the local chatbot (using Python 3.10.4, Langchain, Ollama, chormadb, and streamlit) in a Docker container using Windows 10.

My Docker file looks like below:

    # Use the official Python image from the Docker Hub
FROM python:3.10.10-slim

# Set the working directory in the container
WORKDIR /app

# Copy the .env file into the container
COPY .env .

# Copy the current directory contents into the container at /app
COPY . /app

# Copy the requirements.txt file into the container
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt

# Expose the port Streamlit will run on
EXPOSE 8501

# Run the Streamlit app
CMD ["streamlit", "run", "rag_debug2.py"]

However, everytime I run the file to build the Docker container, I am facing an error saying that my pytz package with the compatible for current Python version. On the other side, when I check Package pytz by pip show pytz outside the docker container (and inside my python virtual environment), it shows that Package pytz is already there.

(.venv) C:\Users\koshtiu\Desktop\RAG>pip show pytz
Name: pytz
Version: 2024.1
Summary: World timezone definitions, modern and historical    
Home-page: http://pythonhosted.org/pytz
Author: Stuart Bishop
Author-email: [email protected]
License: MIT
Location: c:\users\koshtiu\desktop\rag\.venv\lib\site-packages
Requires:
Required-by: pandas

Could anyone please explain me what is the problem and how to solve it?

2
  • 2
    Show us the actual error and traceback, not a paraphrasing like "My ABC package is not compatible for current python version.".
    – AKX
    Commented Jul 10 at 5:59
  • @AKX: I have edited the question. I hope to get some explanation as a solutiion.
    – Urvesh
    Commented Jul 10 at 8:22

1 Answer 1

4

Based on what I can see (which is not your full requirements and the full build output), your requirements have pywin32==306, either transitively or directly:

ERROR: Could not find a version that satisfies the requirement pywin32==306 (from versions: none)

ERROR: No matching distribution found for pywin32==306

Pywin32 is only available on Windows, and FROM python:3.10.10-slim implies you're building a Linux-based Docker image.

You'll need to get rid of that requirement.

The pytz stuff is likely a red herring here.

6
  • should I write only FROM python:3.10.10 instead of FROM python:3.10.10-slim?
    – Urvesh
    Commented Jul 10 at 8:47
  • 1
    No, I'm not sure where you're getting that idea. I'm saying you need to look at your requirements to figure out why you're depending on pywin32, and not do that, because you can't depend on pywin32 on Linux.
    – AKX
    Commented Jul 10 at 8:49
  • @SiHa That's not the case. docker run -it python:3.10.10-slim pip install pytz works fine. OP is just seeing diagnostics about another version of something that is not getting installed.
    – AKX
    Commented Jul 10 at 8:57
  • @AKX I deleted the pywin32 from requirements.txt and it works fine now. thank you
    – Urvesh
    Commented Jul 10 at 14:38
  • @Urvesh Glad I could help. Please remember to accept my answer too :)
    – AKX
    Commented Jul 10 at 14:40

Not the answer you're looking for? Browse other questions tagged or ask your own question.