VeighNa量化社区
你的开源社区量化交易平台
Member
avatar
加入于:
帖子: 4
声望: 0

请教一下大佬帮忙看下这个是什么问题?同样的安装方法,在公司电脑上可以运行,在家里电脑却报错,试了几次,最后一次把电脑都初始化了,python也只有一个版本,谢谢了。

Traceback (most recent call last):
File "C:\vnpy-3.2.0\examples\veighna_trader\run.py", line 35, in <module>
from vnpy_rpcservice import RpcServiceApp
File "C:\Python310\lib\site-packages\vnpy_rpcservice__init.py", line 26, in <module>
from .rpc_gateway import RpcGateway
File "C:\Python310\lib\site-packages\vnpy_rpcservice\rpc_gateway\
init.py", line 1, in <module>
from .rpc_gateway import RpcGateway
File "C:\Python310\lib\site-packages\vnpy_rpcservice\rpc_gateway\rpc_gateway.py", line 4, in <module>
from vnpy.rpc import RpcClient
File "C:\Python310\lib\site-packages\vnpy\rpc\
init__.py", line 1, in <module>
from .client import RpcClient
File "C:\Python310\lib\site-packages\vnpy\rpc\client.py", line 7, in <module>
from zmq.backend.cython.constants import NOBLOCK
ModuleNotFoundError: No module named 'zmq.backend.cython.constants'

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

降级pyzmq到23.0.0版本,问题解决了

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

vnpy3.3版本 启动报错:ModuleNotFoundError: No module named 'zmq.backend.cython.constants'
报错代码: from zmq.backend.cython.constants import NOBLOCK

原因:pyzmq 23版本,去掉了constants模块。

解决方案:

C:\veighna_studio\Lib\site-packages\vnpy\rpc\client.py 将第7行代码:

from zmq.backend.cython.constants import NOBLOCK

修改为:

from zmq import NOBLOCK

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

File "C:\Miniconda3\envs\vnpy3.3.0\lib\site-packages\zmq\sugar\socket.py", line 804, in send_json
return self.send(msg, flags=flags, **send_kwargs)
File "C:\Miniconda3\envs\vnpy3.3.0\lib\site-packages\zmq\sugar\socket.py", line 547, in send
return super(Socket, self).send(data, flags=flags, copy=copy, track=track)
File "zmq\backend\cython\socket.pyx", line 718, in zmq.backend.cython.socket.Socket.send
File "zmq\backend\cython\socket.pyx", line 765, in zmq.backend.cython.socket.Socket.send
File "zmq\backend\cython\socket.pyx", line 247, in zmq.backend.cython.socket._send_copy
File "zmq\backend\cython\socket.pyx", line 242, in zmq.backend.cython.socket._send_copy
File "zmq\backend\cython\checkrc.pxd", line 28, in zmq.backend.cython.checkrc._check_rc
zmq.error.ZMQError: Operation cannot be accomplished in current state

Member
avatar
加入于:
帖子: 4774
声望: 289

可以描述一下你的具体操作和import的模块以及pyzmq版本

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

VeighNa3.3.0手动安装
在C:\vnpy\vnpy3.3.0 \run.py中,启动(import) DataRecorder模块:
from vnpy_datarecorder import DataRecorderApp
main_engine.add_app(DataRecorderApp)

进入图形界面并点击连接后,出现错误信息:
(vnpy3.3.0) C:\vnpy\vnpy3.3.0>python run.py
Exception in thread Thread-1 (_run):
Traceback (most recent call last):
File "C:\Miniconda3\envs\vnpy3.3.0\lib\threading.py", line 1016, in _bootstrap_inner
self.run()
File "C:\Miniconda3\envs\vnpy3.3.0\lib\threading.py", line 953, in run
self._target(*self._args, self._kwargs)
File "C:\vnpy\vnpy3.3.0\vnpy\event\engine.py", line 60, in _run
self._process(event)
File "C:\vnpy\vnpy3.3.0\vnpy\event\engine.py", line 73, in _process
[handler(event) for handler in self._handlers[event.type]]
File "C:\vnpy\vnpy3.3.0\vnpy\event\engine.py", line 73, in <listcomp>
[handler(event) for handler in self._handlers[event.type]]
File "C:\Miniconda3\envs\vnpy3.3.0\lib\site-packages\vnpy_datarecorder\engine.py", line 232, in process_contract_event
self.subscribe(contract)
File "C:\Miniconda3\envs\vnpy3.3.0\lib\site-packages\vnpy_datarecorder\engine.py", line 294, in subscribe
self.main_engine.subscribe(req, contract.gateway_name)
File "C:\vnpy\vnpy3.3.0\vnpy\trader\engine.py", line 179, in subscribe
gateway.subscribe(req)
File "C:\Miniconda3\envs\vnpy3.3.0\lib\site-packages\vnpy_XXX\XXX_gateway.py", line 260, in subscribe
self.client.send_request(XXX_req)
File "C:\Miniconda3\envs\vnpy3.3.0\lib\site-packages\vnpy_XXX\XXX_gateway.py", line 744, in send_request
self.socket_req.send_json(req)
File "C:\Miniconda3\envs\vnpy3.3.0\lib\site-packages\zmq\sugar\socket.py", line 821, in send_json
return self.send(msg, flags=flags,
send_kwargs)
File "C:\Miniconda3\envs\vnpy3.3.0\lib\site-packages\zmq\sugar\socket.py", line 547, in send
return super(Socket, self).send(data, flags=flags, copy=copy, track=track)
File "zmq\backend\cython\socket.pyx", line 718, in zmq.backend.cython.socket.Socket.send
File "zmq\backend\cython\socket.pyx", line 765, in zmq.backend.cython.socket.Socket.send
File "zmq\backend\cython\socket.pyx", line 247, in zmq.backend.cython.socket._send_copy
File "zmq\backend\cython\socket.pyx", line 242, in zmq.backend.cython.socket._send_copy
File "zmq\backend\cython\checkrc.pxd", line 28, in zmq.backend.cython.checkrc._check_rc
zmq.error.ZMQError: Operation cannot be accomplished in current state

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

pyzmq23.0.0以及22.3.0都试过了。

Member
avatar
加入于:
帖子: 4774
声望: 289

你连接的接口是?

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

沪公网安备 31011502017034号

【用户协议】
【隐私政策】
【免责条款】