Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

uv picks the wrong version of a package and fails (pip does not) #7990

Closed
rsxdalv opened this issue Oct 7, 2024 · 5 comments
Closed

uv picks the wrong version of a package and fails (pip does not) #7990

rsxdalv opened this issue Oct 7, 2024 · 5 comments
Labels
question Asking for clarification or support

Comments

@rsxdalv
Copy link

rsxdalv commented Oct 7, 2024

uv:
https://github.com/rsxdalv/tts-generation-webui/actions/runs/11224348164/job/31200883591
pip:
https://github.com/rsxdalv/tts-generation-webui/actions/runs/11224124790/job/31200229110

context:
Docker image: nvidia/cuda:11.8.0-devel-ubuntu22.04 (Python 3.10.12, uv 0.4.18)
uv pip install --no-cache-dir --system setuptools torch==$TORCH_VERSION torchvision torchaudio
pip3 install --no-cache-dir --upgrade pip==23.3.2 setuptools

breaking point:
uv pip install --no-cache-dir --system --verbose torch==$TORCH_VERSION -r requirements.txt

Requirements file:

safetensors
# safetensors==0.3.1 # Until they fix it
ffmpeg-python # Apache 2.0
# gradio==3.48.0
gradio>=4.1.0 # MIT License
python-dotenv==1.0.0
soundfile==0.12.1; sys_platform == 'win32' # torchaudio
# sox # torchaudio for linux
suno-bark @ git+https://github.com/rsxdalv/bark@main#egg=suno-bark # MIT License
vocos==0.1.0 # MIT License
tortoise-tts @ git+https://github.com/rsxdalv/tortoise-tts@main#egg=tortoise-tts # Apache 2.0
beartype>=0.16.1 # workaround for a bug
# no longer required directly # transformers==4.36.1 # cross-compatibility
iso639-lang==2.2.3
pillow==10.3.0 # for gradio, conda fix

Error:

 > [17/27] RUN uv pip install --no-cache-dir --system --verbose torch==2.3.1 -r requirements.txt:
6.923   File "/tmp/.tmpejZquv/builds-v0/.tmpqUIi6D/lib/python3.10/site-packages/setuptools/build_meta.py", line 302, in _get_build_requires
6.923     self.run_setup()
6.923   File "/tmp/.tmpejZquv/builds-v0/.tmpqUIi6D/lib/python3.10/site-packages/setuptools/build_meta.py", line 503, in run_setup
6.923     super().run_setup(setup_script=setup_script)
6.923   File "/tmp/.tmpejZquv/builds-v0/.tmpqUIi6D/lib/python3.10/site-packages/setuptools/build_meta.py", line 318, in run_setup
6.923     exec(code, locals())
6.923   File "<string>", line 55, in <module>
6.923   File "<string>", line 52, in _guard_py_ver
6.923 RuntimeError: Cannot install on Python version 3.10.12; only versions >=3.6,<3.10 are supported.

https://github.com/rsxdalv/tts-generation-webui/actions/runs/11224348164/job/31200883591#step:6:8382

Full dockerfile:

# Python 3.10 w/ Nvidia Cuda
FROM nvidia/cuda:11.8.0-devel-ubuntu22.04 AS env_base

# Install Pre-reqs
RUN apt-get update && apt-get install --no-install-recommends -y \
    git vim nano build-essential python3-dev python3-venv python3-pip gcc g++ ffmpeg

ENV NODE_VERSION=22.9.0
RUN apt-get update && apt install -y curl
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
ENV NVM_DIR=/root/.nvm
RUN . "$NVM_DIR/nvm.sh" && nvm install ${NODE_VERSION}
RUN . "$NVM_DIR/nvm.sh" && nvm use v${NODE_VERSION}
RUN . "$NVM_DIR/nvm.sh" && nvm alias default v${NODE_VERSION}
ENV PATH="/root/.nvm/versions/node/v${NODE_VERSION}/bin/:${PATH}"
RUN node --version
RUN npm --version

# Install uv
ADD --chmod=755 https://astral.sh/uv/install.sh /install.sh
RUN /install.sh && rm /install.sh

# Define PyTorch version
ENV TORCH_VERSION=2.3.1

ENV PATH="/root/.cargo/bin:$PATH"
RUN uv pip install --no-cache-dir --system setuptools torch==$TORCH_VERSION torchvision torchaudio 

# Set working directory
WORKDIR /app

# Clone the repo
RUN git clone https://github.com/rsxdalv/tts-generation-webui.git

# Set working directory to the cloned repo
WORKDIR /app/tts-generation-webui

RUN pip3 install --no-cache-dir --upgrade pip==23.3.2 setuptools

