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

new version of pip 22.2.1 breaks when used with old setuptools #11314

Closed
1 task done
bdrosen96 opened this issue Jul 27, 2022 · 7 comments
Closed
1 task done

new version of pip 22.2.1 breaks when used with old setuptools #11314

bdrosen96 opened this issue Jul 27, 2022 · 7 comments
Labels
type: bug A confirmed bug or unintended behavior
Milestone

Comments

@bdrosen96
Copy link
Contributor

Description

With setup tools 36.0.1:

running:

python3 -m pip install -U pip
python3 -m pip install -U poetry==1.1.13

gets:

14:16:36  ERROR: Exception:
14:16:36  Traceback (most recent call last):
14:16:36    File "/home/jenkins-slave/.jarvis/virtualenvs/executor-0/DataManagement/data-mesh/master_kernelbatchsvc-release-image/lib/python3.8/site-packages/pip/_internal/cli/base_command.py", line 167, in exc_logging_wrapper
14:16:36      status = run_func(*args)
14:16:36    File "/home/jenkins-slave/.jarvis/virtualenvs/executor-0/DataManagement/data-mesh/master_kernelbatchsvc-release-image/lib/python3.8/site-packages/pip/_internal/cli/req_command.py", line 247, in wrapper
14:16:36      return func(self, options, args)
14:16:36    File "/home/jenkins-slave/.jarvis/virtualenvs/executor-0/DataManagement/data-mesh/master_kernelbatchsvc-release-image/lib/python3.8/site-packages/pip/_internal/commands/install.py", line 461, in run
14:16:36      installed = install_given_reqs(
14:16:36    File "/home/jenkins-slave/.jarvis/virtualenvs/executor-0/DataManagement/data-mesh/master_kernelbatchsvc-release-image/lib/python3.8/site-packages/pip/_internal/req/__init__.py", line 73, in install_given_reqs
14:16:36      requirement.install(
14:16:36    File "/home/jenkins-slave/.jarvis/virtualenvs/executor-0/DataManagement/data-mesh/master_kernelbatchsvc-release-image/lib/python3.8/site-packages/pip/_internal/req/req_install.py", line 752, in install
14:16:36      scheme = get_scheme(
14:16:36    File "/home/jenkins-slave/.jarvis/virtualenvs/executor-0/DataManagement/data-mesh/master_kernelbatchsvc-release-image/lib/python3.8/site-packages/pip/_internal/locations/__init__.py", line 244, in get_scheme
14:16:36      from . import _distutils
14:16:36    File "/home/jenkins-slave/.jarvis/virtualenvs/executor-0/DataManagement/data-mesh/master_kernelbatchsvc-release-image/lib/python3.8/site-packages/pip/_internal/locations/_distutils.py", line 13, in <module>
14:16:36      __import__("_distutils_hack").remove_shim()
14:16:36  AttributeError: module '_distutils_hack' has no attribute 'remove_shim'

Expected behavior

Code handles both AttributeError and ImportError as it did before: #11298

pip version

22.2.1

Python version

3.8.12

OS

Linux

How to Reproduce

python3 -m pip install setuptools==36.0.1
python3 -m pip install -U pip
python3 -m pip install -U poetry==1.1.13

Output

No response

Code of Conduct

@bdrosen96 bdrosen96 added S: needs triage Issues/PRs that need to be triaged type: bug A confirmed bug or unintended behavior labels Jul 27, 2022
@pradyunsg
Copy link
Member

Thanks for filing this issue!

Is there a reason to not update setuptools alongside pip? I don’t think we want to be maintaining support for arbitrarily old versions of setuptools, and I’m pretty sure that version of setuptools will not work with the latest pip correctly either.

@pradyunsg pradyunsg added S: awaiting response Waiting for a response/more information and removed S: needs triage Issues/PRs that need to be triaged labels Jul 27, 2022
@bdrosen96
Copy link
Contributor Author

I'm currently trying to upgrade the setup tools in the script in question (it is done that way in most of our scripts, but there are a few that did not do so and instead used the default setuptools that existed in the jenkins environment).

It still seems like it would be worth a small fix to handle both exception types instead of just the one since this worked fine with 22.2. ie:

try:
    __import__("_distutils_hack").remove_shim()
except (ImportError, AttributeError):
    pass

@pradyunsg
Copy link
Member

Thanks. I just find it weird that someone would intentionally want to do something like that. :)

small fix to handle both exception types

Yup yup, and a PR for that would be welcome.

@bdrosen96
Copy link
Contributor Author

I don't seem to have permission to create a PR in the repo. Is there a different process to generate PRs?

@pfmoore
Copy link
Member

pfmoore commented Jul 27, 2022

Have you created your own fork, created a branch there, and tried to make a PR from that branch? That should work. If you're trying to create a branch directly in this repo, that won't work.

@bdrosen96
Copy link
Contributor Author

#11315

@sbidoul sbidoul added this to the 22.2.2 milestone Jul 29, 2022
@sbidoul
Copy link
Member

sbidoul commented Jul 30, 2022

Resolved in #11315

@sbidoul sbidoul closed this as completed Jul 30, 2022
inmantaci pushed a commit to inmanta/inmanta-core that referenced this issue Aug 4, 2022
Bumps [pip](https://github.com/pypa/pip) from 22.2.1 to 22.2.2.
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/pypa/pip/blob/main/NEWS.rst">pip's changelog</a>.</em></p>
<blockquote>
<h1>22.2.2 (2022-08-03)</h1>
<h2>Bug Fixes</h2>
<ul>
<li>Avoid  <code>AttributeError</code> when removing the setuptools-provided <code>_distutils_hack</code> and it is missing its implementation. (<code>[#11314](pypa/pip#11314) &lt;https://github.com/pypa/pip/issues/11314&gt;</code>_)</li>
<li>Fix import error when reinstalling pip in user site. (<code>[#11319](pypa/pip#11319) &lt;https://github.com/pypa/pip/issues/11319&gt;</code>_)</li>
<li>Show pip deprecation warnings by default. (<code>[#11330](pypa/pip#11330) &lt;https://github.com/pypa/pip/issues/11330&gt;</code>_)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/pypa/pip/commit/10902ac52d49ec3f5a03a4ed67c4dee533bf8bc4"><code>10902ac</code></a> Bump for release</li>
<li><a href="https://github.com/pypa/pip/commit/534e4d23386f43114f3deed65b7ebdc821aacb4a"><code>534e4d2</code></a> Update AUTHORS.txt</li>
<li><a href="https://github.com/pypa/pip/commit/96675e90cc9b51d3ab2c4f33f8e5e7f2438dfb91"><code>96675e9</code></a> Do not parse JSON content with HTML parser</li>
<li><a href="https://github.com/pypa/pip/commit/4514d1f47300e6df8ad43b309811c876287f8f03"><code>4514d1f</code></a> Revert &quot;PipDeprecationWarning subclass DeprecationWarning&quot;</li>
<li><a href="https://github.com/pypa/pip/commit/1ac427b647b276acd92def9e6bfa223c0d74d103"><code>1ac427b</code></a> Remove TODO</li>
<li><a href="https://github.com/pypa/pip/commit/450fd26c2d4f97284eccb1e6a6f81e9a460b17af"><code>450fd26</code></a> Import distutils only if needed, but sooner</li>
<li><a href="https://github.com/pypa/pip/commit/0c9eb969ebc833454468e16a5fd8fe90548d4c75"><code>0c9eb96</code></a> Ensure that removing shim in older setuptools does not error</li>
<li>See full diff in <a href="https://github.com/pypa/pip/compare/22.2.1...22.2.2">compare view</a></li>
</ul>
</details>
<br />

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=pip&package-manager=pip&previous-version=22.2.1&new-version=22.2.2)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)

</details>
inmantaci pushed a commit to inmanta/inmanta-core that referenced this issue Aug 4, 2022
Bumps [pip](https://github.com/pypa/pip) from 22.2.1 to 22.2.2.
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/pypa/pip/blob/main/NEWS.rst">pip's changelog</a>.</em></p>
<blockquote>
<h1>22.2.2 (2022-08-03)</h1>
<h2>Bug Fixes</h2>
<ul>
<li>Avoid  <code>AttributeError</code> when removing the setuptools-provided <code>_distutils_hack</code> and it is missing its implementation. (<code>[#11314](pypa/pip#11314) &lt;https://github.com/pypa/pip/issues/11314&gt;</code>_)</li>
<li>Fix import error when reinstalling pip in user site. (<code>[#11319](pypa/pip#11319) &lt;https://github.com/pypa/pip/issues/11319&gt;</code>_)</li>
<li>Show pip deprecation warnings by default. (<code>[#11330](pypa/pip#11330) &lt;https://github.com/pypa/pip/issues/11330&gt;</code>_)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/pypa/pip/commit/10902ac52d49ec3f5a03a4ed67c4dee533bf8bc4"><code>10902ac</code></a> Bump for release</li>
<li><a href="https://github.com/pypa/pip/commit/534e4d23386f43114f3deed65b7ebdc821aacb4a"><code>534e4d2</code></a> Update AUTHORS.txt</li>
<li><a href="https://github.com/pypa/pip/commit/96675e90cc9b51d3ab2c4f33f8e5e7f2438dfb91"><code>96675e9</code></a> Do not parse JSON content with HTML parser</li>
<li><a href="https://github.com/pypa/pip/commit/4514d1f47300e6df8ad43b309811c876287f8f03"><code>4514d1f</code></a> Revert &quot;PipDeprecationWarning subclass DeprecationWarning&quot;</li>
<li><a href="https://github.com/pypa/pip/commit/1ac427b647b276acd92def9e6bfa223c0d74d103"><code>1ac427b</code></a> Remove TODO</li>
<li><a href="https://github.com/pypa/pip/commit/450fd26c2d4f97284eccb1e6a6f81e9a460b17af"><code>450fd26</code></a> Import distutils only if needed, but sooner</li>
<li><a href="https://github.com/pypa/pip/commit/0c9eb969ebc833454468e16a5fd8fe90548d4c75"><code>0c9eb96</code></a> Ensure that removing shim in older setuptools does not error</li>
<li>See full diff in <a href="https://github.com/pypa/pip/compare/22.2.1...22.2.2">compare view</a></li>
</ul>
</details>
<br />

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=pip&package-manager=pip&previous-version=22.2.1&new-version=22.2.2)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)

</details>
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 30, 2022
@pradyunsg pradyunsg removed the S: awaiting response Waiting for a response/more information label Mar 17, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: bug A confirmed bug or unintended behavior
Projects
None yet
Development

No branches or pull requests

4 participants