SyntaxError regarding async when attempting to run Jupyter in Python 3.7

For me, it was conflicting with apt-get installed python3, so I had to first uninstall it/them:

sudo apt-get remove python-pexpect python3-pexpect

And then

sudo pip3.7 install --upgrade pexpect


Download pexpect4.6 source code from https://github.com/pexpect/pexpect/releases/tag/4.6

Extract the source code, get into the folder and install the pexpect by:

sudo python3.7 setup.py install

This should solve your problem. :)


I had the same problem and the following steps worked for me.

I went to /usrlib/python3/dist-packages/pexpect/ and there I

  • renamed async.py to _async.py
  • opened spawn.py and made these replacements:
    'async=' -> 'async_='
    'async:'-> 'async_:'
    '.async' -> '._async'
    

Hope it helps someone else, too.