Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[BUG] setuptools 60.3.0 breaks pip-review (and -m pip) with AttributeError: module '__main__' has no attribute '__file__' #3004

Closed
1 task done
allenatdecisiv opened this issue Jan 6, 2022 · 1 comment
Labels
bug Needs Triage Issues that need to be evaluated for severity and status.

Comments

@allenatdecisiv
Copy link

allenatdecisiv commented Jan 6, 2022

setuptools version

60.3.0

Python version

Python 3.8.12

OS

Windows 10 (CYGWIN_NT-10.0-19044 FOUREYES 3.3.3-341.x86_64)

Additional environment information

No response

Description

I upgraded from setuptools 60.2.0 to setuptools 60.3.0 and I get this error with running pip-review --verbose --interactive:

pip-review --verbose --interactive
/usr/bin/python3.8.exe: Error while finding module specification for 'pip' (AttributeError: module '__main__' has no attribute '__file__')
Traceback (most recent call last):
  File "/usr/local/bin/pip-review", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.8/site-packages/pip_review/__main__.py", line 223, in main
    outdated = get_outdated_packages(list_args)
  File "/usr/local/lib/python3.8/site-packages/pip_review/__main__.py", line 205, in get_outdated_packages
    output = check_output(command).decode('utf-8')
  File "/usr/local/lib/python3.8/site-packages/pip_review/__main__.py", line 21, in check_output
    raise error
subprocess.CalledProcessError: Command '['/usr/bin/python3.8.exe', '-m', 'pip', 'list', '--outdated', '--disable-pip-version-check', '--format=json']' returned non-zero exit status 1.

So I removed the pip-review command from the puzzle, just running the command it's running:

$ /usr/bin/python3.8.exe -m pip list --outdated --disable-pip-version-check
/usr/bin/python3.8.exe: Error while finding module specification for 'pip' (AttributeError: module '__main__' has no attribute '__file__')

Interestingly, this works:

$ pip list --outdated --disable-pip-version-check
Package            Version  Latest  Type
------------------ -------- ------- -----
argcomplete        1.12.3   2.0.0   wheel
boto3              1.20.26  1.20.29 wheel
botocore           1.23.26  1.23.29 wheel
charset-normalizer 2.0.9    2.0.10  wheel
cryptography       3.3.2    36.0.1  sdist
idna               2.10     3.3     wheel
parsedatetime      2.4      2.6     wheel
pipx               0.17.0   1.0.0   wheel
pyparsing          2.4.7    3.0.6   wheel
requests           2.26.0   2.27.1  wheel
tomli              1.2.2    2.0.0   wheel
typing-extensions  3.10.0.2 4.0.1   wheel

I went back to setuptools 60.2.0:

pip show setuptools
Name: setuptools
Version: 60.2.0
Summary: Easily download, build, install, upgrade, and uninstall Python packages
Home-page: https://github.com/pypa/setuptools
Author: Python Packaging Authority
Author-email: distutils-sig@python.org
License: UNKNOWN
Location: /usr/lib/python3.8/site-packages
Requires:
Required-by: csvkit, johnnydep, pip-tools, pipenv

and pip-review works as expected:

$ pip-review --verbose --interactive
argcomplete==2.0.0 is available (you have 1.12.3)
Upgrade now? [Y]es, [N]o, [A]ll, [Q]uit

Same for the pip module run:

/usr/bin/python3.8.exe -m pip list --outdated --disable-pip-version-check
Package            Version  Latest  Type
------------------ -------- ------- -----
argcomplete        1.12.3   2.0.0   wheel
boto3              1.20.26  1.20.29 wheel
botocore           1.23.26  1.23.29 wheel
charset-normalizer 2.0.9    2.0.10  wheel
cryptography       3.3.2    36.0.1  sdist
idna               2.10     3.3     wheel
parsedatetime      2.4      2.6     wheel
pipx               0.17.0   1.0.0   wheel
pyparsing          2.4.7    3.0.6   wheel
requests           2.26.0   2.27.1  wheel
setuptools         60.2.0   60.3.0  wheel
tomli              1.2.2    2.0.0   wheel
typing-extensions  3.10.0.2 4.0.1   wheel

