项目地址
项目:
https://github.com/EdgeSimPy/EdgeSimPy
教程:
https://github.com/EdgeSimPy/edgesimpy-tutorials
遇到问题和解决办法
使用pip 安装EdgeSimPy的命令如下:
pip install -q git+https://github.com/EdgeSimPy/EdgeSimPy.git@v1.1.0
因为需要访问github,为了稳定连接,一般开启代理
但是会遇到以下情况:
部分镜像源对于代理不支持HTTPS协议,例如清华源
问题
- 使用http作为pip镜像源时的报错信息:
Looking in indexes: http://pypi.tuna.tsinghua.edu.cn/simple
WARNING: The repository located at pypi.tuna.tsinghua.edu.cn is not a trusted or secure host and is being ignored. If this repository is available via HTTPS we recommend you use HTTPS instead, otherwise you may silence this warning and allow it anyway with '--trusted-host pypi.tuna.tsinghua.edu.cn'.
ERROR: Could not find a version that satisfies the requirement poetry-core (from versions: none)
ERROR: No matching distribution found for poetry-core
- pip使用extra-index-url(多源)时的报错信息:
(参考https://blog.csdn.net/weixin_45254198/article/details/110727039的操作)
error: subprocess-exited-with-error
× pip subprocess to install build dependencies did not run successfully.
│ exit code: 1
╰─> [14 lines of output] Looking in indexes: https://pypi.org/simple, http://pypi.mirrors.ustc.edu.cn/simple, https://pypi.org/simple, http://pypi.mirrors.ustc.edu.cn/simple, https://pypi.org/simple
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', FileNotFoundError(2, 'No such file or directory'))': /simple/poetry-core/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', FileNotFoundError(2, 'No such file or directory'))': /simple/poetry-core/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', FileNotFoundError(2, 'No such file or directory'))': /simple/poetry-core/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', FileNotFoundError(2, 'No such file or directory'))': /simple/poetry-core/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', FileNotFoundError(2, 'No such file or directory'))': /simple/poetry-core/
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:997)'))': /pypi/web/simple/poetry-core/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:997)'))': /pypi/web/simple/poetry-core/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:997)'))': /pypi/web/simple/poetry-core/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:997)'))': /pypi/web/simple/poetry-core/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:997)'))': /pypi/web/simple/poetry-core/ Could not fetch URL http://pypi.mirrors.ustc.edu.cn/simple/poetry-core/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='mirrors.ustc.edu.cn', port=443): Max retries exceeded with url: /pypi/web/simple/poetry-core/ (Caused by SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:997)'))) - skipping
ERROR: Could not find a version that satisfies the requirement poetry-core>=1.0.0 (from versions: none)
ERROR: No matching distribution found for poetry-core>=1.0.0 [end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error
× pip subprocess to install build dependencies did not run successfully.
│ exit code: 1
╰─> See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip.
该问题可能和extra-index-url优先级有关:
https://github.com/pypa/pip/issues/5045#issuecomment-369521345
https://www.likecs.com/ask-1664554.html
- 指定源:
pip install -q git+https://github.com/EdgeSimPy/EdgeSimPy.git@v1.1.0 -i https://pypi.org/simple
报错内容和前者相似
- 考虑到类似于https://github.com/XTLS/Xray-core/issues/2587的问题,尝试在pip命令中添加代理信息,但是不起效果。
pip install -q git+https://github.com/EdgeSimPy/EdgeSimPy.git@v1.1.0 -i https://pypi.org/simple --proxy http://127.0.0.1:10809
观察v某ray可以看到以下信息:
app/proxyman/inbound: connection ends > proxy/http: failed to read http request > ……
命令行中报错内容和前者相似
方法
- 使用豆瓣源:
使用以下的pip.ini信息
[global]
index-url = http://pypi.douban.com/simple
[install]
trusted-host = pypi.douban.com
对于pip.ini位置,参考https://blog.csdn.net/qq_38463737/article/details/107780440
- 另外还有一条思路,就是在发生以下错误的时候检查一下git代理:
(未尝试过)
error: subprocess-exited-with-error
× git clone --filter=blob:none --quiet
https://github.com/EdgeSimPy/EdgeSimPy.git 'C:\Users\LAPTOP_Lin-uCong\AppData\Local\Temp\pip-req-build-4iqjtqwo' did not run successfully.
│ exit code: 128
╰─> [1 lines of output]
fatal: unable to access 'https://github.com/EdgeSimPy/EdgeSimPy.git/': Failed to connect to 127.0.0.1 port 10809 after 2059 ms: Connection refused
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error
× git clone --filter=blob:none --quiet
https://github.com/EdgeSimPy/EdgeSimPy.git 'C:\Users\LAPTOP_Lin-uCong\AppData\Local\Temp\pip-req-build-4iqjtqwo' did not run successfully.
│ exit code: 128
╰─> See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip.
版本冲突
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.ipython 8.5.0 requires traitlets>=5, which is not installed.
tensorflow 2.10.0 requires absl-py>=1.0.0, which is not installed.
tensorflow 2.10.0 requires astunparse>=1.6.0, which is not installed.
tensorflow 2.10.0 requires flatbuffers>=2.0, which is not installed.
tensorflow 2.10.0 requires gast<=0.4.0,>=0.2.1, which is not installed.
tensorflow 2.10.0 requires google-pasta>=0.1.1, which is not installed.
tensorflow 2.10.0 requires grpcio<2.0,>=1.24.3, which is not installed.
tensorflow 2.10.0 requires h5py>=2.9.0, which is not installed.
tensorflow 2.10.0 requires keras<2.11,>=2.10.0, which is not installed.
tensorflow 2.10.0 requires keras-preprocessing>=1.1.1, which is not installed.
tensorflow 2.10.0 requires libclang>=13.0.0, which is not installed.
tensorflow 2.10.0 requires opt-einsum>=2.3.2, which is not installed.
tensorflow 2.10.0 requires packaging, which is not installed.
tensorflow 2.10.0 requires protobuf<3.20,>=3.9.2, which is not installed.
tensorflow 2.10.0 requires tensorboard<2.11,>=2.10, which is not installed.
tensorflow 2.10.0 requires tensorflow-estimator<2.11,>=2.10.0, which is not installed.
tensorflow 2.10.0 requires tensorflow-io-gcs-filesystem>=0.23.1, which is not installed.
tensorflow 2.10.0 requires termcolor>=1.1.0, which is not installed.
tensorflow 2.10.0 requires typing-extensions>=3.6.6, which is not installed.
tensorflow 2.10.0 requires wrapt>=1.11.0, which is not installed.
参考https://blog.csdn.net/weixin_43582443/article/details/111478698可以直接安装tensorflow
pip install tensorflow==2.10.0
报错:
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
ipykernel 6.16.0 requires jupyter-client>=6.1.12, which is not installed.
ipykernel 6.16.0 requires traitlets>=5.1.0, which is not installed.
Successfully installed absl-py-2.1.0 astunparse-1.6.3 cachetools-5.3.2 flatbuffers-23.5.26 gast-0.4.0 google-auth-2.26.2 google-auth-oauthlib-0.4.6 google-pasta-0.2.0 grpcio-1.60.0 h5py-3.10.0 keras-2.10.0 keras-preprocessing-1.1.2 libclang-16.0.6 markdown-3.5.2 oauthlib-3.2.2 opt-einsum-3.3.0 packaging-23.2 protobuf-3.19.6 pyasn1-0.5.1 pyasn1-modules-0.3.0 requests-oauthlib-1.3.1 rsa-4.9 tensorboard-2.10.1 tensorboard-data-server-0.6.1 tensorboard-plugin-wit-1.8.1 tensorflow-estimator-2.10.0 tensorflow-io-gcs-filesystem-0.31.0 termcolor-2.4.0 typing-extensions-4.9.0 werkzeug-3.0.1 wrapt-1.16.0
继续安装:
pip install ipykernel==6.16.0
阿里源下载文件编码问题
在安装jupyter notebook的时候
使用命令:
pip install notebook
报错内容:
Looking in indexes: http://mirrors.aliyun.com/pypi/simple/
ERROR: Could not install packages due to an OSError: ('Received response with content-encoding: gzip, but failed to decode it.', error('Error -3 while decompressing data: incorrect data check'))
参考前文提到的方法,改用豆瓣源(第一个问题的第一个解决方法)
networkx版本绘图问题
在按照教程、使用git安装EdgeSimPy的情况下,同时安装的networkx包要求版本为:2.6.2
实际上,对于教程
https://github.com/EdgeSimPy/edgesimpy-tutorials/blob/master/notebooks/including-custom-system-models.ipynb
使用2.6.2版本的networkx会导致draw函数无法使用
报错内容:
TypeError Traceback (most recent call last)
Cell In [13], [line 21](vscode-notebook-cell:?execution_count=13&line=21)
[18](vscode-notebook-cell:?execution_count=13&line=18) colors.append("black")
[20](vscode-notebook-cell:?execution_count=13&line=20) # Drawing the network topology
---> [21](vscode-notebook-cell:?execution_count=13&line=21) nx.draw(
[22](vscode-notebook-cell:?execution_count=13&line=22) Topology.first(),
[23](vscode-notebook-cell:?execution_count=13&line=23) pos=positions,
[24](vscode-notebook-cell:?execution_count=13&line=24) node_color=colors,
[25](vscode-notebook-cell:?execution_count=13&line=25) node_size=sizes,
[26](vscode-notebook-cell:?execution_count=13&line=26) labels=labels,
[27](vscode-notebook-cell:?execution_count=13&line=27) font_size=7,
[28](vscode-notebook-cell:?execution_count=13&line=28) font_weight="bold",
[29](vscode-notebook-cell:?execution_count=13&line=29) font_color="whitesmoke",
[30](vscode-notebook-cell:?execution_count=13&line=30) )
File [d:\CondaEnvironment\envs\PlatformTest\lib\site-packages\networkx\drawing\nx_pylab.py:113](file:///D:/CondaEnvironment/envs/PlatformTest/lib/site-packages/networkx/drawing/nx_pylab.py:113), in draw(G, pos, ax, **kwds)
[111](file:///D:/CondaEnvironment/envs/PlatformTest/lib/site-packages/networkx/drawing/nx_pylab.py:111) cf.set_facecolor("w")
[112](file:///D:/CondaEnvironment/envs/PlatformTest/lib/site-packages/networkx/drawing/nx_pylab.py:112) if ax is None:
--> [113](file:///D:/CondaEnvironment/envs/PlatformTest/lib/site-packages/networkx/drawing/nx_pylab.py:113) if cf._axstack() is None:
[114](file:///D:/CondaEnvironment/envs/PlatformTest/lib/site-packages/networkx/drawing/nx_pylab.py:114) ax = cf.add_axes((0, 0, 1, 1))
[115](file:///D:/CondaEnvironment/envs/PlatformTest/lib/site-packages/networkx/drawing/nx_pylab.py:115) else:
TypeError: '_AxesStack' object is not callable
按照stackoverflow的建议,其建议使用draw_networkx函数进行代替
https://stackoverflow.com/questions/74189581/axesstack-object-is-not-callable-while-using-networkx-to-plot
但是生成的图像不合适:
注意到stackoverflow同时提到了networkx的版本问题,可以考虑升级networkx版本至3.2.0(不遵守EdgeSimPy的版本要求)
可以使用命令:
pip install --upgrade networkx==3.2.0
(注意stackoverflow中--update
的写法是不正确的)
在升级之后,可能会报以下错误:(这是升级到3.2.1时候的报错代码,如果pip升级不加版本号在文章发布时会将networkx升级到3.2.1,可以使用类似的代码降级到3.2.0)
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
edge-sim-py 1.1.0 requires networkx==2.6.2, but you have networkx 3.2.1 which is incompatible.
Successfully installed networkx-3.2.1
此时可以忽略错误,可以直接运行本教程代码
可以得到比较合适的图像:
已经在github上提出issue:
https://github.com/EdgeSimPy/edgesimpy-tutorials/issues/3
参考networkx文档:
https://networkx.org/documentation/stable/reference/generated/networkx.drawing.nx_pylab.draw.html
Networkx Github仓库:
https://github.com/networkx/networkx