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

python3: ctypes missing #4572

Closed
lazka opened this issue Oct 21, 2018 · 7 comments
Closed

python3: ctypes missing #4572

lazka opened this issue Oct 21, 2018 · 7 comments
Labels

Comments

@lazka
Copy link
Member

lazka commented Oct 21, 2018

$ python3 -c "import ctypes"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:/msys64/mingw32/lib/python3.7\ctypes\__init__.py", line 7, in <module>
    from _ctypes import Union, Structure, Array
ModuleNotFoundError: No module named '_ctypes'
@lazka lazka added the bug label Oct 21, 2018
@lazka
Copy link
Member Author

lazka commented Oct 21, 2018

This makes pip fail etc.

@lazka
Copy link
Member Author

lazka commented Oct 21, 2018

Upstream change: python/cpython#9258

lazka added a commit to lazka/MINGW-packages that referenced this issue Oct 21, 2018
python/cpython#9258 changed callproc to
use functions from the internal libffi which we don't use.
Just copy the functions into callproc directly instead.
lazka added a commit to lazka/MINGW-packages that referenced this issue Oct 21, 2018
python/cpython#9258 changed callproc to
use functions from the internal libffi which we don't use.
Just copy the functions into callproc directly instead.
@peterbud
Copy link
Contributor

Even with the latest updated python I see pip3 failing in certain cases - is that related or a different problem?

$ pip3 list -o
Exception:
Traceback (most recent call last):
  File "C:/msys64/mingw64/lib/python3.7/site-packages\pip\_internal\basecommand.py", line 141, in main
    status = self.run(options, args)
  File "C:/msys64/mingw64/lib/python3.7/site-packages\pip\_internal\commands\list.py", line 136, in run
    packages = self.get_outdated(packages, options)
  File "C:/msys64/mingw64/lib/python3.7/site-packages\pip\_internal\commands\list.py", line 147, in get_outdated
    dist for dist in self.iter_packages_latest_infos(packages, options)
  File "C:/msys64/mingw64/lib/python3.7/site-packages\pip\_internal\commands\list.py", line 148, in <listcomp>
    if dist.latest_version > dist.parsed_version
TypeError: '>' not supported between instances of 'Version' and 'Version'

$ pacman -Qi mingw-w64-x86_64-python3
Name            : mingw-w64-x86_64-python3
Version         : 3.7.1-2
...
Build Date      : Sun, Oct 21, 2018 9:06:06 PM
Install Date    : Wed, Oct 24, 2018 5:13:35 PM

$ pacman -Qi mingw-w64-x86_64-python3-pip
Name            : mingw-w64-x86_64-python3-pip
Version         : 18.0-2

@lazka
Copy link
Member Author

lazka commented Oct 24, 2018

That's a different issue, looks like something similar to pypa/setuptools#1383

@lazka
Copy link
Member Author

lazka commented Oct 24, 2018

The error for this issue looked like this (in case someone searches for it):

File "D:\msys64\mingw32\bin\pip3-script.py", line 11, in <module>
    load_entry_point('pip==18.0', 'console_scripts', 'pip3')()
File "D:/msys64/mingw32/lib/python3.7/site-packages\pkg_resources\__init__.py", line 484, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
File "D:/msys64/mingw32/lib/python3.7/site-packages\pkg_resources\__init__.py", line 2714, in load_entry_point
    return ep.load()
File "D:/msys64/mingw32/lib/python3.7/site-packages\pkg_resources\__init__.py", line 2332, in load
    return self.resolve()
File "D:/msys64/mingw32/lib/python3.7/site-packages\pkg_resources\__init__.py", line 2338, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "D:/msys64/mingw32/lib/python3.7/site-packages\pip\_internal\__init__.py", line 42, in <module>
    from pip._internal import cmdoptions
File "D:/msys64/mingw32/lib/python3.7/site-packages\pip\_internal\cmdoptions.py", line 16, in <module>
    from pip._internal.index import (
File "D:/msys64/mingw32/lib/python3.7/site-packages\pip\_internal\index.py", line 24, in <module>
    from pip._internal.download import HAS_TLS, is_url, path_to_url, url_to_path
File "D:/msys64/mingw32/lib/python3.7/site-packages\pip\_internal\download.py", line 34, in <module>
    from pip._internal.locations import write_delete_marker_file
File "D:/msys64/mingw32/lib/python3.7/site-packages\pip\_internal\locations.py", line 17, in <module>
    USER_CACHE_DIR = appdirs.user_cache_dir("pip")
File "D:/msys64/mingw32/lib/python3.7/site-packages\pip\_internal\utils\appdirs.py", line 38, in user_cache_dir
    path = os.path.normpath(_get_win_folder("CSIDL_LOCAL_APPDATA"))
File "D:/msys64/mingw32/lib/python3.7/site-packages\pip\_internal\utils\appdirs.py", line 194, in _get_win_folder_from_registry
    import _winreg
ModuleNotFoundError: No module named '_winreg'

It's hitting an older (non-ctypes) fallback code path which was never ported to Python 3.

@peterbud
Copy link
Contributor

peterbud commented Nov 7, 2018

@lazka so what would be the solution for pip3?

@lazka
Copy link
Member Author

lazka commented Nov 7, 2018

@peterbud thanks for the reminder, I've opened #4623

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

No branches or pull requests

2 participants