ImportError: cannot import name 'Deque' ImportError: cannot import name 'Deque' heroku heroku

ImportError: cannot import name 'Deque'


The websockets module is incompatible with python 3.6.0

I reproduced the problem myself:

C:\Users\Me>pythonPython 3.6.0 (v3.6.0:41df79263a11, Dec 23 2016, 08:06:12) [MSC v.1900 64 bit (AMD64)] on win32Type "help", "copyright", "credits" or "license" for more information.>>>C:\Users\Me>pip install websocketsCollecting websockets  Downloading https://files.pythonhosted.org/packages/6a/bd/8555c65b3fca7310b2601d0957b36511c3c3c2e8a93a6d3f90c671b70c6a/websockets-8.0.2-cp36-cp36m-win_amd64.whl (65kB)     |████████████████████████████████| 71kB 918kB/sInstalling collected packages: websocketsSuccessfully installed websockets-8.0.2WARNING: You are using pip version 19.1.1, however version 20.0.2 is available.You should consider upgrading via the 'python -m pip install --upgrade pip' command.C:\Users\Me>pythonPython 3.6.0 (v3.6.0:41df79263a11, Dec 23 2016, 08:06:12) [MSC v.1900 64 bit (AMD64)] on win32Type "help", "copyright", "credits" or "license" for more information.>>> import websocketsTraceback (most recent call last):  File "<stdin>", line 1, in <module>  File "C:\Users\Me\AppData\Local\Programs\Python\Python36\lib\site-packages\websockets\__init__.py", line 3, in <module>    from .auth import *  File "C:\Users\Me\AppData\Local\Programs\Python\Python36\lib\site-packages\websockets\auth.py", line 15, in <module>    from .server import HTTPResponse, WebSocketServerProtocol  File "C:\Users\Me\AppData\Local\Programs\Python\Python36\lib\site-packages\websockets\server.py", line 49, in <module>    from .protocol import WebSocketCommonProtocol  File "C:\Users\Me\AppData\Local\Programs\Python\Python36\lib\site-packages\websockets\protocol.py", line 18, in <module>    from typing import (ImportError: cannot import name 'Deque'

It works in 3.6.1: https://repl.it/repls/NotableDarkorchidBloatware


My guess is that the version of Python you're running on Heroku doesn't have typing.Deque. Try running heroku run -a <app_name> python -V or run a python shell and on the dyno and try importing yourself. If it's a python version issue then you should be able to resolve it by defining a runtime.txt file in your project root and setting the version explicitly there (https://devcenter.heroku.com/articles/python-runtimes)