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

[BUG] import setuptools raises a DeprecationWarning on Windows #3536

Closed
kmaehashi opened this issue Aug 17, 2022 · 6 comments · Fixed by #3541
Closed

[BUG] import setuptools raises a DeprecationWarning on Windows #3536

kmaehashi opened this issue Aug 17, 2022 · 6 comments · Fixed by #3541
Assignees
Labels

Comments

@kmaehashi
Copy link

setuptools version

setuptools==65.0.2

Python version

Python 3.9

OS

Windows

Additional environment information

No response

Description

On Windows, import setuptools raises a warning added in pypa/distutils@c802880.

This issue does not occur in setuptools 65.0.1.

Expected behavior

No warnings.

How to Reproduce

python -Werror -c "import setuptools"

Output

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Users\maehashi\.venv-py39\lib\site-packages\setuptools\__init__.py", line 247, in <module>
    monkey.patch_all()
  File "C:\Users\maehashi\.venv-py39\lib\site-packages\setuptools\monkey.py", line 99, in patch_all
    patch_for_msvc_specialized_compiler()
  File "C:\Users\maehashi\.venv-py39\lib\site-packages\setuptools\monkey.py", line 136, in patch_for_msvc_specialized_compiler
    msvc = import_module('setuptools.msvc')
  File "C:\Program Files\Python39\lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "C:\Users\maehashi\.venv-py39\lib\site-packages\setuptools\msvc.py", line 61, in <module>
    from distutils.msvc9compiler import Reg
  File "C:\Users\maehashi\.venv-py39\lib\site-packages\setuptools\_distutils\msvc9compiler.py", line 34, in <module>
    warnings.warn(
DeprecationWarning: msvc9compiler is deprecated and slated to be removed in the future. Please discontinue use or file an issue with pypa/distutils describing your use case.
@kmaehashi kmaehashi added bug Needs Triage Issues that need to be evaluated for severity and status. labels Aug 17, 2022
@hodgestar
Copy link

Is it possible to have the setuptools tests fail if setuptools itself produces warnings? And to run the integration tests on Windows too?

It would be nice if the CI tests could help avoid the excitement that we're experiencing in future.

@jaraco
Copy link
Member

jaraco commented Aug 18, 2022

Setuptools does fail on warnings, but intentionally suppressed this DeprecationWarning because it gets triggered when those modules get tested. I did not realize that Setuptools actually imported this module. That's slightly surprising given that I removed the module and the tests continued to pass. But now that I look at it, it's not all that surprising with all the except ImportError wrapped around it.

The choice to deprecate these modules came a little rushed when backing out the removal of those modules.

I definitely don't want these deprecation warnings to emit when using Setuptools.

@jaraco jaraco self-assigned this Aug 18, 2022
@jaraco jaraco removed the Needs Triage Issues that need to be evaluated for severity and status. label Aug 18, 2022
@jaraco
Copy link
Member

jaraco commented Aug 18, 2022

Please try again with v65.1.0 (releasing now).

Confirmed it's working for me:

PS C:\Users\jaraco> py -m pip-run -q git+https://github.com/pypa/setuptools@v65.1.0 -- -W error -c "import setuptools"; echo done
done

@hodgestar
Copy link

Thanks, I will give it a try!

@hodgestar
Copy link

Would it be helpful for setuptools to have a sort of buildbot system where a few projects volunteer to build and test against setuptools master, say, daily in their own repos, and to gather the build statuses somewhere? It might help with testing things a bit more. And it would be okay if the list of projects was a bit fluid and changed over time.

I could volunteer the main project I work on (qutip) and HPy for the list.

Perhaps there is a wider discussion to be had about how we ensure things work nicely for C extensions while still allowing setuptools to evolve. I'm happy to be involved in that discussion (or even to start it) if someone points me to the right place.

Apologies for cluttering this issue report a bit.

@kmaehashi
Copy link
Author

@jaraco Worked for me. Thanks for the prompt action!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants