SublimeCodeIntel / CodeIntel

Full-featured code intelligence and smart autocomplete engine
http://www.sublimecodeintel.com
Other
42 stars 8 forks source link

Code Intel failed to install with "syntax error -> self.async = False" #5

Open lx-s opened 6 years ago

lx-s commented 6 years ago

Using Windows 10 and Python 3.7:

C:\Temp>pip3 install CodeIntel
Collecting CodeIntel
  Using cached https://files.pythonhosted.org/packages/0a/24/141db0d6c64453e6848849979b9c527d3547ad1552674763000e9da2a648/CodeIntel-2.0.0.tar.gz
Collecting 3to2 (from CodeIntel)
  Using cached https://files.pythonhosted.org/packages/8f/ab/58a363eca982c40e9ee5a7ca439e8ffc5243dde2ae660ba1ffdd4868026b/3to2-1.1.1.zip
Collecting applib (from CodeIntel)
  Using cached https://files.pythonhosted.org/packages/d4/20/67c3c98b557cfa2aa95dc0a9281989e6ab740a5058ee1f8a5f8febba8aaf/applib-1.2.tar.gz
Collecting chardet (from CodeIntel)
  Using cached https://files.pythonhosted.org/packages/bc/a9/01ffebfb562e4274b6487b4bb1ddec7ca55ec7510b22e4c51f14098443b8/chardet-3.0.4-py2.py3-none-any.whl
Collecting cmdln (from CodeIntel)
  Using cached https://files.pythonhosted.org/packages/26/23/7654219ac89aa48190341b7c7114fea21e21889693def5f625ef2a218d5d/cmdln-2.0.0.zip
Collecting esprima (from CodeIntel)
  Using cached https://files.pythonhosted.org/packages/86/61/ff7a62bcf79cebb6faf42c0ff28756c152a9dcf7244019093ca4513d80ee/esprima-4.0.0.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "c:\Temp\pip-install-lv5xq4a5\esprima\setup.py", line 8, in <module>
        from esprima import version
      File "c:\Temp\pip-install-lv5xq4a5\esprima\esprima\__init__.py", line 29, in <module>
        from .esprima import *  # NOQA
      File "c:\Temp\pip-install-lv5xq4a5\esprima\esprima\esprima.py", line 26, in <module>
        from .comment_handler import CommentHandler
      File "c:\Temp\pip-install-lv5xq4a5\esprima\esprima\comment_handler.py", line 27, in <module>
        from .nodes import Node
      File "c:\Temp\pip-install-lv5xq4a5\esprima\esprima\nodes.py", line 61
        self.async = False
                 ^
    SyntaxError: invalid syntax

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in c:\Temp\pip-install-lv5xq4a5\esprima\
henderea commented 6 years ago

Same on Mac 10.13.5 with homebrew-installed Python 3.7. There seem to have been some syntax/api changes in Python 3.7, and it breaks multiple packages, including the esprima package used by codeintel.

peterkos commented 6 years ago

A temporary workaround is to install pyenv and switch to a version of Python where esprima doesn't freak out during install.

Here's what I did:

brew install pyenv
pyenv install 3.6.5
pyenv global 3.6.5
eval "$(pyenv init -)"
pip install --upgrade --pre CodeIntel

Don't forget to switch back to your default brew/system Python with pyenv global system afterwards, unless you want to sit on 3.6.5.

ghost commented 6 years ago

This might or might not be related: But switching back to 3.6.5 via @peterkos workaround or by doing a brew switch 3.6.5 if available still yields a different problem for me on macos 10.13.5:

$ pip3 install --upgrade --pre CodeIntel
Collecting CodeIntel
  Using cached https://files.pythonhosted.org/packages/85/58/8e708906b4a2f4c811691f791f8f409f703c3ea1bd2a55373eb45077324e/CodeIntel-2.0.0-cp36-cp36m-macosx_10_12_x86_64.whl
Collecting 3to2 (from CodeIntel)
  Using cached https://files.pythonhosted.org/packages/8f/ab/58a363eca982c40e9ee5a7ca439e8ffc5243dde2ae660ba1ffdd4868026b/3to2-1.1.1.zip
Collecting libclang-py3 (from CodeIntel)
  Using cached https://files.pythonhosted.org/packages/aa/73/d0cc2b5e896bf6ea152b2324d00963ec6b0b116bb5ed672018c0bacd97c0/libclang-py3-3.9.0.tar.gz
Collecting esprima (from CodeIntel)
  Using cached https://files.pythonhosted.org/packages/86/61/ff7a62bcf79cebb6faf42c0ff28756c152a9dcf7244019093ca4513d80ee/esprima-4.0.0.tar.gz
Collecting zope.cachedescriptors (from CodeIntel)
  Using cached https://files.pythonhosted.org/packages/81/6f/d668102e1bd4fba6cfb160e178477b4e5ade20ccac0b2b390d4f64d0bb9d/zope.cachedescriptors-4.3.1-py2.py3-none-any.whl
Collecting inflector (from CodeIntel)
  Using cached https://files.pythonhosted.org/packages/c4/51/d3cc209c8a0471ef5a04ac750f203b5b486fc70e6cb51c96d99decd49bc4/Inflector-2.0.12.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/7n/wgzp5xg5643g24cjx93sqlq00000gn/T/pip-install-i8xj2h72/inflector/setup.py", line 6, in <module>
        README = open(os.path.join(here, 'README.md')).read()
      File "/usr/local/Cellar/python/3.6.5/Frameworks/Python.framework/Versions/3.6/lib/python3.6/encodings/ascii.py", line 26, in decode
        return codecs.ascii_decode(input, self.errors)[0]
    UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 375: ordinal not in range(128)

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/7n/wgzp5xg5643g24cjx93sqlq00000gn/T/pip-install-i8xj2h72/inflector/

Looking at the repo for inflector I found an issue about python3 compatibility.

peterkos commented 6 years ago

I ran python setup.py egg_info on 3.6.5 in Inflector standalone and it worked just fine, as well as build & install on Inflector using 3.6.5. (I'm also on macOS 10.13.5).

❯ python setup.py egg_info
running egg_info
writing Inflector.egg-info/PKG-INFO
writing dependency_links to Inflector.egg-info/dependency_links.txt
writing top-level names to Inflector.egg-info/top_level.txt
reading manifest file 'Inflector.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'Inflector.egg-info/SOURCES.txt'
franccesco commented 6 years ago

Yeah it seems that async and await are now reserved keywords in Python 3.7 so unless those keywords are renamed in the esprima-python package it's not gonna work. https://docs.python.org/3/whatsnew/3.7.html

Kronuz commented 6 years ago

Got it! Thank you! Could you help me with a a pull requests in https://github.com/Kronuz/esprima-python ?