Expected behavior

To be able to run pip-review and pip module:

$ pip-review --verbose --interactive
argcomplete==2.0.0 is available (you have 1.12.3)
Upgrade now? [Y]es, [N]o, [A]ll, [Q]uit
/usr/bin/python3.8.exe -m pip list --outdated --disable-pip-version-check
Package            Version  Latest  Type
------------------ -------- ------- -----
argcomplete        1.12.3   2.0.0   wheel
boto3              1.20.26  1.20.29 wheel
botocore           1.23.26  1.23.29 wheel
charset-normalizer 2.0.9    2.0.10  wheel
cryptography       3.3.2    36.0.1  sdist
idna               2.10     3.3     wheel
parsedatetime      2.4      2.6     wheel
pipx               0.17.0   1.0.0   wheel
pyparsing          2.4.7    3.0.6   wheel
requests           2.26.0   2.27.1  wheel
setuptools         60.2.0   60.3.0  wheel
tomli              1.2.2    2.0.0   wheel
typing-extensions  3.10.0.2 4.0.1   wheel

How to Reproduce

  1. install setuptools 60.3.0
  2. run pip-review
  3. run pip module

Output

I use cygport packing (Cygwin's packaging system) to update setuptools:

$ cygcheck -c python38-setuptools
Cygwin Package Information
Package              Version        Status
python38-setuptools  60.3.0-1       OK

$ pip show setuptools
Name: setuptools
Version: 60.3.0
Summary: Easily download, build, install, upgrade, and uninstall Python packages
Home-page: https://github.com/pypa/setuptools
Author: Python Packaging Authority
Author-email: distutils-sig@python.org
License: UNKNOWN
Location: /usr/lib/python3.8/site-packages
Requires:
Required-by: csvkit, johnnydep, pip-tools, pipenv

$ pip-review --verbose --interactive
/usr/bin/python3.8.exe: Error while finding module specification for 'pip' (AttributeError: module '__main__' has no attribute '__file__')
Traceback (most recent call last):
  File "/usr/local/bin/pip-review", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.8/site-packages/pip_review/__main__.py", line 223, in main
    outdated = get_outdated_packages(list_args)
  File "/usr/local/lib/python3.8/site-packages/pip_review/__main__.py", line 205, in get_outdated_packages
    output = check_output(command).decode('utf-8')
  File "/usr/local/lib/python3.8/site-packages/pip_review/__main__.py", line 21, in check_output
    raise error
subprocess.CalledProcessError: Command '['/usr/bin/python3.8.exe', '-m', 'pip', 'list', '--outdated', '--disable-pip-version-check', '--format=json']' returned non-zero exit status 1.

$ /usr/bin/python3.8.exe -m pip list --outdated --disable-pip-version-check
/usr/bin/python3.8.exe: Error while finding module specification for 'pip' (AttributeError: module '__main__' has no attribute '__file__')

$ pip show setuptools
Name: setuptools
Version: 60.3.0
Summary: Easily download, build, install, upgrade, and uninstall Python packages
Home-page: https://github.com/pypa/setuptools
Author: Python Packaging Authority
Author-email: distutils-sig@python.org
License: UNKNOWN
Location: /usr/lib/python3.8/site-packages
Requires:
Required-by: csvkit, johnnydep, pip-tools, pipenv

Code of Conduct

  • I agree to follow the PSF Code of Conduct
@allenatdecisiv allenatdecisiv added bug Needs Triage Issues that need to be evaluated for severity and status. labels Jan 6, 2022
@allenatdecisiv
Copy link
Author

I did check, but either it took me too long to compose the issue or it took the other folks too long. :-)

Closing b/c I think this is a dupe of:
#3002
#3003

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Needs Triage Issues that need to be evaluated for severity and status.
Projects
None yet
Development

No branches or pull requests

1 participant