mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 12:54:11 +08:00
Modernize the development installation:
```bash
# python setup.py develop
python -m pip install --no-build-isolation -e .
# python setup.py install
python -m pip install --no-build-isolation .
```
Now, the `python setup.py develop` is a wrapper around `python -m pip install -e .` since `setuptools>=80.0`:
- pypa/setuptools#4955
`python setup.py install` is deprecated and will emit a warning during run. The warning will become an error on October 31, 2025.
- 9c4d383631/setuptools/command/install.py (L58-L67)
> ```python
> SetuptoolsDeprecationWarning.emit(
> "setup.py install is deprecated.",
> """
> Please avoid running ``setup.py`` directly.
> Instead, use pypa/build, pypa/installer or other
> standards-based tools.
> """,
> see_url="https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html",
> due_date=(2025, 10, 31),
> )
> ```
- pypa/setuptools#3849
Additional Resource:
- [Why you shouldn't invoke setup.py directly](https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/156027
Approved by: https://github.com/ezyang
39 lines
954 B
Bash
Executable File
39 lines
954 B
Bash
Executable File
#!/bin/bash
|
|
|
|
set -ex
|
|
|
|
# realpath might not be available on MacOS
|
|
script_path=$(python -c "import os; import sys; print(os.path.realpath(sys.argv[1]))" "${BASH_SOURCE[0]}")
|
|
top_dir=$(dirname $(dirname $(dirname "$script_path")))
|
|
tp2_dir="$top_dir/third_party"
|
|
BUILD_DIR="$top_dir/build"
|
|
mkdir -p "$BUILD_DIR"
|
|
|
|
_pip_install() {
|
|
if [[ -n "$CI" ]]; then
|
|
if [[ -z "${SCCACHE_BUCKET}" ]]; then
|
|
ccache -z
|
|
fi
|
|
fi
|
|
if [[ -n "$CI" ]]; then
|
|
time pip install "$@"
|
|
else
|
|
pip install "$@"
|
|
fi
|
|
if [[ -n "$CI" ]]; then
|
|
if [[ -n "${SCCACHE_BUCKET}" ]]; then
|
|
sccache --show-stats
|
|
else
|
|
ccache -s
|
|
fi
|
|
fi
|
|
}
|
|
|
|
# Install onnx
|
|
_pip_install -b "$BUILD_DIR/onnx" "file://$tp2_dir/onnx#egg=onnx"
|
|
|
|
# Install caffe2 and pytorch
|
|
pip install -r "$top_dir/caffe2/requirements.txt"
|
|
pip install -r "$top_dir/requirements.txt"
|
|
python -m pip install --no-build-isolation -v .
|