vn.py量化社区
By Traders, For Traders.
Member
加入于:
帖子: 25
声望: 0

想请问两个问题:

  1. 看穿式监管提示 “接口不存在:CTP” 是我的地址输入错了还是券商那边把测试用的接口关了?
  2. 这个ImportError研究了半天都没解决,在单独的python脚本里面import numpy是没有问题的。

vnpy1.9.2最新版,Anaconda2 2019年3月版,runCtaTrading时报如下错误:


Failed to import strategy file vnpy.trader.app.ctaStrategy.strategy.strategyAtrRsi:
Traceback (most recent call last):
File "C:\vnpy-1.9.2-LTS\vnpy\trader\app\ctaStrategy\strategy__init.py", line 20, in loadStrategyModule
module = importlib.import_module(moduleName)
File "D:\Anaconda\lib\importlib\
init.py", line 37, in import_module import(name)
File "C:\vnpy-1.9.2-LTS\vnpy\trader\app\ctaStrategy\strategy\strategyAtrRsi.py", line 14, in <module>
from vnpy.trader.app.ctaStrategy.ctaTemplate import (CtaTemplate,
File "C:\vnpy-1.9.2-LTS\vnpy\trader\app\ctaStrategy\ctaTemplate.py", line 8, in <module>
from vnpy.trader.vtUtility import BarGenerator, ArrayManager
File "C:\vnpy-1.9.2-LTS\vnpy\trader\vtUtility.py", line 4, in <module>
import numpy as np
File "D:\Anaconda\lib\site-packages\numpy\
init.py", line 142, in <module>
from . import core
File "D:\Anaconda\lib\site-packages\numpy\core\
init__.py", line 71, in <module>
raise ImportError(msg)
ImportError:

IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!

Importing the multiarray numpy extension module failed. Most
likely you are trying to import a failed build of numpy.
Here is how to proceed:

  • If you're working with a numpy git repository, try git clean -xdf
    (removes all files not under version control) and rebuild numpy.
  • If you are simply trying to use the numpy version that you have installed:
    your installation is broken - please reinstall numpy.
  • If you have already reinstalled and that did not fix the problem, then:

    1. Check that you are using the Python you expect (you're using D:\Anaconda\python.exe),
      and that you have no directories in your PATH or PYTHONPATH that can
      interfere with the Python and numpy versions you're trying to use.
    2. If (1) looks fine, you can open a new issue at
      https://github.com/numpy/numpy/issues. Please include details on:

      • how you installed Python
      • how you installed numpy
      • your operating system
      • whether or not you have multiple versions of Python installed
      • if you built from source, your compiler versions and ideally a build log

      Note: this error has many possible causes, so please don't comment on
      an existing issue about this - open a new one instead.

Original error was: DLL load failed: ????????????顣


Failed to import strategy file vnpy.trader.app.ctaStrategy.strategy.strategyBollChannel:
Traceback (most recent call last):
File "C:\vnpy-1.9.2-LTS\vnpy\trader\app\ctaStrategy\strategy__init.py", line 20, in loadStrategyModule
module = importlib.import_module(moduleName)
File "D:\Anaconda\lib\importlib\
init.py", line 37, in import_module import(name)
File "C:\vnpy-1.9.2-LTS\vnpy\trader\app\ctaStrategy\strategy\strategyBollChannel.py", line 23, in <module>
from vnpy.trader.app.ctaStrategy.ctaTemplate import (CtaTemplate,
File "C:\vnpy-1.9.2-LTS\vnpy\trader\app\ctaStrategy\ctaTemplate.py", line 8, in <module>
from vnpy.trader.vtUtility import BarGenerator, ArrayManager
File "C:\vnpy-1.9.2-LTS\vnpy\trader\vtUtility.py", line 4, in <module>
import numpy as np
File "D:\Anaconda\lib\site-packages\numpy\
init__.py", line 140, in <module>
from . import _distributor_init

ImportError: cannot import name _distributor_init

Failed to import strategy file vnpy.trader.app.ctaStrategy.strategy.strategyDoubleMa:
Traceback (most recent call last):
File "C:\vnpy-1.9.2-LTS\vnpy\trader\app\ctaStrategy\strategy__init.py", line 20, in loadStrategyModule
module = importlib.import_module(moduleName)
File "D:\Anaconda\lib\importlib\
init.py", line 37, in import_module import(name)
File "C:\vnpy-1.9.2-LTS\vnpy\trader\app\ctaStrategy\strategy\strategyDoubleMa.py", line 10, in <module>
from vnpy.trader.app.ctaStrategy.ctaTemplate import (CtaTemplate,
File "C:\vnpy-1.9.2-LTS\vnpy\trader\app\ctaStrategy\ctaTemplate.py", line 8, in <module>
from vnpy.trader.vtUtility import BarGenerator, ArrayManager
File "C:\vnpy-1.9.2-LTS\vnpy\trader\vtUtility.py", line 4, in <module>
import numpy as np
File "D:\Anaconda\lib\site-packages\numpy\
init__.py", line 140, in <module>
from . import _distributor_init

ImportError: cannot import name _distributor_init

Failed to import strategy file vnpy.trader.app.ctaStrategy.strategy.strategyDualThrust:
Traceback (most recent call last):
File "C:\vnpy-1.9.2-LTS\vnpy\trader\app\ctaStrategy\strategy__init.py", line 20, in loadStrategyModule
module = importlib.import_module(moduleName)
File "D:\Anaconda\lib\importlib\
init.py", line 37, in import_module import(name)
File "C:\vnpy-1.9.2-LTS\vnpy\trader\app\ctaStrategy\strategy\strategyDualThrust.py", line 11, in <module>
from vnpy.trader.app.ctaStrategy.ctaTemplate import CtaTemplate, BarGenerator
File "C:\vnpy-1.9.2-LTS\vnpy\trader\app\ctaStrategy\ctaTemplate.py", line 8, in <module>
from vnpy.trader.vtUtility import BarGenerator, ArrayManager
File "C:\vnpy-1.9.2-LTS\vnpy\trader\vtUtility.py", line 4, in <module>
import numpy as np
File "D:\Anaconda\lib\site-packages\numpy\
init__.py", line 140, in <module>
from . import _distributor_init

ImportError: cannot import name _distributor_init

Failed to import strategy file vnpy.trader.app.ctaStrategy.strategy.strategyKingKeltner:
Traceback (most recent call last):
File "C:\vnpy-1.9.2-LTS\vnpy\trader\app\ctaStrategy\strategy__init.py", line 20, in loadStrategyModule
module = importlib.import_module(moduleName)
File "D:\Anaconda\lib\importlib\
init.py", line 37, in import_module import(name)
File "C:\vnpy-1.9.2-LTS\vnpy\trader\app\ctaStrategy\strategy\strategyKingKeltner.py", line 14, in <module>
from vnpy.trader.app.ctaStrategy.ctaTemplate import (CtaTemplate,
File "C:\vnpy-1.9.2-LTS\vnpy\trader\app\ctaStrategy\ctaTemplate.py", line 8, in <module>
from vnpy.trader.vtUtility import BarGenerator, ArrayManager
File "C:\vnpy-1.9.2-LTS\vnpy\trader\vtUtility.py", line 4, in <module>
import numpy as np
File "D:\Anaconda\lib\site-packages\numpy\
init__.py", line 140, in <module>
from . import _distributor_init

ImportError: cannot import name _distributor_init

Failed to import strategy file vnpy.trader.app.ctaStrategy.strategy.strategyMultiSignal:
Traceback (most recent call last):
File "C:\vnpy-1.9.2-LTS\vnpy\trader\app\ctaStrategy\strategy__init.py", line 20, in loadStrategyModule
module = importlib.import_module(moduleName)
File "D:\Anaconda\lib\importlib\
init.py", line 37, in import_module import(name)
File "C:\vnpy-1.9.2-LTS\vnpy\trader\app\ctaStrategy\strategy\strategyMultiSignal.py", line 12, in <module>
from vnpy.trader.app.ctaStrategy.ctaTemplate import (TargetPosTemplate,
File "C:\vnpy-1.9.2-LTS\vnpy\trader\app\ctaStrategy\ctaTemplate.py", line 8, in <module>
from vnpy.trader.vtUtility import BarGenerator, ArrayManager
File "C:\vnpy-1.9.2-LTS\vnpy\trader\vtUtility.py", line 4, in <module>
import numpy as np
File "D:\Anaconda\lib\site-packages\numpy\
init__.py", line 140, in <module>
from . import _distributor_init

ImportError: cannot import name _distributor_init

Failed to import strategy file vnpy.trader.app.ctaStrategy.strategy.strategyMultiTimeframe:
Traceback (most recent call last):
File "C:\vnpy-1.9.2-LTS\vnpy\trader\app\ctaStrategy\strategy__init.py", line 20, in loadStrategyModule
module = importlib.import_module(moduleName)
File "D:\Anaconda\lib\importlib\
init.py", line 37, in import_module import(name)
File "C:\vnpy-1.9.2-LTS\vnpy\trader\app\ctaStrategy\strategy\strategyMultiTimeframe.py", line 9, in <module>
from vnpy.trader.app.ctaStrategy.ctaTemplate import (CtaTemplate,
File "C:\vnpy-1.9.2-LTS\vnpy\trader\app\ctaStrategy\ctaTemplate.py", line 8, in <module>
from vnpy.trader.vtUtility import BarGenerator, ArrayManager
File "C:\vnpy-1.9.2-LTS\vnpy\trader\vtUtility.py", line 4, in <module>
import numpy as np
File "D:\Anaconda\lib\site-packages\numpy\
init__.py", line 140, in <module>
from . import _distributor_init

ImportError: cannot import name _distributor_init

Failed to import strategy file vnpy.trader.app.ctaStrategy.strategy.strategyTurtleTrading:
Traceback (most recent call last):
File "C:\vnpy-1.9.2-LTS\vnpy\trader\app\ctaStrategy\strategy__init.py", line 20, in loadStrategyModule
module = importlib.import_module(moduleName)
File "D:\Anaconda\lib\importlib\
init.py", line 37, in import_module import(name)
File "C:\vnpy-1.9.2-LTS\vnpy\trader\app\ctaStrategy\strategy\strategyTurtleTrading.py", line 11, in <module>
from vnpy.trader.app.ctaStrategy.ctaTemplate import (CtaTemplate,
File "C:\vnpy-1.9.2-LTS\vnpy\trader\app\ctaStrategy\ctaTemplate.py", line 8, in <module>
from vnpy.trader.vtUtility import BarGenerator, ArrayManager
File "C:\vnpy-1.9.2-LTS\vnpy\trader\vtUtility.py", line 4, in <module>
import numpy as np
File "D:\Anaconda\lib\site-packages\numpy\
init__.py", line 140, in <module>
from . import _distributor_init

ImportError: cannot import name _distributor_init

2019-05-24 18:40:05,967 INFO: 启动CTA策略运行子进程
2019-05-24 18:40:05,967 INFO: 事件引擎创建成功
2019-05-24 18:40:05,977 INFO: 主引擎创建成功
2019-05-24 18:40:05,977 INFO: 注册日志事件监听
2019-05-24 18:40:05,989 INFO: 连接CTP接口
2019-05-24 18:40:06,003 INFO: MAIN_ENGINE MongoDB连接成功
2019-05-24 18:40:06,003 INFO: MAIN_ENGINE 接口不存在:CTP
2019-05-24 18:40:15,996 INFO: CTA策略载入成功
2019-05-24 18:40:15,997 INFO: CTA策略初始化成功
2019-05-24 18:40:15,999 INFO: CTA策略启动成功
2019-05-24 18:40:16,005 INFO: CTA_STRATEGY 找不到策略类:DoubleMaStrategy

Administrator
avatar
加入于:
帖子: 1441
声望: 63
  1. 你的numpy代码似乎被升级影响到,现在应该坏了,最简单就是重装Anaconda
  2. CTP接口不存在,请检查你是否加载了ctpGateway,穿透式测试请在图形环境的VNTrader中做
© 2015-2019 上海韦纳软件科技有限公司
备案服务号:沪ICP备18006526号-3