Skip to content

"uv pip install *** --compile-bytecode" fails with obscure message #15577

@mrmathematica

Description

@mrmathematica

Summary

  1. We run python and uv in containners. Python comes the following site.getsitepackages(): '/usr/local/lib64/python3.12/site-packages', '/usr/local/lib/python3.12/site-packages', '/usr/lib64/python3.12/site-packages', '/usr/lib/python3.12/site-packages'.
  2. '/usr/local/lib64/python3.12/site-packages' folder doesn't exist by default (This is after we run dnf install python3.12 on ubi8 base image). If calling "uv pip install" with some binary package, it will be created and the binary package will be installed into there.
  3. In this case we want to call "uv pip install some-pure-python-package --bytecode-compile". I can confirm, if calling "uv pip install some-pure-python-package", the pacakge will be installed into '/usr/local/lib/python3.12/site-packages', and '/usr/local/lib64/python3.12/site-packages' won't be created.
  4. calling "uv pip install some-pure-python-package --bytecode-compile" fails with obscure message:

error: Failed to bytecode-compile Python file in: /usr/local/lib64/python3.12/site-packages
Caused by: Failed to start Python interpreter to run compile script

It took me more then half a day, to finally figure out the error is because '/usr/local/lib64/python3.12/site-packages' doesn't exist, and the packages are being installed into '/usr/local/lib/python3.12/site-packages'. In this case, I think uv should gracefully taking care the situation, either to create an empty '/usr/local/lib/python3.12/site-packages' folder, or not fail anyway.

Platform

Redhat ubi8 base image

Version

0.8.13

Python version

Python 3.12.11

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions