当使用MySQL代替SQLite进行JupyterHub会话和令牌存储时,出现此错误。
[E 2018-06-27 06:04:36.542 JupyterHub app:1623]
jupyterhub4cc | Traceback (most recent call last):
jupyterhub4cc | File "/usr/local/lib/python3.6/dist-packages/jupyterhub/app.py", line 1620, in launch_instance_async
jupyterhub4cc | yield self.initialize(argv)
jupyterhub4cc | File "/usr/lib/python3.6/types.py", line 204, in __next__
jupyterhub4cc | return next(self.__wrapped)
jupyterhub4cc | File "/usr/local/lib/python3.6/dist-packages/jupyterhub/app.py", line 1373, in initialize
jupyterhub4cc | self.init_db()
jupyterhub4cc | File "/usr/local/lib/python3.6/dist-packages/jupyterhub/app.py", line 895, in init_db
jupyterhub4cc | **self.db_kwargs
jupyterhub4cc | File "/usr/local/lib/python3.6/dist-packages/jupyterhub/orm.py", line 526, in new_session_factory
jupyterhub4cc | engine = create_engine(url, **kwargs)
jupyterhub4cc | File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/engine/__init__.py", line 424, in create_engine
jupyterhub4cc | return strategy.create(*args, **kwargs)
jupyterhub4cc | File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/engine/strategies.py", line 81, in create
jupyterhub4cc | dbapi = dialect_cls.dbapi(**dbapi_args)
jupyterhub4cc | File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/dialects/mysql/mysqlconnector.py", line 107, in dbapi
jupyterhub4cc | from mysql import connector
jupyterhub4cc | ModuleNotFoundError: No module named 'mysql'
我已经在JupyterHub容器中使用了这三个库来与MySQL连接。
使用的配置是:
c.JupyterHub.db_url = 'mysql+mysqlconnector://{}:{}@{}/{}{}'.format("test","test","localhost","test","")
P.S。我已在本地安装MySQL服务器,并使用用户名“测试” 和密码“测试” 创建了数据库“测试” 。