pip install fa2
最近在学习scanpy,读scanpy文档的toturial部分的 Trajectory inference for hematopoiesis in mouse 部分的时候,出现了一个错误,在我的 jupyter notebook 运行的时候,出现了一个 warning
WARNING: Package 'fa2' is not installed, falling back to layout 'fr'.To use the faster and better ForceAtlas2 layout, install package 'fa2' (`pip install fa2`).
这个warning会导致我之后绘制的图片与文档中的原图有区别,在执行命令sc.pl.draw_graph(adata, color='paul15_clusters', legend_loc='on data')
的时候,可以看到,左边是源文档的图片,右边是我画出来的图片
[{"url":"https://raw.githubusercontent.com/zEpoch/imageHome/main/blog/pip_install_fa2/20230220134938.png","alt":"源文档图片"},{"url":"https://raw.githubusercontent.com/zEpoch/imageHome/main/blog/pip_install_fa2/20230220134917.png","alt":"我的图片"}]
那么便是需要修复这个问题,于是去安装
fa2,pip install fa2
,但是出现报错,大概是编译的时候出现了一些问题
note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure
于是去问了原作者,得到了新的解决方案,在python3.10版本下的安装方式如下:
git clone https://github.com/bhargavchippada/forceatlas2
cd forceatlas2
# having build dependencies installed
pip install . --user
在python3.10的环境下进行编译安装,即可完成,那么完成了安装之后,我们再次重启内核,再次运行分析,可以看到我们的图片和原始文档的图片基本一致
[{"url":"https://raw.githubusercontent.com/zEpoch/imageHome/main/blog/pip_install_fa2/20230220134938.png","alt":"源文档图片"},{"url":"https://raw.githubusercontent.com/zEpoch/imageHome/main/blog/pip_install_fa2/20230220135725.png","alt":"20230220135725"}]
调整一下字体等设置,再进行绘制,就完全一样了
[{"url":"https://raw.githubusercontent.com/zEpoch/imageHome/main/blog/pip_install_fa2/20230220134938.png","alt":"源文档图片"},{"url":"https://raw.githubusercontent.com/zEpoch/imageHome/main/blog/pip_install_fa2/20230220135912.png","alt":"20230220135912"}]
All articles in this blog are licensed under CC BY-NC-SA 4.0 unless stating additionally.
Comment