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

Don't depend to ctypes on Linux #2079

Closed
vstinner opened this issue Sep 30, 2014 · 5 comments
Closed

Don't depend to ctypes on Linux #2079

vstinner opened this issue Sep 30, 2014 · 5 comments
Labels
auto-locked Outdated issues that have been locked by automation

Comments

@vstinner
Copy link
Contributor

Hi,

On CPython buildbot "FreeBSD 7.2, the compilation of the ctypes module fails. The pip module cannot be used because it imports colorama which uses ctypes for its win32 module, and the win32 module is always imported, even on Linux. IMO it would be better to not import this module on Linux to avoid the dependency to ctypes.

I know that the issue comes from colorama, but I hope that the issue will get more attention if it reported to pip.

Test output on the buildbot:

FAIL: test_with_pip (test.test_venv.EnsurePipTest)

Traceback (most recent call last):
File "/usr/home/db3l/buildarea/3.x.bolen-freebsd7/build/Lib/test/test_venv.py", line 357, in test_with_pip
with_pip=True)
subprocess.CalledProcessError: Command '['/tmp/tmp71gop0m5/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 "/usr/home/db3l/buildarea/3.x.bolen-freebsd7/build/Lib/test/test_venv.py", line 363, in test_with_pip
self.fail(msg.format(exc, details))
AssertionError: Command '['/tmp/tmp71gop0m5/bin/python', '-Im', 'ensurepip', '--upgrade', '--default-pip']' returned non-zero exit status 1

Subprocess Output
Traceback (most recent call last):
File "/usr/home/db3l/buildarea/3.x.bolen-freebsd7/build/Lib/runpy.py", line 170, in _run_module_as_main
"main", mod_spec)
File "/usr/home/db3l/buildarea/3.x.bolen-freebsd7/build/Lib/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/usr/home/db3l/buildarea/3.x.bolen-freebsd7/build/Lib/ensurepip/main.py", line 4, in
ensurepip._main()
File "/usr/home/db3l/buildarea/3.x.bolen-freebsd7/build/Lib/ensurepip/init.py", line 209, in _main
default_pip=args.default_pip,
File "/usr/home/db3l/buildarea/3.x.bolen-freebsd7/build/Lib/ensurepip/init.py", line 116, in bootstrap
_run_pip(args + [p[0] for p in _PROJECTS], additional_paths)
File "/usr/home/db3l/buildarea/3.x.bolen-freebsd7/build/Lib/ensurepip/init.py", line 40, in _run_pip
import pip
File "/tmp/tmplhy261sg/pip-1.5.6-py2.py3-none-any.whl/pip/init.py", line 9, in
File "/tmp/tmplhy261sg/pip-1.5.6-py2.py3-none-any.whl/pip/log.py", line 9, in
File "/tmp/tmplhy261sg/pip-1.5.6-py2.py3-none-any.whl/pip/_vendor/colorama/init.py", line 2, in
File "/tmp/tmplhy261sg/pip-1.5.6-py2.py3-none-any.whl/pip/_vendor/colorama/initialise.py", line 5, in
File "/tmp/tmplhy261sg/pip-1.5.6-py2.py3-none-any.whl/pip/_vendor/colorama/ansitowin32.py", line 6, in
File "/tmp/tmplhy261sg/pip-1.5.6-py2.py3-none-any.whl/pip/_vendor/colorama/winterm.py", line 2, in
File "/tmp/tmplhy261sg/pip-1.5.6-py2.py3-none-any.whl/pip/_vendor/colorama/win32.py", line 7, in
File "/usr/home/db3l/buildarea/3.x.bolen-freebsd7/build/Lib/ctypes/init.py", line 7, in
from _ctypes import Union, Structure, Array
ImportError: No module named '_ctypes'

@vstinner
Copy link
Contributor Author

I also reported the issue to colorama:
tartley/colorama#18

@dstufft
Copy link
Member

dstufft commented Sep 30, 2014

This should be fixed in development already, see https://github.com/pypa/pip/blob/develop/pip/utils/logging.py#L15-L20.

@dstufft
Copy link
Member

dstufft commented Sep 30, 2014

Note that "fixed" means you won't get any colors at all.

@vstinner
Copy link
Contributor Author

This should be fixed in development already, see https://github.com/pypa/pip/blob/develop/pip/utils/logging.py#L15-L20.

It looks like the issue was already fixed in colorama 0.3.2: colorama issue #56. This version handles the ImportError on "import ctypes". It's maybe time to upgrade this bundled module?

@dstufft
Copy link
Member

dstufft commented Sep 30, 2014

We've done that in development branch too: https://github.com/pypa/pip/blob/develop/pip/_vendor/vendor.txt#L4

@dstufft dstufft closed this as completed Oct 11, 2014
@lock lock bot added the auto-locked Outdated issues that have been locked by automation label Jun 5, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Jun 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
auto-locked Outdated issues that have been locked by automation
Projects
None yet
Development

No branches or pull requests

2 participants