sqlalchemy / mako

Mako Templates for Python
https://www.makotemplates.org
MIT License
355 stars 60 forks source link

compile error on macOS #336

Closed MarioKlebsch closed 2 years ago

MarioKlebsch commented 3 years ago

Hello,

I try to install Mako-1.1.4 on macOS 11.5, but I get an error :-(

I am not a python programmer at all, but I am installing Mako, because libvolk (https://www.libvolk.org) seems to depend on it.

At first, I had no idea, how to compile it, but then I found https://docs.python.org/2/install/index.html.

Here is what I am trying:

$ PYTHONPATH=$HOME/tmp/Mako/lib/python2.7/site-packages/
$ export PYTHONPATH
$ python setup.py install --prefix $HOME/tmp/Mako
running install
running bdist_egg
running egg_info
writing requirements to Mako.egg-info/requires.txt
writing Mako.egg-info/PKG-INFO
writing top-level names to Mako.egg-info/top_level.txt
writing dependency_links to Mako.egg-info/dependency_links.txt
writing entry points to Mako.egg-info/entry_points.txt
reading manifest file 'Mako.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching '*.mako' under directory 'doc'
warning: no files found matching '*.xml' under directory 'examples'
warning: no files found matching '*.mako' under directory 'examples'
no previously-included directories found matching 'doc/build/output'
writing manifest file 'Mako.egg-info/SOURCES.txt'
installing library code to build/bdist.macosx-11.5-x86_64/egg
running install_lib
running build_py
creating build/bdist.macosx-11.5-x86_64/egg
creating build/bdist.macosx-11.5-x86_64/egg/mako
copying build/lib/mako/pyparser.py -> build/bdist.macosx-11.5-x86_64/egg/mako
copying build/lib/mako/cmd.py -> build/bdist.macosx-11.5-x86_64/egg/mako
copying build/lib/mako/compat.py -> build/bdist.macosx-11.5-x86_64/egg/mako
copying build/lib/mako/util.py -> build/bdist.macosx-11.5-x86_64/egg/mako
copying build/lib/mako/_ast_util.py -> build/bdist.macosx-11.5-x86_64/egg/mako
creating build/bdist.macosx-11.5-x86_64/egg/mako/ext
copying build/lib/mako/ext/linguaplugin.py -> build/bdist.macosx-11.5-x86_64/egg/mako/ext
copying build/lib/mako/ext/__init__.py -> build/bdist.macosx-11.5-x86_64/egg/mako/ext
copying build/lib/mako/ext/preprocessors.py -> build/bdist.macosx-11.5-x86_64/egg/mako/ext
copying build/lib/mako/ext/beaker_cache.py -> build/bdist.macosx-11.5-x86_64/egg/mako/ext
copying build/lib/mako/ext/autohandler.py -> build/bdist.macosx-11.5-x86_64/egg/mako/ext
copying build/lib/mako/ext/babelplugin.py -> build/bdist.macosx-11.5-x86_64/egg/mako/ext
copying build/lib/mako/ext/extract.py -> build/bdist.macosx-11.5-x86_64/egg/mako/ext
copying build/lib/mako/ext/pygmentplugin.py -> build/bdist.macosx-11.5-x86_64/egg/mako/ext
copying build/lib/mako/ext/turbogears.py -> build/bdist.macosx-11.5-x86_64/egg/mako/ext
copying build/lib/mako/lookup.py -> build/bdist.macosx-11.5-x86_64/egg/mako
copying build/lib/mako/cache.py -> build/bdist.macosx-11.5-x86_64/egg/mako
copying build/lib/mako/__init__.py -> build/bdist.macosx-11.5-x86_64/egg/mako
copying build/lib/mako/runtime.py -> build/bdist.macosx-11.5-x86_64/egg/mako
copying build/lib/mako/lexer.py -> build/bdist.macosx-11.5-x86_64/egg/mako
copying build/lib/mako/template.py -> build/bdist.macosx-11.5-x86_64/egg/mako
copying build/lib/mako/ast.py -> build/bdist.macosx-11.5-x86_64/egg/mako
copying build/lib/mako/exceptions.py -> build/bdist.macosx-11.5-x86_64/egg/mako
copying build/lib/mako/parsetree.py -> build/bdist.macosx-11.5-x86_64/egg/mako
copying build/lib/mako/codegen.py -> build/bdist.macosx-11.5-x86_64/egg/mako
copying build/lib/mako/filters.py -> build/bdist.macosx-11.5-x86_64/egg/mako
copying build/lib/mako/pygen.py -> build/bdist.macosx-11.5-x86_64/egg/mako
byte-compiling build/bdist.macosx-11.5-x86_64/egg/mako/pyparser.py to pyparser.pyc
byte-compiling build/bdist.macosx-11.5-x86_64/egg/mako/cmd.py to cmd.pyc
byte-compiling build/bdist.macosx-11.5-x86_64/egg/mako/compat.py to compat.pyc
byte-compiling build/bdist.macosx-11.5-x86_64/egg/mako/util.py to util.pyc
byte-compiling build/bdist.macosx-11.5-x86_64/egg/mako/_ast_util.py to _ast_util.pyc
byte-compiling build/bdist.macosx-11.5-x86_64/egg/mako/ext/linguaplugin.py to linguaplugin.pyc
byte-compiling build/bdist.macosx-11.5-x86_64/egg/mako/ext/__init__.py to __init__.pyc
byte-compiling build/bdist.macosx-11.5-x86_64/egg/mako/ext/preprocessors.py to preprocessors.pyc
byte-compiling build/bdist.macosx-11.5-x86_64/egg/mako/ext/beaker_cache.py to beaker_cache.pyc
byte-compiling build/bdist.macosx-11.5-x86_64/egg/mako/ext/autohandler.py to autohandler.pyc
byte-compiling build/bdist.macosx-11.5-x86_64/egg/mako/ext/babelplugin.py to babelplugin.pyc
byte-compiling build/bdist.macosx-11.5-x86_64/egg/mako/ext/extract.py to extract.pyc
byte-compiling build/bdist.macosx-11.5-x86_64/egg/mako/ext/pygmentplugin.py to pygmentplugin.pyc
byte-compiling build/bdist.macosx-11.5-x86_64/egg/mako/ext/turbogears.py to turbogears.pyc
byte-compiling build/bdist.macosx-11.5-x86_64/egg/mako/lookup.py to lookup.pyc
byte-compiling build/bdist.macosx-11.5-x86_64/egg/mako/cache.py to cache.pyc
byte-compiling build/bdist.macosx-11.5-x86_64/egg/mako/__init__.py to __init__.pyc
byte-compiling build/bdist.macosx-11.5-x86_64/egg/mako/runtime.py to runtime.pyc
byte-compiling build/bdist.macosx-11.5-x86_64/egg/mako/lexer.py to lexer.pyc
byte-compiling build/bdist.macosx-11.5-x86_64/egg/mako/template.py to template.pyc
byte-compiling build/bdist.macosx-11.5-x86_64/egg/mako/ast.py to ast.pyc
byte-compiling build/bdist.macosx-11.5-x86_64/egg/mako/exceptions.py to exceptions.pyc
byte-compiling build/bdist.macosx-11.5-x86_64/egg/mako/parsetree.py to parsetree.pyc
byte-compiling build/bdist.macosx-11.5-x86_64/egg/mako/codegen.py to codegen.pyc
byte-compiling build/bdist.macosx-11.5-x86_64/egg/mako/filters.py to filters.pyc
byte-compiling build/bdist.macosx-11.5-x86_64/egg/mako/pygen.py to pygen.pyc
creating build/bdist.macosx-11.5-x86_64/egg/EGG-INFO
copying Mako.egg-info/PKG-INFO -> build/bdist.macosx-11.5-x86_64/egg/EGG-INFO
copying Mako.egg-info/SOURCES.txt -> build/bdist.macosx-11.5-x86_64/egg/EGG-INFO
copying Mako.egg-info/dependency_links.txt -> build/bdist.macosx-11.5-x86_64/egg/EGG-INFO
copying Mako.egg-info/entry_points.txt -> build/bdist.macosx-11.5-x86_64/egg/EGG-INFO
copying Mako.egg-info/not-zip-safe -> build/bdist.macosx-11.5-x86_64/egg/EGG-INFO
copying Mako.egg-info/requires.txt -> build/bdist.macosx-11.5-x86_64/egg/EGG-INFO
copying Mako.egg-info/top_level.txt -> build/bdist.macosx-11.5-x86_64/egg/EGG-INFO
creating 'dist/Mako-1.1.4-py2.7.egg' and adding 'build/bdist.macosx-11.5-x86_64/egg' to it
removing 'build/bdist.macosx-11.5-x86_64/egg' (and everything under it)
Creating /Users/mario/tmp/Mako/lib/python2.7/site-packages/site.py
Processing Mako-1.1.4-py2.7.egg
creating /Users/mario/tmp/Mako/lib/python2.7/site-packages/Mako-1.1.4-py2.7.egg
Extracting Mako-1.1.4-py2.7.egg to /Users/mario/tmp/Mako/lib/python2.7/site-packages
Adding Mako 1.1.4 to easy-install.pth file
Installing mako-render script to /Users/mario/tmp/Mako/bin

Installed /Users/mario/tmp/Mako/lib/python2.7/site-packages/Mako-1.1.4-py2.7.egg
Processing dependencies for Mako==1.1.4
Searching for MarkupSafe>=0.9.2
Reading https://pypi.org/simple/MarkupSafe/
Downloading https://files.pythonhosted.org/packages/bf/10/ff66fea6d1788c458663a84d88787bae15d45daa16f6b3ef33322a51fc7e/MarkupSafe-2.0.1.tar.gz#sha256=594c67807fb16238b30c44bdf74f36c02cdf22d1c8cda91ef8a0ed8dabf5620a
Best match: MarkupSafe 2.0.1
Processing MarkupSafe-2.0.1.tar.gz
Writing /var/folders/cz/nypc0v0s4tg8fmm2jwb6lmm80000gn/T/easy_install-9s8cXq/MarkupSafe-2.0.1/setup.cfg
Running MarkupSafe-2.0.1/setup.py -q bdist_egg --dist-dir /var/folders/cz/nypc0v0s4tg8fmm2jwb6lmm80000gn/T/easy_install-9s8cXq/MarkupSafe-2.0.1/egg-dist-tmp-y3MAP_
Traceback (most recent call last):
  File "setup.py", line 96, in <module>
    'lingua',
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/setuptools/__init__.py", line 145, in setup
    return distutils.core.setup(**attrs)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/core.py", line 151, in setup
    dist.run_commands()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/setuptools/command/install.py", line 67, in run
    self.do_egg_install()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/setuptools/command/install.py", line 117, in do_egg_install
    cmd.run()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/setuptools/command/easy_install.py", line 418, in run
    self.easy_install(spec, not self.no_deps)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/setuptools/command/easy_install.py", line 660, in easy_install
    return self.install_item(None, spec, tmpdir, deps, True)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/setuptools/command/easy_install.py", line 707, in install_item
    self.process_distribution(spec, dist, deps)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/setuptools/command/easy_install.py", line 752, in process_distribution
    [requirement], self.local_index, self.easy_install
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 782, in resolve
    replace_conflicting=replace_conflicting
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 1065, in best_match
    return self.obtain(req, installer)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 1077, in obtain
    return installer(requirement)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/setuptools/command/easy_install.py", line 679, in easy_install
    return self.install_item(spec, dist.location, tmpdir, deps)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/setuptools/command/easy_install.py", line 705, in install_item
    dists = self.install_eggs(spec, download, tmpdir)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/setuptools/command/easy_install.py", line 890, in install_eggs
    return self.build_and_install(setup_script, setup_base)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/setuptools/command/easy_install.py", line 1158, in build_and_install
    self.run_setup(setup_script, setup_base, args)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/setuptools/command/easy_install.py", line 1144, in run_setup
    run_setup(setup_script, args)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/setuptools/sandbox.py", line 253, in run_setup
    raise
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 35, in __exit__
    self.gen.throw(type, value, traceback)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/setuptools/sandbox.py", line 195, in setup_context
    yield
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 35, in __exit__
    self.gen.throw(type, value, traceback)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/setuptools/sandbox.py", line 166, in save_modules
    saved_exc.resume()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/setuptools/sandbox.py", line 141, in resume
    six.reraise(type, exc, self._tb)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/setuptools/sandbox.py", line 154, in save_modules
    yield saved
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/setuptools/sandbox.py", line 195, in setup_context
    yield
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/setuptools/sandbox.py", line 250, in run_setup
    _execfile(setup_script, ns)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/setuptools/sandbox.py", line 45, in _execfile
    exec(code, globals, locals)
  File "/var/folders/cz/nypc0v0s4tg8fmm2jwb6lmm80000gn/T/easy_install-9s8cXq/MarkupSafe-2.0.1/setup.py", line 61, in <module>
    url="https://www.makotemplates.org/",
  File "/var/folders/cz/nypc0v0s4tg8fmm2jwb6lmm80000gn/T/easy_install-9s8cXq/MarkupSafe-2.0.1/setup.py", line 44, in run_setup
    classifiers=[
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/setuptools/__init__.py", line 145, in setup
    return distutils.core.setup(**attrs)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/core.py", line 124, in setup
    dist.parse_config_files()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/setuptools/dist.py", line 698, in parse_config_files
    ignore_option_errors=ignore_option_errors)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/setuptools/config.py", line 120, in parse_configuration
    meta.parse()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/setuptools/config.py", line 425, in parse
    section_parser_method(section_options)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/setuptools/config.py", line 398, in parse_section
    self[name] = value
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/setuptools/config.py", line 183, in __setitem__
    value = parser(value)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/setuptools/config.py", line 513, in _parse_version
    version = self._parse_attr(value, self.package_dir)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/setuptools/config.py", line 349, in _parse_attr
    value = getattr(module, attr_name)
AttributeError: 'module' object has no attribute '__version__'
$ 

Can anyone help my?

73, Mario

jvanasco commented 3 years ago

This isn't an issue with Mako, but with how Python is currently installed on your operating system. The actual issue is happening when installing MarkupSafe, a dependent library.

You're going to get the best help on this from the libvolk people. What I can tell you that may work or help you get in the right direction:

that will upgrade the package manager, upgrade the installation manager, and try to install Markupsafe, which is failing. If that works, you may be set to finish installing whatever else you need.

installing Python3 will keep the Python2 system in place, but just add a python3 directory and framework. you should be left with a python2 + pip2 and python3 + pip3 executables. python and pip will be symlinks to either the v2 or v3 installation, but I have no idea what that installer will do.

jvanasco commented 3 years ago

Adding:

$ PYTHONPATH=$HOME/tmp/Mako/lib/python2.7/site-packages/
$ export PYTHONPATH
$ python setup.py install --prefix $HOME/tmp/Mako

those lines are having you install Python into a tmp directory. I would not do that. You should either leave out the pythonpath, or use virtualenv if you want to sequester everything https://virtualenv.pypa.io/en/latest/

MarioKlebsch commented 3 years ago

those lines are having you install Python into a tmp directory. I would not do that.

I was using a temp directory just to demonstrate the problem installing Mako.