Skip to content

Failed to install from sdist #43

@koyeung

Description

@koyeung

If binary wheel is not available to the platform, it would be install from sdist. One issue found that setup.py will remove src and copy from ../src if it is present.

i.e. installation from sdist would install files out of the sdist archive.

e.g. pip install ....path/to/sxtwl-2.0.7.tar.gz
setup.py would be run in directory /tmp/pip-req-build-g4txwujj on linux. If /tmp/src is present, files under src in sdist would be erased and replaced (by whatever under /tmp/src/)

as a test:

# on linux
mkdir /tmp/src
# (create virtual environment and install setup tools)

# the following would fail:
pip install ....path/to/sxtwl-2.0.7.tar.gz

Similar issue found if it is installed by uv; setup.py is run in directory: ~/.cache/uv/sdists-v6/path/random1/random2/src, that means ../src is present.

Any idea to change as below:

  • remove /src from python/.gitignore
  • create symbolic link python/src to ../src
  • remove below from setup.py
if os.path.isdir("../src"):
    if os.path.isdir("src"):
        shutil.rmtree("src")
    shutil.copytree("../src", "src")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions