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

pip install in an environment without setuptools fails #4878

Closed
justinchuby opened this issue Feb 9, 2023 · 0 comments · Fixed by #4879, #5531 or #5536
Closed

pip install in an environment without setuptools fails #4878

justinchuby opened this issue Feb 9, 2023 · 0 comments · Fixed by #4879, #5531 or #5536
Assignees
Labels
Milestone

Comments

@justinchuby
Copy link
Contributor

Bug Report

Is the issue related to model conversion?

No

Describe the bug

Installing from source in an environment w/o setup tools will fail. We should specify this requirement in pyproject so pip picks it up and install it automatically.

Reference: https://github.com/justinchuby/onnx-script/blob/main/pyproject.toml#L4-L5

System information

ONNX 1.14

@justinchuby justinchuby added the bug label Feb 9, 2023
@justinchuby justinchuby changed the title Require setuptools in pyproject pip install in an environment without setuptools fails Feb 9, 2023
@justinchuby justinchuby self-assigned this Aug 26, 2023
@justinchuby justinchuby modified the milestones: 1.14.1, 1.15 Aug 26, 2023
github-merge-queue bot pushed a commit that referenced this issue Aug 27, 2023
### Description

Specify setuptools in the build-system section in pyproject.toml. So
that setuptools gets installed when it is not in the environment when
doing local install.

### Motivation and Context

Fixes #4878

Signed-off-by: Justin Chu <justinchu@microsoft.com>
github-merge-queue bot pushed a commit that referenced this issue Aug 28, 2023
### Description

Specify setuptools in the build-system section in pyproject.toml. So
that setuptools gets installed when it is not in the environment when
doing local install.

Second attempt of #5531 by removing `--no-use-pep517` in the test
pipeline

### Motivation and Context

Fixes #4878

---------

Signed-off-by: Justin Chu <justinchu@microsoft.com>
github-merge-queue bot pushed a commit that referenced this issue Sep 5, 2023
### Description
<!-- - Describe your changes. -->

- Move much of the metadata from setup.py to pyproject.toml. Setuptools
commands are left unchanged.
- Replace `--weekly_build` with the env var `ONNX_PREVIEW_BUILD`.
Version number verified locally and in CI.
	> **Note**
> Due to `pyproject.toml` limitation, we need to use a script to rename
the package for the weekly build.
> On Windows, it is `(Get-Content -Path 'pyproject.toml') |
ForEach-Object { $_ -replace 'name = "onnx"', 'name = "onnx-weekly"' } |
Set-Content -Path 'pyproject.toml'`
> On linux, it is `sed -i 's/name = "onnx"/name = "onnx-weekly"/'
'pyproject.toml'`
	> Tested locally.
- Replace all `setup.py xxx` usage with `pip install` or `python -m
build` according to setuptools' suggestions.
- The MacOS wheel's platform name needs to be tweaked. Previously it was
modified by supplying the `-p` or `--plat-name` option to `setup.py`.
Now that we use `python -m build`, I created an env var
`ONNX_WHEEL_PLATFORM_NAME` and supply it via the `setup` call:
    ```
	setuptools.setup(
	    ...
	    options={"bdist_wheel": {"plat_name": ONNX_WHEEL_PLATFORM_NAME}}
	    if ONNX_WHEEL_PLATFORM_NAME is not None
	    else {},
	)
	```

### Motivation and Context
<!-- - Why is this change required? What problem does it solve? -->
<!-- - If it fixes an open issue, please link to the issue here. -->

https://setuptools.pypa.io/en/latest/userguide/pyproject_config.html

