libtcod / python-tcod

A high-performance Python port of libtcod. Includes the libtcodpy module for backwards compatibility with older projects.
BSD 2-Clause "Simplified" License
413 stars 36 forks source link

Can't install tcod 11.19.x on Mac OSX 10.14.6 (Mojave) #104

Closed thely closed 3 years ago

thely commented 3 years ago

Getting the following error when I try to install via pip3. I'm 60% sure it's actually an SSL issue and not my computer because I was able to install virtualenv with pip3 just fine.

  Using cached tcod-11.19.0.tar.gz (877 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  ERROR: Command errored out with exit status 1:
   command: /Library/Frameworks/Python.framework/Versions/3.8/bin/python3 /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py get_requires_for_build_wheel /var/folders/40/fzdq22dd39v2ll6v6452_88m0000gn/T/tmp4o1niha4
       cwd: /private/var/folders/40/fzdq22dd39v2ll6v6452_88m0000gn/T/pip-install-ii898la6/tcod_9913ab8926824eedaa56b39fa6d4cb4a
  Complete output (83 lines):
  fatal: not a git repository (or any of the parent directories): .git
  Downloading https://www.libsdl.org/release/SDL2-2.0.5.dmg
  Traceback (most recent call last):
    File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py", line 1350, in do_open
      h.request(req.get_method(), req.selector, req.data, headers,
    File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/http/client.py", line 1255, in request
      self._send_request(method, url, body, headers, encode_chunked)
    File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/http/client.py", line 1301, in _send_request
      self.endheaders(body, encode_chunked=encode_chunked)
    File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/http/client.py", line 1250, in endheaders
      self._send_output(message_body, encode_chunked=encode_chunked)
    File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/http/client.py", line 1010, in _send_output
      self.send(msg)
    File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/http/client.py", line 950, in send
      self.connect()
    File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/http/client.py", line 1424, in connect
      self.sock = self._context.wrap_socket(self.sock,
    File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/ssl.py", line 500, in wrap_socket
      return self.sslsocket_class._create(
    File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/ssl.py", line 1040, in _create
      self.do_handshake()
    File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/ssl.py", line 1309, in do_handshake
      self._sslobj.do_handshake()
  ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1123)

  During handling of the above exception, another exception occurred:

  Traceback (most recent call last):
    File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py", line 280, in <module>
      main()
    File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py", line 263, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
    File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py", line 114, in get_requires_for_build_wheel
      return hook(config_settings)
    File "/private/var/folders/40/fzdq22dd39v2ll6v6452_88m0000gn/T/pip-build-env-9epxhmj4/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 149, in get_requires_for_build_wheel
      return self._get_build_requires(
    File "/private/var/folders/40/fzdq22dd39v2ll6v6452_88m0000gn/T/pip-build-env-9epxhmj4/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 130, in _get_build_requires
      self.run_setup()
    File "/private/var/folders/40/fzdq22dd39v2ll6v6452_88m0000gn/T/pip-build-env-9epxhmj4/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 253, in run_setup
      super(_BuildMetaLegacyBackend,
    File "/private/var/folders/40/fzdq22dd39v2ll6v6452_88m0000gn/T/pip-build-env-9epxhmj4/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 145, in run_setup
      exec(compile(code, __file__, 'exec'), locals())
    File "setup.py", line 116, in <module>
      setup(
    File "/private/var/folders/40/fzdq22dd39v2ll6v6452_88m0000gn/T/pip-build-env-9epxhmj4/overlay/lib/python3.8/site-packages/setuptools/__init__.py", line 153, in setup
      return distutils.core.setup(**attrs)
    File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/distutils/core.py", line 108, in setup
      _setup_distribution = dist = klass(attrs)
    File "/private/var/folders/40/fzdq22dd39v2ll6v6452_88m0000gn/T/pip-build-env-9epxhmj4/overlay/lib/python3.8/site-packages/setuptools/dist.py", line 423, in __init__
      _Distribution.__init__(self, {
    File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/distutils/dist.py", line 292, in __init__
      self.finalize_options()
    File "/private/var/folders/40/fzdq22dd39v2ll6v6452_88m0000gn/T/pip-build-env-9epxhmj4/overlay/lib/python3.8/site-packages/setuptools/dist.py", line 695, in finalize_options
      ep(self)
    File "/private/var/folders/40/fzdq22dd39v2ll6v6452_88m0000gn/T/pip-build-env-9epxhmj4/overlay/lib/python3.8/site-packages/setuptools/dist.py", line 702, in _finalize_setup_keywords
      ep.load()(self, ep.name, value)
    File "/private/var/folders/40/fzdq22dd39v2ll6v6452_88m0000gn/T/pip-build-env-9epxhmj4/overlay/lib/python3.8/site-packages/cffi/setuptools_ext.py", line 219, in cffi_modules
      add_cffi_module(dist, cffi_module)
    File "/private/var/folders/40/fzdq22dd39v2ll6v6452_88m0000gn/T/pip-build-env-9epxhmj4/overlay/lib/python3.8/site-packages/cffi/setuptools_ext.py", line 49, in add_cffi_module
      execfile(build_file_name, mod_vars)
    File "/private/var/folders/40/fzdq22dd39v2ll6v6452_88m0000gn/T/pip-build-env-9epxhmj4/overlay/lib/python3.8/site-packages/cffi/setuptools_ext.py", line 25, in execfile
      exec(code, glob, glob)
    File "build_libtcod.py", line 230, in <module>
      SDL2_PARSE_PATH = unpack_sdl2(SDL2_PARSE_VERSION)
    File "build_libtcod.py", line 179, in unpack_sdl2
      sdl2_arc = get_sdl2_file(version)
    File "build_libtcod.py", line 168, in get_sdl2_file
      urlretrieve(sdl2_remote_file, sdl2_local_file)
    File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py", line 247, in urlretrieve
      with contextlib.closing(urlopen(url, data)) as fp:
    File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py", line 222, in urlopen
      return opener.open(url, data, timeout)
    File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py", line 525, in open
      response = self._open(req, data)
    File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py", line 542, in _open
      result = self._call_chain(self.handle_open, protocol, protocol +
    File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py", line 502, in _call_chain
      result = func(*args)
    File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py", line 1393, in https_open
      return self.do_open(http.client.HTTPSConnection, req,
    File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py", line 1353, in do_open
      raise URLError(err)
  urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1123)>
  ----------------------------------------
ERROR: Command errored out with exit status 1: /Library/Frameworks/Python.framework/Versions/3.8/bin/python3 /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py get_requires_for_build_wheel /var/folders/40/fzdq22dd39v2ll6v6452_88m0000gn/T/tmp4o1niha4 Check the logs for full command output.
HexDecimal commented 3 years ago

The MacOS wheel failed to deploy for version 11.19.0.

I'll need to work on this. Until it's fixed you should be able to install tcod version 11.18.3.

HexDecimal commented 3 years ago

Version 11.19.1 has a working MacOS wheel. It should install without issues.

thely commented 3 years ago

Thanks for the fast response! Installation now works. I have a related new-to-tcod error, which seems relevant here, but could be a new issue if you'd prefer. I'm running the ultra-basic starter main.py that runs import tcod and a quick hello world. I installed the latest SDL2 via brew, and the latest libtcod_cffi since that seemed to help in closed issues, but no dice. I'm running in a venv, but I also have tcod installed globally; this error is occurring regardless of environment. Python 3.8.5.

Traceback (most recent call last):
  File "main.py", line 2, in <module>
    import tcod
  File "/Users/becky/Documents/Development/games/rltut/env/lib/python3.8/site-packages/tcod/__init__.py", line 21, in <module>
    from tcod import (
  File "/Users/becky/Documents/Development/games/rltut/env/lib/python3.8/site-packages/tcod/bsp.py", line 28, in <module>
    import tcod.random
  File "/Users/becky/Documents/Development/games/rltut/env/lib/python3.8/site-packages/tcod/random.py", line 11, in <module>
    import tcod.constants
  File "/Users/becky/Documents/Development/games/rltut/env/lib/python3.8/site-packages/tcod/constants.py", line 6, in <module>
    from tcod.color import Color
  File "/Users/becky/Documents/Development/games/rltut/env/lib/python3.8/site-packages/tcod/color.py", line 7, in <module>
    from tcod._internal import deprecate
  File "/Users/becky/Documents/Development/games/rltut/env/lib/python3.8/site-packages/tcod/_internal.py", line 10, in <module>
    from tcod.loader import ffi, lib
  File "/Users/becky/Documents/Development/games/rltut/env/lib/python3.8/site-packages/tcod/loader.py", line 98, in <module>
    from tcod._libtcod import ffi, lib  # type: ignore # noqa: F401
ImportError: dlopen(/Users/becky/Documents/Development/games/rltut/env/lib/python3.8/site-packages/tcod/_libtcod.abi3.so, 2): Library not loaded: @rpath/hidapi.framework/Versions/A/hidapi
  Referenced from: /Users/becky/Documents/Development/games/rltut/env/lib/python3.8/site-packages/tcod/.dylibs/SDL2
  Reason: image not found
HexDecimal commented 3 years ago

This issue will still work. It'll be reopened until I resolve this new problem.

libtcod-cffi was the old name of the current python-tcod package. It will have no effect since it just installs tcod now.

From inspecting the build logs it looks like tcod failed to package its loose dependencies this version:

Run delocate-wheel -v dist/*.whl
/Users/runner/work/python-tcod/python-tcod/venv/lib/python3.7/site-packages/delocate/libsana.py:111: UserWarning: Couldn't find @rpath/hidapi.framework/Versions/A/hidapi on paths:
Fixing: dist/tcod-11.19.1-cp35-abi3-macosx_10_9_x86_64.whl
    /Users/runner/work/python-tcod/python-tcod/@executable_path/Frameworks
Copied to package .dylibs directory:
    /Users/runner/work/python-tcod/python-tcod/@loader_path/Frameworks
  '\n\t'.join(realpath(path) for path in rpaths),
  /Users/runner/work/python-tcod/python-tcod/dependencies/SDL2-2.0.14/SDL2.framework/Versions/A/SDL2
/Users/runner/work/python-tcod/python-tcod/venv/lib/python3.7/site-packages/delocate/libsana.py:111: UserWarning: Couldn't find @rpath/hidapi.framework/Versions/A/hidapi on paths:
/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit
    /Users/runner/work/python-tcod/python-tcod/@executable_path/Frameworks
/System/Library/Frameworks/ApplicationServices.framework/Versions/A/ApplicationServices
    /Users/runner/work/python-tcod/python-tcod/@loader_path/Frameworks
/System/Library/Frameworks/AudioToolbox.framework/Versions/A/AudioToolbox
  '\n\t'.join(realpath(path) for path in rpaths),

I'd expect this to cause the error you're experiencing. I recently changed the bundled version of SDL from 2.0.10 to 2.0.14 and that's likely the cause of the current issue.

I'll need to either revert SDL or find where hidapi is so I can bundle it. tcod==11.18.3 is still an option while I figure this out.

HexDecimal commented 3 years ago

Here's version 11.19.2 with SDL reverted to a version not dependent on hidapi. Feel free to reopen the issue if there are more problems but I am very confident in this release.