This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: test_venv.test_with_pip() fails when ctypes is missing
Type: Stage:
Components: Versions: Python 3.6
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: dstufft, python-dev, vstinner
Priority: normal Keywords:

Created on 2016-03-22 10:52 by vstinner, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (7)
msg262173 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2016-03-22 10:52
pip/pep425tags.py requires ctypes, but it's not available on the OpenIndiana buildbot. I suggest to skip the test if ctypes is missing.

I don't know if it's possible to modify pip to make ctypes optional again.

http://buildbot.python.org/all/builders/AMD64%20OpenIndiana%203.x/builds/10407/steps/test/logs/stdio

======================================================================
FAIL: test_with_pip (test.test_venv.EnsurePipTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/export/home/buildbot/64bits/3.x.cea-indiana-amd64/build/Lib/test/test_venv.py", line 364, in test_with_pip
    with_pip=True)
subprocess.CalledProcessError: Command '['/tmp/tmpl3s6nv31/bin/python', '-Im', 'ensurepip', '--upgrade', '--default-pip']' returned non-zero exit status 1

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/export/home/buildbot/64bits/3.x.cea-indiana-amd64/build/Lib/test/test_venv.py", line 370, in test_with_pip
    self.fail(msg.format(exc, details))
AssertionError: Command '['/tmp/tmpl3s6nv31/bin/python', '-Im', 'ensurepip', '--upgrade', '--default-pip']' returned non-zero exit status 1

**Subprocess Output**
Traceback (most recent call last):
  File "/export/home/buildbot/64bits/3.x.cea-indiana-amd64/build/Lib/runpy.py", line 184, in _run_module_as_main
    "__main__", mod_spec)
  File "/export/home/buildbot/64bits/3.x.cea-indiana-amd64/build/Lib/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/export/home/buildbot/64bits/3.x.cea-indiana-amd64/build/Lib/ensurepip/__main__.py", line 4, in <module>
    ensurepip._main()
  File "/export/home/buildbot/64bits/3.x.cea-indiana-amd64/build/Lib/ensurepip/__init__.py", line 209, in _main
    default_pip=args.default_pip,
  File "/export/home/buildbot/64bits/3.x.cea-indiana-amd64/build/Lib/ensurepip/__init__.py", line 116, in bootstrap
    _run_pip(args + [p[0] for p in _PROJECTS], additional_paths)
  File "/export/home/buildbot/64bits/3.x.cea-indiana-amd64/build/Lib/ensurepip/__init__.py", line 40, in _run_pip
    import pip
  File "/tmp/tmpbfnwxnn2/pip-8.1.1-py2.py3-none-any.whl/pip/__init__.py", line 16, in <module>
  File "/tmp/tmpbfnwxnn2/pip-8.1.1-py2.py3-none-any.whl/pip/vcs/subversion.py", line 9, in <module>
  File "/tmp/tmpbfnwxnn2/pip-8.1.1-py2.py3-none-any.whl/pip/index.py", line 30, in <module>
  File "/tmp/tmpbfnwxnn2/pip-8.1.1-py2.py3-none-any.whl/pip/wheel.py", line 32, in <module>
  File "/tmp/tmpbfnwxnn2/pip-8.1.1-py2.py3-none-any.whl/pip/pep425tags.py", line 9, in <module>
  File "/export/home/buildbot/64bits/3.x.cea-indiana-amd64/build/Lib/ctypes/__init__.py", line 7, in <module>
    from _ctypes import Union, Structure, Array
ImportError: No module named '_ctypes'
msg262175 - (view) Author: Donald Stufft (dstufft) * (Python committer) Date: 2016-03-22 11:02
It shouldn't be hard to make ctypes optional in pip, it's only used to check if the OS we're running on is "manylinux" compatible, roughly checking the glibc version number. Worst case we can just conditon that check on ctypes existing.
msg262216 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2016-03-22 23:23
> It shouldn't be hard to make ctypes optional in pip, it's only used to check if the OS we're running on is "manylinux" compatible, roughly checking the glibc version number.

These checks look low level, so it makes sense to use ctypes for that.

> Worst case we can just conditon that check on ctypes existing.

Do you mean skipping the new "manylinux" thing if ctypes is missing? If yes, I agree with this option. In practice, types is only missing in very rare cases.
msg262422 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2016-03-25 11:32
New changeset cd7cb503ab67 by Victor Stinner in branch 'default':
Skip test_venv.test_with_pip() if ctypes miss
https://hg.python.org/cpython/rev/cd7cb503ab67
msg262423 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2016-03-25 11:32
I pushed a workaround to limit the number of failures on the  OpenIndiana buildbot. Feel free once pip runs without ctypes and pip is updated in CPython.
msg263257 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2016-04-12 15:48
Since the initial issue is fixed, I close the issue.

You can revert my change if a new pip version works (again?) without ctypes.
msg276884 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2016-09-18 11:52
New changeset 82bd70f83796 by Berker Peksag in branch '3.5':
Issue #26610: Skip test_with_pip if _ctypes is not available in OpenIndiana
https://hg.python.org/cpython/rev/82bd70f83796
History
Date User Action Args
2022-04-11 14:58:28adminsetgithub: 70797
2016-09-18 11:52:47python-devsetmessages: + msg276884
2016-04-12 15:48:52vstinnersetstatus: open -> closed
resolution: fixed
messages: + msg263257
2016-03-25 11:32:49vstinnersetmessages: + msg262423
2016-03-25 11:32:10python-devsetnosy: + python-dev
messages: + msg262422
2016-03-22 23:23:37vstinnersetmessages: + msg262216
2016-03-22 11:02:22dstufftsetmessages: + msg262175
2016-03-22 10:52:26vstinnercreate