vn.py官网
开源量化社区
Member
avatar
加入于:
帖子: 4
声望: 0

vn.py 版本:2.5.0,提问时最新,完全卸载后重装过,确定为数据库引起问题。
MySQL 版本:8.0,本地数据库终端可以正常登录,并已创建有 vnpy 数据库,可能是登录加密的问题?

切换 MySQL 数据库会导致 VN Trader 无法启动,切换回 sqlite 则又恢复正常。并且触发异常窗口为未响应的空白窗口,我在旧版本 vn.py 这个触发异常窗口看到的报错信息类似于这个问题的描述,但我用 pip 和 conda 都安装了 cryptography 之后仍然没有解决。求教

Member
avatar
加入于:
帖子: 3155
声望: 184

请贴一下报错信息

Member
avatar
加入于:
帖子: 4
声望: 0

xiaohe wrote:

请贴一下报错信息

触发异常的窗口每次都是未响应的一片空白,我查看了用户目录下的log文件夹内的vt_{YYYYMMDD}.log都是空白的。我该从哪里获得异常信息..?

Member
avatar
加入于:
帖子: 3155
声望: 184

在cmd用命令行python -m vnstation启动,然后复现你的操作看看底层的报错信息

Member
avatar
加入于:
帖子: 4
声望: 0

Traceback (most recent call last):
File "C:\vnstudio\lib\runpy.py", line 193, in _run_module_as_main
"main", mod_spec)
File "C:\vnstudio\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\vnstudio\lib\site-packages\vnstation__main.py", line 4, in <module>
cli()
File "C:\vnstudio\lib\site-packages\click\core.py", line 1137, in
call
return self.main(*args, kwargs)
File "C:\vnstudio\lib\site-packages\click\core.py", line 1062, in main
rv = self.invoke(ctx)
File "C:\vnstudio\lib\site-packages\click\core.py", line 1668, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "C:\vnstudio\lib\site-packages\click\core.py", line 1404, in invoke
return ctx.invoke(self.callback,
ctx.params)
File "C:\vnstudio\lib\site-packages\click\core.py", line 763, in invoke
return
callback(*args, kwargs)
File "C:\vnstudio\lib\site-packages\vnstation\cli.py", line 28, in runtrader
run_trader(s)
File "C:\vnstudio\lib\site-packages\vnstation\cli.py", line 89, in run_trader
module = importlib.import_module(d["module"])
File "C:\vnstudio\lib\importlib__init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "C:\vnstudio\lib\site-packages\vnpy_ctastrategy\
init.py", line 32, in <module>
from .engine import CtaEngine
File "C:\vnstudio\lib\site-packages\vnpy_ctastrategy\engine.py", line 42, in <module>
from vnpy.trader.database import database_manager
File "C:\vnstudio\lib\site-packages\vnpy\trader\database.py", line 118, in <module>
database_manager: BaseDatabase = import_module(module_name).database_manager
File "C:\vnstudio\lib\importlib\
init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "C:\vnstudio\lib\site-packages\vnpy\database\mysql\
init.py", line 1, in <module>
from .mysql_database import database_manager
File "C:\vnstudio\lib\site-packages\vnpy\database\mysql\mysql_database.py", line 420, in <module>
database_manager = MysqlDatabase()
File "C:\vnstudio\lib\site-packages\vnpy\database\mysql\mysql_database.py", line 138, in
init__
self.db.connect()
File "C:\vnstudio\lib\site-packages\peewee.py", line 3080, in connect
self._state.set_connection(self._connect())
File "C:\vnstudio\lib\site-packages\peewee.py", line 3982, in _connect
conn = mysql.connect(db=self.database,
self.connect_params)
File "C:\vnstudio\lib\site-packages\pymysql\connections.py", line 353, in init
self.connect()
File "C:\vnstudio\lib\site-packages\pymysql\connections.py", line 633, in connect
self._request_authentication()
File "C:\vnstudio\lib\site-packages\pymysql\connections.py", line 932, in _request_authentication
auth_packet = _auth.caching_sha2_password_auth(self, auth_packet)
File "C:\vnstudio\lib\site-packages\pymysql_auth.py", line 265, in caching_sha2_password_auth
data = sha2_rsa_encrypt(conn.password, conn.salt, conn.server_public_key)
File "C:\vnstudio\lib\site-packages\pymysql_auth.py", line 144, in sha2_rsa_encrypt
"'cryptography' package is required for sha256_password or caching_sha2_password auth methods"
RuntimeError: 'cryptography' package is required for sha256_password or caching_sha2_password auth methods

Member
avatar
加入于:
帖子: 76
声望: 8

本机是否存在多个python环境?pip是否是在vnstudio的python中安装的

Member
avatar
加入于:
帖子: 4
声望: 0

郭易燔 wrote:

本机是否存在多个python环境?pip是否是在vnstudio的python中安装的

噢...确实是这个问题,在vnstudio的python环境下安装crytography就好了,但用安装包自带的pip 19.0.3安装同样会报错
python -m pip install --upgrade pip 升级pip后再安装crytography就顺利解决了

谢谢解答

© 2015-2019 上海韦纳软件科技有限公司
备案服务号:沪ICP备18006526号-3

沪公网安备 31011502017034号