# Install all requirements
# RUN pip3 install --no-cache-dir torch==$TORCH_VERSION -r requirements.txt
RUN uv pip install --no-cache-dir --system --verbose torch==$TORCH_VERSION -r requirements.txt
RUN uv pip install --no-cache-dir --system --verbose torch==$TORCH_VERSION -r requirements_bark_hubert_quantizer.txt
RUN uv pip install --no-cache-dir --system --verbose torch==$TORCH_VERSION -r requirements_rvc.txt
RUN uv pip install --no-cache-dir --system --verbose torch==$TORCH_VERSION -r requirements_audiocraft_0.txt
RUN uv pip install --no-cache-dir --system --verbose torch==$TORCH_VERSION -r requirements_audiocraft.txt
RUN uv pip install --no-cache-dir --system --verbose torch==$TORCH_VERSION -r requirements_styletts2.txt
RUN uv pip install --no-cache-dir --system --verbose torch==$TORCH_VERSION -r requirements_vall_e.txt
RUN uv pip install --no-cache-dir --system --verbose torch==$TORCH_VERSION -r requirements_maha_tts.txt
RUN uv pip install --no-cache-dir --system --verbose torch==$TORCH_VERSION -r requirements_stable_audio.txt
# RUN uv pip install --no-cache-dir --system torch==$TORCH_VERSION hydra-core==1.3.2
RUN uv pip install --no-cache-dir --system torch==$TORCH_VERSION nvidia-ml-py


# add postgres & run setup
# Build the React UI
RUN cd react-ui && npm install && npm run build

# Run the server
CMD python server.py --docker
@zanieb
Copy link
Member

zanieb commented Oct 7, 2024

Hi! Thanks for all the details. Did you read the local version identifier section of the pip compatibility guide?

@zanieb zanieb added the question Asking for clarification or support label Oct 7, 2024
@rsxdalv
Copy link
Author

rsxdalv commented Oct 7, 2024

Thank you, I saw some potential causes for this, it seems like it spiraled downwards towards an older version, and I suppose I can try to add an extra constraint on the version and fix everything that way.

On the topic of pip compatibility, it seems that pip is capable of installing packages while there's an app running while uv seems to fail, is this to be expected?
error: failed to remove file .\env\Lib\site-packages\PIL/_imaging.cp310-win_amd64.pyd
Caused by: Access is denied. (os error 5)
For context, I have a python app with extensions system and they currently are being installed while the app itself is running.

@zanieb
Copy link
Member

zanieb commented Oct 8, 2024

There's an issue for the pyd file behavior on Windows #7918 — installation should be fine but that suggests that there's an uninstall happening?

Here's another issue with context on selection of old versions when there aren't constraints #4372

@rsxdalv
Copy link
Author

rsxdalv commented Oct 8, 2024

There's an issue for the pyd file behavior on Windows #7918 — installation should be fine but that suggests that there's an uninstall happening?

Here's another issue with context on selection of old versions when there aren't constraints #4372

Thanks!
Yes, exactly, it seems that the problems begin when an extension causes a reinstall, i.e., PIL > 9 is ok with the app but the extension demands PIL > 10 so we get a reinstall.

@rsxdalv
Copy link
Author

rsxdalv commented Oct 24, 2024

Hi! Thanks for all the details. Did you read the local version identifier section of the pip compatibility guide?

I wanted to add a user story in regards to this:

uv pip install --dry-run torch==2.3.0 torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
  × No solution found when resolving dependencies:
  ╰─▶ Because there is no version of torch==2.3.0 and you require torch==2.3.0, we can conclude that your requirements       
      are unsatisfiable.

as an end user, I don't know exactly what is the + they are using. I think this time I will just try to guess it, but since the + is so ingrained in python right now, there might need to be a way to help find those packages/resolve those conflicts. (After assuming that there's no pytorch 2.5.0 with Cuda 11.8, I thankfully came here to find that it's torch==2.5.0+cu118)

Also great job on uv dry run installs, when trying it with pip I had this:

(C:\Users\admin\Desktop\one-click-installers-tts-main\tts-generation-webui\installer_files\env) C:\Users\admin\Desktop\one-click-installers-tts-main\tts-generation-webui>pip install --dry-run torch==2.3.0 torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
Looking in indexes: https://download.pytorch.org/whl/cu118
Collecting torch==2.3.0
  Downloading https://download.pytorch.org/whl/cu118/torch-2.3.0%2Bcu118-cp310-cp310-win_amd64.whl (2673.0 MB)
     ━━╺━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 0.1/2.7 GB 40.9 MB/s eta 0:01:02
ERROR: Operation cancelled by user

(C:\Users\admin\Desktop\one-click-installers-tts-main\tts-generation-webui\installer_files\env) C:\Users\admin\Desktop\one-click-installers-tts-main\tts-generation-webui>pip install --dry-run torch==2.5.0 torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
Looking in indexes: https://download.pytorch.org/whl/cu118
Collecting torch==2.5.0
  Downloading https://download.pytorch.org/whl/cu118/torch-2.5.0%2Bcu118-cp310-cp310-win_amd64.whl (2700.2 MB)
     ━╺━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 0.1/2.7 GB 40.9 MB/s eta 0:01:04
ERROR: Operation cancelled by user

Thus I can testify that uv is already a tool every python dev should have installed, because it's useful even when mixing with pip.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Asking for clarification or support
Projects
None yet
Development

No branches or pull requests

3 participants