今天在服务器 ubuntu18.04 上安装最新2.1.5版本的vnpy,遇到报错,结尾如下:
gcc -pthread -shared -B /home/asuka/anaconda3/compiler_compat -L/home/asuka/anaconda3/lib -Wl,-rpath=/home/asuka/anaconda3/lib -Wl,--no-as-needed -Wl,--sysroot=/ build/temp.linux-x86_64-3.7/vnpy/api/ctp/vnctp/vnctptd/vnctptd.o -Lvnpy/api/ctp/libs -Lvnpy/api/ctp -R$ORIGIN -lthostmduserapi_se -lthosttraderapi_se -o build/lib.linux-x86_64-3.7/vnpy/api/ctp/vnctptd.cpython-37m-x86_64-linux-gnu.so -lstdc++
gcc: error: unrecognized command line option ‘-R’
error: command '/usr/bin/gcc' failed with exit code 1
----------------------------------------
ERROR: Command errored out with exit status 1: /home/asuka/anaconda3/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-req-build-4dmzbv71/setup.py'"'"'; __file__='"'"'/tmp/pip-req-build-4dmzbv71/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-pk0m1mxd/install-record.txt --single-version-externally-managed --compile --install-headers /home/asuka/anaconda3/include/python3.7m/vnpy Check the logs for full command output.
搜了一圈,似乎是把上面代码中的 ‘-R$ORIGIN’ 改一下变为 ‘-Wl,-rpath=$ORIGIN’,就能安装下去了。
但自己不会弄,现放上论坛来求助~~
安装过程的一个小截图如下:
这一段的报错代码:
running build_ext
building 'vnpy.api.ctp.vnctptd' extension
creating build/temp.linux-x86_64-3.7
creating build/temp.linux-x86_64-3.7/vnpy
creating build/temp.linux-x86_64-3.7/vnpy/api
creating build/temp.linux-x86_64-3.7/vnpy/api/ctp
creating build/temp.linux-x86_64-3.7/vnpy/api/ctp/vnctp
creating build/temp.linux-x86_64-3.7/vnpy/api/ctp/vnctp/vnctptd
gcc -pthread -B /home/asuka/anaconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -Ivnpy/api/ctp/include -Ivnpy/api/ctp/vnctp -I/home/asuka/anaconda3/include/python3.7m -c vnpy/api/ctp/vnctp/vnctptd/vnctptd.cpp -o build/temp.linux-x86_64-3.7/vnpy/api/ctp/vnctp/vnctptd/vnctptd.o -std=c++17 -O3 -Wno-delete-incomplete -Wno-sign-compare
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
gcc -pthread -shared -B /home/asuka/anaconda3/compiler_compat -L/home/asuka/anaconda3/lib -Wl,-rpath=/home/asuka/anaconda3/lib -Wl,--no-as-needed -Wl,--sysroot=/ build/temp.linux-x86_64-3.7/vnpy/api/ctp/vnctp/vnctptd/vnctptd.o -Lvnpy/api/ctp/libs -Lvnpy/api/ctp -R$ORIGIN -lthostmduserapi_se -lthosttraderapi_se -o build/lib.linux-x86_64-3.7/vnpy/api/ctp/vnctptd.cpython-37m-x86_64-linux-gnu.so -lstdc++
gcc: error: unrecognized command line option ‘-R’
error: command '/usr/bin/gcc' failed with exit code 1
----------------------------------------
ERROR: Failed building wheel for vnpy
Running setup.py clean for vnpy
Failed to build vnpy
DEPRECATION: Could not build wheels for vnpy which do not use PEP 517. pip will fall back to legacy 'setup.py install' for these. pip 21.0 will remove support for this functionality. A possible replacement is to fix the wheel build issue reported above. You can find discussion regarding this at https://github.com/pypa/pip/issues/8368.
用2.0.7版本的CTA策略模块跑BitMex实盘出现了同样问题~~
Traceback (most recent call last):
File "/home/para/anaconda3/lib/python3.7/site-packages/vnpy/api/rest/rest_client.py", line 278, in _process_request
proxies=self.proxies,
File "/home/para/anaconda3/lib/python3.7/site-packages/requests/sessions.py", line 519, in request
prep = self.prepare_request(req)
File "/home/para/anaconda3/lib/python3.7/site-packages/requests/sessions.py", line 462, in prepare_request
hooks=merge_hooks(request.hooks, self.hooks),
File "/home/para/anaconda3/lib/python3.7/site-packages/requests/models.py", line 313, in prepare
self.prepare_url(url, params)
File "/home/para/anaconda3/lib/python3.7/site-packages/requests/models.py", line 387, in prepare_url
raise MissingSchema(error)
requests.exceptions.MissingSchema: Invalid URL '/api/v1/userDataStream?listenKey=': No schema supplied. Perhaps you meant http:///api/v1/userDataStream?listenKey=?
Segmentation fault (core dumped)
Ubuntu系统中遇到同样问题。在我的情况中,自定义策略放置文件夹的位置是:
~/anaconda3/lib/python3.7/site-packages/vnpy/app/cta_strategy/strategies
把自定义的.py策略文件放在这里,界面中就可以看到了。分享~