Skip to content

Cannot install when PYTHONSAFEPATH=true #137

@jasonk

Description

@jasonk

Describe the bug
I was having problems trying to install into a devcontainer (using the mcr.microsoft.com/devcontainers/python:3.13-bullseye image). I tracked it down to having PYTHONSAFEPATH set.

To Reproduce

> export PYTHONSAFEPATH=true
> uv add ulid-transform
Resolved 160 packages in 100ms
  × Failed to build `ulid-transform==1.4.0`
  ├─▶ The build backend returned an error
  ╰─▶ Call to `poetry.core.masonry.api.build_wheel` failed (exit status: 1)

      [stderr]
      A setup.py file already exists. Using it.
      Traceback (most recent call last):
        File
      "/home/vscode/.cache/uv/sdists-v9/pypi/ulid-transform/1.4.0/rKaEPXP96zhbpBax9TOp4/src/setup.py",
      line 28, in <module>
          from build_ext import *
      ModuleNotFoundError: No module named 'build_ext

Trying it again without having that set works, because setup.py is importing build_ext.py in a way that only works when not running with safe path enabled..

> export PYTHONSAFEPATH=
> uv add ulid-transform
...installs successfully...

Additional context
Reporting it here mostly so that if anybody else runs into this they'll be able to find out why...

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