安装nnpy出现错误以及解决
今天在安装P4C的时候,参考了这篇博客
P4语言环境安装-前端编译器p4c、后端编译器p4c-bm2-ss、交换模型bmv2、Tutorial-张华Guido
在进行到这一步时,出现了错误
#安装python-pip
sudo apt install python-pip
#我是安装在/home/guido(user_name)/路径下
git clone https://github.com/nanomsg/nnpy
#进入nnpy文件夹
cd /home/guido/nnpy
#安装nnpy
pip install nnpy
属于SSL Retry错误,CERTIFICATE ERROR,参考了这篇博客-----完美解决 Could not find a version that satisfies the requirement 安装包名字 (from versions: )–戴国进
的做法,将最后一句改为
pip install nnpy -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
这样做之后,结果仍然出现错误
ERROR: Command errored out with exit status 1:
command: /usr/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-8xDyxr/nnpy/setup.py'"'"'; __file__='"'"'/tmp/pip-install-8xDyxr/nnpy/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-3btyVq
cwd: /tmp/pip-install-8xDyxr/nnpy/
Complete output (25 lines):
Download error on https://pypi.python.org/simple/cffi/: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:727) -- Some packages may not be found!
Couldn't find index page for 'cffi' (maybe misspelled?)
Download error on https://pypi.python.org/simple/: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:727) -- Some packages may not be found!
No local packages or working download links found for cffi>=1.0.0
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-8xDyxr/nnpy/setup.py", line 28, in <module>
install_requires=['cffi'],
File "/usr/lib/python2.7/dist-packages/setuptools/__init__.py", line 128, in setup
_install_setup_requires(attrs)
File "/usr/lib/python2.7/dist-packages/setuptools/__init__.py", line 123, in _install_setup_requires
dist.fetch_build_eggs(dist.setup_requires)
File "/usr/lib/python2.7/dist-packages/setuptools/dist.py", line 513, in fetch_build_eggs
replace_conflicting=True,
File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 774, in resolve
replace_conflicting=replace_conflicting
File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 1057, in best_match
return self.obtain(req, installer)
File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 1069, in obtain
return installer(requirement)
File "/usr/lib/python2.7/dist-packages/setuptools/dist.py", line 580, in fetch_build_egg
return cmd.easy_install(req)
File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 692, in easy_install
raise DistutilsError(msg)
distutils.errors.DistutilsError: Could not find suitable distribution for Requirement.parse('cffi>=1.0.0')
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
然后暂时放在一边不管了。。。。。
之后在安装p4c的这一步make check时,
一些例子make check不过
The following tests FAILED:
63 - ebpf-bcc/testdata/p4_16_samples/action_call_ebpf.p4 (Failed)
64 - ebpf-bcc/testdata/p4_16_samples/action_call_table_ebpf.p4 (Failed)
65 - ebpf-bcc/testdata/p4_16_samples/bool_ebpf.p4 (Failed)
66 - ebpf-bcc/testdata/p4_16_samples/count_add_ebpf.p4 (Failed)
67 - ebpf-bcc/testdata/p4_16_samples/count_ebpf.p4 (Failed)
68 - ebpf-bcc/testdata/p4_16_samples/hit_ebpf.p4 (Failed)
69 - ebpf-bcc/testdata/p4_16_samples/init_ebpf.p4 (Failed)
70 - ebpf-bcc/testdata/p4_16_samples/issue2791_ebpf.p4 (Failed)
71 - ebpf-bcc/testdata/p4_16_samples/issue2793_ebpf.p4 (Failed)
72 - ebpf-bcc/testdata/p4_16_samples/issue2797_ebpf.p4 (Failed)
73 - ebpf-bcc/testdata/p4_16_samples/issue870_ebpf.p4 (Failed)
74 - ebpf-bcc/testdata/p4_16_samples/key-issue-1020_ebpf.p4 (Failed)
75 - ebpf-bcc/testdata/p4_16_samples/key_ebpf.p4 (Failed)
76 - ebpf-bcc/testdata/p4_16_samples/lpm_ebpf.p4 (Failed)
77 - ebpf-bcc/testdata/p4_16_samples/stack_ebpf.p4 (Failed)
78 - ebpf-bcc/testdata/p4_16_samples/switch_ebpf.p4 (Failed)
79 - ebpf-bcc/testdata/p4_16_samples/test_ebpf.p4 (Failed)
80 - ebpf-bcc/testdata/p4_16_samples/two_ebpf.p4 (Failed)
81 - ebpf-bcc/testdata/p4_16_samples/valid_ebpf.p4 (Failed)
82 - ebpf/testdata/p4_16_samples/action_call_ebpf.p4 (Failed)
83 - ebpf/testdata/p4_16_samples/action_call_table_ebpf.p4 (Failed)
84 - ebpf/testdata/p4_16_samples/bool_ebpf.p4 (Failed)
85 - ebpf/testdata/p4_16_samples/count_add_ebpf.p4 (Failed)
86 - ebpf/testdata/p4_16_samples/count_ebpf.p4 (Failed)
87 - ebpf/testdata/p4_16_samples/hit_ebpf.p4 (Failed)
88 - ebpf/testdata/p4_16_samples/init_ebpf.p4 (Failed)
89 - ebpf/testdata/p4_16_samples/issue2791_ebpf.p4 (Failed)
90 - ebpf/testdata/p4_16_samples/issue2793_ebpf.p4 (Failed)
91 - ebpf/testdata/p4_16_samples/issue2797_ebpf.p4 (Failed)
92 - ebpf/testdata/p4_16_samples/issue870_ebpf.p4 (Failed)
93 - ebpf/testdata/p4_16_samples/key-issue-1020_ebpf.p4 (Failed)
94 - ebpf/testdata/p4_16_samples/key_ebpf.p4 (Failed)
96 - ebpf/testdata/p4_16_samples/stack_ebpf.p4 (Failed)
97 - ebpf/testdata/p4_16_samples/switch_ebpf.p4 (Failed)
98 - ebpf/testdata/p4_16_samples/test_ebpf.p4 (Failed)
99 - ebpf/testdata/p4_16_samples/two_ebpf.p4 (Failed)
100 - ebpf/testdata/p4_16_samples/valid_ebpf.p4 (Failed)
101 - ebpf/testdata/p4_16_samples/ebpf_checksum_extern.p4 (Failed)
103 - ubpf/testdata/p4_16_samples/action_call_ubpf.p4 (Failed)
104 - ubpf/testdata/p4_16_samples/action_fwd_ubpf.p4 (Failed)
105 - ubpf/testdata/p4_16_samples/advance_ubpf.p4 (Failed)
106 - ubpf/testdata/p4_16_samples/csum_ubpf.p4 (Failed)
107 - ubpf/testdata/p4_16_samples/default_action_ubpf.p4 (Failed)
108 - ubpf/testdata/p4_16_samples/hash_ubpf.p4 (Failed)
109 - ubpf/testdata/p4_16_samples/ipv4-actions_ubpf.p4 (Failed)
110 - ubpf/testdata/p4_16_samples/ipv6-actions_ubpf.p4 (Failed)
111 - ubpf/testdata/p4_16_samples/lookahead_ubpf.p4 (Failed)
112 - ubpf/testdata/p4_16_samples/lpm_ubpf.p4 (Failed)
113 - ubpf/testdata/p4_16_samples/metadata_ubpf.p4 (Failed)
114 - ubpf/testdata/p4_16_samples/parenthesis-test_ubpf.p4 (Failed)
115 - ubpf/testdata/p4_16_samples/simple-actions_ubpf.p4 (Failed)
116 - ubpf/testdata/p4_16_samples/simple-firewall_ubpf.p4 (Failed)
117 - ubpf/testdata/p4_16_samples/truncate_ubpf.p4 (Failed)
118 - ubpf/testdata/p4_16_samples/tunneling_ubpf.p4 (Failed)
119 - ubpf/testdata/p4_16_samples/ubpf_hash_extern.p4 (Failed)
120 - ubpf/testdata/p4_16_samples/ubpf_checksum_extern.p4 (Failed)
关于这个错误,参考了这篇文章中的说法:Ubuntu16.04中配置p4编程环境(二)–Chin
是由于依赖问题导致的make check错误
想了一下,将需要sudo apt install 的包都安了一遍,仍然没有变化,最后想到了之前pip install nnpy未通过的问题,所以接下来要解决这个nnpy的问题:
从帮助信息可以知道nnpy依赖的包是cffi,所以是不是cffi的错误呢?
我参考了这篇文章cffi python包版本不匹配时出错
升级了cffi包
pip install --upgrade cffi==1.14.6 -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
然后再执行nnpy的安装
pip install nnpy -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
这样之后,nnpy就安装好了
然后回到p4c的make check问题,重新执行,结果如下,问题解决了,果然是依赖的问题且问题应该出在nnpy的安装上