R
Railway•8mo ago
Nafi

requests dependency warning

I am running the project on Railway. Warning: venv/lib/python3.11/site-packages/requests/__init__.py:109: RequestsDependencyWarning: urllib3 (2.2.1) or chardet (2.3.0)/charset_normalizer (3.3.2) doesn't match a supported version! Environment: Docker, Ubuntu. Building from Dockerfile. Relevant Dockerfile lines:
RUN apt-get update
RUN apt-get install -y python3 python3-pip python3-venv libcairo2-dev pkg-config python3-dev tesseract-ocr ffmpeg poppler-utils libportaudio2 swig libpulse-dev libpango1.0-dev
RUN apt-get clean

# Use the virtual environment
RUN python3 -m venv /usr/src/app/venv

# Install dependencies from requirements.txt
RUN /usr/src/app/venv/bin/pip install --no-cache-dir --upgrade --force-reinstall -r /usr/src/app/requirements.txt
RUN apt-get update
RUN apt-get install -y python3 python3-pip python3-venv libcairo2-dev pkg-config python3-dev tesseract-ocr ffmpeg poppler-utils libportaudio2 swig libpulse-dev libpango1.0-dev
RUN apt-get clean

# Use the virtual environment
RUN python3 -m venv /usr/src/app/venv

# Install dependencies from requirements.txt
RUN /usr/src/app/venv/bin/pip install --no-cache-dir --upgrade --force-reinstall -r /usr/src/app/requirements.txt
Requirements:
wheel

# -- Problematic section --
requests
urllib3>=2.1.0
charset_normalizer
# -------------------------
wheel

# -- Problematic section --
requests
urllib3>=2.1.0
charset_normalizer
# -------------------------
Other requirements omitted for brevity. The warning is shown regardless of whether the requests library is used. Reading online, the consensus is that updating the requests library solves the problem, but I am using the latest version (2.31.0) and the warning is still there. Originally, this was my pip install line in the Dockerfile: RUN /usr/src/app/venv/bin/pip install --no-cache-dir -r /usr/src/app/requirements.txt I added the --upgrade and --force-reinstall flags to no avail. It could be an issue with a library I have omitted, but there are 95 in total and many are likely unrelated.
Solution:
Upgrading pip before installing requirements solved the issue
Jump to solution
16 Replies
Percy
Percy•8mo ago
Project ID: b88cd4f4-3e33-4c82-8bb1-90877719ae87
Nafi
NafiOP•8mo ago
b88cd4f4-3e33-4c82-8bb1-90877719ae87 @Brody any ideas?
Brody
Brody•8mo ago
why are you installing python from apt?
Nafi
NafiOP•8mo ago
its a sandbox
Brody
Brody•8mo ago
not too sure how that answers the question
Nafi
NafiOP•8mo ago
using NodeJS for REST API and it opens a child subprocess using the installed python via apt
Brody
Brody•8mo ago
okay now that answers the question after a quick google, looks like you may be installing an older version of requests
Nafi
NafiOP•8mo ago
No description
Brody
Brody•8mo ago
yeah but im not too sure what the pypi page has to do with this
Nafi
NafiOP•8mo ago
The pypi page doesnt have the latest version recorded?
print(requests.__version__)
print(requests.__version__)
outputs: 2.31.0
Brody
Brody•8mo ago
well you are installing something that isnt compatible with something else
Nafi
NafiOP•8mo ago
it may be an omitted package ^ but theres so many 😭
Brody
Brody•8mo ago
try running pip install --upgrade requests in the dockerfile anyway
Nafi
NafiOP•8mo ago
ok
Solution
Nafi
Nafi•8mo ago
Upgrading pip before installing requirements solved the issue
Brody
Brody•8mo ago
awesome
Want results from more Discord servers?
Add your server