> Starting with [PEP 621](https://peps.python.org/pep-0621/), the Python
community selected pyproject.toml as a standard way of specifying
project metadata. Setuptools has adopted this standard and will use the
information contained in this file as an input in the build process.

https://pypi.org/project/pytest-runner/

> It is recommended that you:
> Remove 'pytest-runner' from your setup_requires, preferably removing
the setup_requires option.
> Remove 'pytest' and any other testing requirements from tests_require,
preferably removing the tests_requires option.
> Select a tool to bootstrap and then run tests such as tox.

fix #4878 and #4539

---------

Signed-off-by: Justin Chu <justinchu@microsoft.com>
Signed-off-by: Justin Chu <justinchuby@users.noreply.github.com>
github-merge-queue bot pushed a commit that referenced this issue Sep 5, 2023
### Description
<!-- - Describe your changes. -->

- Move much of the metadata from setup.py to pyproject.toml. Setuptools
commands are left unchanged.
- Replace `--weekly_build` with the env var `ONNX_PREVIEW_BUILD`.
Version number verified locally and in CI.
	> **Note**
> Due to `pyproject.toml` limitation, we need to use a script to rename
the package for the weekly build.
> On Windows, it is `(Get-Content -Path 'pyproject.toml') |
ForEach-Object { $_ -replace 'name = "onnx"', 'name = "onnx-weekly"' } |
Set-Content -Path 'pyproject.toml'`
> On linux, it is `sed -i 's/name = "onnx"/name = "onnx-weekly"/'
'pyproject.toml'`
	> Tested locally.
- Replace all `setup.py xxx` usage with `pip install` or `python -m
build` according to setuptools' suggestions.
- The MacOS wheel's platform name needs to be tweaked. Previously it was
modified by supplying the `-p` or `--plat-name` option to `setup.py`.
Now that we use `python -m build`, I created an env var
`ONNX_WHEEL_PLATFORM_NAME` and supply it via the `setup` call:
    ```
	setuptools.setup(
	    ...
	    options={"bdist_wheel": {"plat_name": ONNX_WHEEL_PLATFORM_NAME}}
	    if ONNX_WHEEL_PLATFORM_NAME is not None
	    else {},
	)
	```

### Motivation and Context
<!-- - Why is this change required? What problem does it solve? -->
<!-- - If it fixes an open issue, please link to the issue here. -->

https://setuptools.pypa.io/en/latest/userguide/pyproject_config.html

> Starting with [PEP 621](https://peps.python.org/pep-0621/), the Python
community selected pyproject.toml as a standard way of specifying
project metadata. Setuptools has adopted this standard and will use the
information contained in this file as an input in the build process.

https://pypi.org/project/pytest-runner/

> It is recommended that you:
> Remove 'pytest-runner' from your setup_requires, preferably removing
the setup_requires option.
> Remove 'pytest' and any other testing requirements from tests_require,
preferably removing the tests_requires option.
> Select a tool to bootstrap and then run tests such as tox.

fix #4878 and #4539

---------

Signed-off-by: Justin Chu <justinchu@microsoft.com>
Signed-off-by: Justin Chu <justinchuby@users.noreply.github.com>
corwinjoy pushed a commit to corwinjoy/onnx that referenced this issue Sep 5, 2023
### Description

Specify setuptools in the build-system section in pyproject.toml. So
that setuptools gets installed when it is not in the environment when
doing local install.

### Motivation and Context

Fixes onnx#4878

Signed-off-by: Justin Chu <justinchu@microsoft.com>
Signed-off-by: Corwin Joy <corwinjoy@gmail.com>
corwinjoy pushed a commit to corwinjoy/onnx that referenced this issue Sep 5, 2023
### Description

Specify setuptools in the build-system section in pyproject.toml. So
that setuptools gets installed when it is not in the environment when
doing local install.

Second attempt of onnx#5531 by removing `--no-use-pep517` in the test
pipeline

### Motivation and Context

Fixes onnx#4878

---------

Signed-off-by: Justin Chu <justinchu@microsoft.com>
Signed-off-by: Corwin Joy <corwinjoy@gmail.com>
corwinjoy pushed a commit to corwinjoy/onnx that referenced this issue Sep 5, 2023
### Description

Specify setuptools in the build-system section in pyproject.toml. So
that setuptools gets installed when it is not in the environment when
doing local install.

### Motivation and Context

Fixes onnx#4878

Signed-off-by: Justin Chu <justinchu@microsoft.com>
Signed-off-by: Corwin Joy <corwinjoy@gmail.com>
corwinjoy pushed a commit to corwinjoy/onnx that referenced this issue Sep 5, 2023
### Description

Specify setuptools in the build-system section in pyproject.toml. So
that setuptools gets installed when it is not in the environment when
doing local install.

Second attempt of onnx#5531 by removing `--no-use-pep517` in the test
pipeline

### Motivation and Context

Fixes onnx#4878

---------

Signed-off-by: Justin Chu <justinchu@microsoft.com>
Signed-off-by: Corwin Joy <corwinjoy@gmail.com>
corwinjoy pushed a commit to corwinjoy/onnx that referenced this issue Sep 5, 2023
### Description

Specify setuptools in the build-system section in pyproject.toml. So
that setuptools gets installed when it is not in the environment when
doing local install.

Second attempt of onnx#5531 by removing `--no-use-pep517` in the test
pipeline

### Motivation and Context

Fixes onnx#4878

---------

Signed-off-by: Justin Chu <justinchu@microsoft.com>
Signed-off-by: Corwin Joy <corwinjoy@gmail.com>
corwinjoy pushed a commit to corwinjoy/onnx that referenced this issue Sep 5, 2023
### Description
<!-- - Describe your changes. -->

- Move much of the metadata from setup.py to pyproject.toml. Setuptools
commands are left unchanged.
- Replace `--weekly_build` with the env var `ONNX_PREVIEW_BUILD`.
Version number verified locally and in CI.
	> **Note**
> Due to `pyproject.toml` limitation, we need to use a script to rename
the package for the weekly build.
> On Windows, it is `(Get-Content -Path 'pyproject.toml') |
ForEach-Object { $_ -replace 'name = "onnx"', 'name = "onnx-weekly"' } |
Set-Content -Path 'pyproject.toml'`
> On linux, it is `sed -i 's/name = "onnx"/name = "onnx-weekly"/'
'pyproject.toml'`
	> Tested locally.
- Replace all `setup.py xxx` usage with `pip install` or `python -m
build` according to setuptools' suggestions.
- The MacOS wheel's platform name needs to be tweaked. Previously it was
modified by supplying the `-p` or `--plat-name` option to `setup.py`.
Now that we use `python -m build`, I created an env var
`ONNX_WHEEL_PLATFORM_NAME` and supply it via the `setup` call:
    ```
	setuptools.setup(
	    ...
	    options={"bdist_wheel": {"plat_name": ONNX_WHEEL_PLATFORM_NAME}}
	    if ONNX_WHEEL_PLATFORM_NAME is not None
	    else {},
	)
	```

### Motivation and Context
<!-- - Why is this change required? What problem does it solve? -->
<!-- - If it fixes an open issue, please link to the issue here. -->

https://setuptools.pypa.io/en/latest/userguide/pyproject_config.html

> Starting with [PEP 621](https://peps.python.org/pep-0621/), the Python
community selected pyproject.toml as a standard way of specifying
project metadata. Setuptools has adopted this standard and will use the
information contained in this file as an input in the build process.

https://pypi.org/project/pytest-runner/

> It is recommended that you:
> Remove 'pytest-runner' from your setup_requires, preferably removing
the setup_requires option.
> Remove 'pytest' and any other testing requirements from tests_require,
preferably removing the tests_requires option.
> Select a tool to bootstrap and then run tests such as tox.

fix onnx#4878 and onnx#4539

---------

Signed-off-by: Justin Chu <justinchu@microsoft.com>
Signed-off-by: Justin Chu <justinchuby@users.noreply.github.com>
Signed-off-by: Corwin Joy <corwinjoy@gmail.com>
corwinjoy pushed a commit to corwinjoy/onnx that referenced this issue Sep 5, 2023
### Description
<!-- - Describe your changes. -->

- Move much of the metadata from setup.py to pyproject.toml. Setuptools
commands are left unchanged.
- Replace `--weekly_build` with the env var `ONNX_PREVIEW_BUILD`.
Version number verified locally and in CI.
	> **Note**
> Due to `pyproject.toml` limitation, we need to use a script to rename
the package for the weekly build.
> On Windows, it is `(Get-Content -Path 'pyproject.toml') |
ForEach-Object { $_ -replace 'name = "onnx"', 'name = "onnx-weekly"' } |
Set-Content -Path 'pyproject.toml'`
> On linux, it is `sed -i 's/name = "onnx"/name = "onnx-weekly"/'
'pyproject.toml'`
	> Tested locally.
- Replace all `setup.py xxx` usage with `pip install` or `python -m
build` according to setuptools' suggestions.
- The MacOS wheel's platform name needs to be tweaked. Previously it was
modified by supplying the `-p` or `--plat-name` option to `setup.py`.
Now that we use `python -m build`, I created an env var
`ONNX_WHEEL_PLATFORM_NAME` and supply it via the `setup` call:
    ```
	setuptools.setup(
	    ...
	    options={"bdist_wheel": {"plat_name": ONNX_WHEEL_PLATFORM_NAME}}
	    if ONNX_WHEEL_PLATFORM_NAME is not None
	    else {},
	)
	```

### Motivation and Context
<!-- - Why is this change required? What problem does it solve? -->
<!-- - If it fixes an open issue, please link to the issue here. -->

https://setuptools.pypa.io/en/latest/userguide/pyproject_config.html

> Starting with [PEP 621](https://peps.python.org/pep-0621/), the Python
community selected pyproject.toml as a standard way of specifying
project metadata. Setuptools has adopted this standard and will use the
information contained in this file as an input in the build process.

https://pypi.org/project/pytest-runner/

> It is recommended that you:
> Remove 'pytest-runner' from your setup_requires, preferably removing
the setup_requires option.
> Remove 'pytest' and any other testing requirements from tests_require,
preferably removing the tests_requires option.
> Select a tool to bootstrap and then run tests such as tox.

fix onnx#4878 and onnx#4539

---------

Signed-off-by: Justin Chu <justinchu@microsoft.com>
Signed-off-by: Justin Chu <justinchuby@users.noreply.github.com>
Signed-off-by: Corwin Joy <corwinjoy@gmail.com>
corwinjoy pushed a commit to corwinjoy/onnx that referenced this issue Sep 5, 2023
### Description

Specify setuptools in the build-system section in pyproject.toml. So
that setuptools gets installed when it is not in the environment when
doing local install.

### Motivation and Context

Fixes onnx#4878

Signed-off-by: Justin Chu <justinchu@microsoft.com>
Signed-off-by: Corwin Joy <corwinjoy@gmail.com>
corwinjoy pushed a commit to corwinjoy/onnx that referenced this issue Sep 5, 2023
### Description

Specify setuptools in the build-system section in pyproject.toml. So
that setuptools gets installed when it is not in the environment when
doing local install.

Second attempt of onnx#5531 by removing `--no-use-pep517` in the test
pipeline

### Motivation and Context

Fixes onnx#4878

---------

Signed-off-by: Justin Chu <justinchu@microsoft.com>
Signed-off-by: Corwin Joy <corwinjoy@gmail.com>
corwinjoy pushed a commit to corwinjoy/onnx that referenced this issue Sep 5, 2023
### Description

Specify setuptools in the build-system section in pyproject.toml. So
that setuptools gets installed when it is not in the environment when
doing local install.

Second attempt of onnx#5531 by removing `--no-use-pep517` in the test
pipeline

### Motivation and Context

Fixes onnx#4878

---------

Signed-off-by: Justin Chu <justinchu@microsoft.com>
Signed-off-by: Corwin Joy <corwinjoy@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment