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] setuptools/command/install_scripts.py line 2 bug #2945

Closed
1 task done
kevinhendricks opened this issue Dec 20, 2021 · 4 comments
Closed
1 task done

[BUG] setuptools/command/install_scripts.py line 2 bug #2945

kevinhendricks opened this issue Dec 20, 2021 · 4 comments
Labels
bug Needs Repro Issues that need a reproducible example.

Comments

@kevinhendricks
Copy link

kevinhendricks commented Dec 20, 2021

setuptools version

latest

Python version

Python 3.8.3

OS

MacOS

Additional environment information

No response

Description

Trying to build PySide6 from source on macOS with Qt 6.2.2 and install fails as follows:

running install_scripts
Traceback (most recent call last):
  File "setup.py", line 78, in <module>
    setup_runner.run_setup()
  File "/Volumes/SSD-Drive/repo/pyside-setup-opensource-src-6.2.2/build_scripts/setup_runner.py", line 137, in run_setup
    self.run_setuptools_setup()
  File "/Volumes/SSD-Drive/repo/pyside-setup-opensource-src-6.2.2/build_scripts/setup_runner.py", line 192, in run_setuptools_setup
    setup(**kwargs)
  File "/Users/kbhend/devtools/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/setuptools/__init__.py", line 153, in setup
    return distutils.core.setup(**attrs)
  File "/Users/kbhend/devtools/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/setuptools/_distutils/core.py", line 148, in setup
    return run_commands(dist)
  File "/Users/kbhend/devtools/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/setuptools/_distutils/core.py", line 163, in run_commands
    dist.run_commands()
  File "/Users/kbhend/devtools/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/setuptools/_distutils/dist.py", line 967, in run_commands
    self.run_command(cmd)
  File "/Users/kbhend/devtools/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/setuptools/_distutils/dist.py", line 986, in run_command
    cmd_obj.run()
  File "/Volumes/SSD-Drive/repo/pyside-setup-opensource-src-6.2.2/build_scripts/main.py", line 329, in run
    _install.run(self)
  File "/Users/kbhend/devtools/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/setuptools/command/install.py", line 72, in run
    orig.install.run(self)
  File "/Users/kbhend/devtools/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/setuptools/_distutils/command/install.py", line 641, in run
    self.run_command(cmd_name)
  File "/Users/kbhend/devtools/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/setuptools/_distutils/cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "/Users/kbhend/devtools/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/setuptools/_distutils/dist.py", line 984, in run_command
    cmd_obj = self.get_command_obj(command)
  File "/Users/kbhend/devtools/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/setuptools/_distutils/dist.py", line 858, in get_command_obj
    klass = self.get_command_class(command)
  File "/Users/kbhend/devtools/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/setuptools/dist.py", line 893, in get_command_class
    self.cmdclass[command] = cmdclass = ep.load()
  File "/Users/kbhend/devtools/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pkg_resources/__init__.py", line 2465, in load
    return self.resolve()
  File "/Users/kbhend/devtools/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pkg_resources/__init__.py", line 2471, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/Users/kbhend/devtools/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/setuptools/command/install_scripts.py", line 2, in <module>
    import distutils.command.install_scripts as orig

That import failed.

In internal distutils install_scripts.py is its own module and not a directory,and given your module is called install_scripts.py as well, I think that line should be:

from distutils.command import install_scripts as orig

Expected behavior

setuptools/command/install_scripts.py should not fail trying to import install_scripts from distutils

How to Reproduce

See above.

Output

See above

Code of Conduct

  • I agree to follow the PSF Code of Conduct
@kevinhendricks kevinhendricks added bug Needs Triage Issues that need to be evaluated for severity and status. labels Dec 20, 2021
@kevinhendricks
Copy link
Author

FWIW,
Changing setuptools/command/install_scripts.py", line 2

import distutils.command.install_scripts as orig

to:

from distutils.command import install_scripts as orig

allowed the build from source of the latest PySide6 against Qt-6.2.2 to ibuild and install properly on Python 3.8.3

Not sure if this issue only happens on Python 3.8.3 or not.

@jaraco
Copy link
Member

jaraco commented Dec 21, 2021

Thanks for the report.

The error you're reporting can't be as simple as invalid syntax. If it were, then the issue could be readily replicated and many others would be reporting the issue.

It might be helpful to know what commands you ran and what error message was reported (in addition to the traceback).

But what's more important is to try to ascertain why it's failing in your environment and not others.

When did this issue start? Does the error occur with other versions of Setuptools? The latest version of Setuptools (60) was a backward-incompatible release with instructions on how to opt out by setting SETUPTOOLS_USE_DISTUTILS=stdlib in the environment. Does setting that value help?

@jaraco jaraco added Needs Repro Issues that need a reproducible example. and removed Needs Triage Issues that need to be evaluated for severity and status. labels Dec 21, 2021
@kevinhendricks
Copy link
Author

Used pip3 to upgrade setuptools, got version 60.0. Followed PySide6 build instructions. Since the issue is in distutils my guess it is related to your recent changes in 60.0 which introduced the internal distutils. Since this in invoked deep in the PySide6 setup.py build proceess and since your 60.0 release is very very recent, the qt PySide6 build process probably did not know about or use SETUPTOOLS_USE_DISTUTILS=stdlib option.

I assume pip3 should probably not be installing versions of setuptools with breaking changes.

So this should eventually iron itself out. I will close this as it is probably a one-off situation.

@kevinhendricks
Copy link
Author

Seems a race of some sort has been worked around by Qt for its PySide6 build on macOS that I ran into above.

See https://bugreports.qt.io/browse/PYSIDE-1760

for this change:
https://codereview.qt-project.org/c/pyside/pyside-setup/+/388252

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Needs Repro Issues that need a reproducible example.
Projects
None yet
Development

No branches or pull requests

2 participants