安装TensorBoard踩坑
-
Mac下手把手安装TensorBoard
(结果和Mac没有啥关系)
ATTENTION
如果你已经安装了最新版的tensorflow,不需要看这篇博客了,直接就可以用tensorboard了
环境信息
- Mac版本号:macOS High Sierra 10.13.4
- python版本号:Anaconda custom Python 3.6.4
- 已经装好了tensorflow-tensorboard
开始安装
- 先尝试直接pip
pip install tensorboardX
显然会报错,不然就没有这篇文章了
报错信息:
tensorflow-tensorboard 1.5.1 has requirement html5lib==0.9999999, but you'll have html5lib 1.0.1 which is incompatible. bleach 1.5.0 has requirement html5lib!=0.9999,!=0.99999,<0.99999999,>=0.999, but you'll have html5lib 1.0.1 which is incompatible.
也就是说html5lib版本高了
尝试直接安装bleach:
pip install bleach
报错信息:
weasyprint 0.42.2 has requirement html5lib>=0.999999999, but you'll have html5lib 0.9999999 which is incompatible.
发现满足了bleach的要求:html5lib>=3个9, <=8个9, !=4或5个9后,又会导致其依赖的weasyprint无法安装,因为weasyprint要求html5lib>=9个9
于是安装html5lib==9个9后再次尝试安装weasyprint
pip install html5lib==0.999999999 pip install weasyprint
又报错了
tensorflow-tensorboard 1.5.1 has requirement html5lib==0.9999999, but you'll have html5lib 0.999999999 which is incompatible. tensorboard 1.8.0 has requirement html5lib==0.9999999, but you'll have html5lib 1.0.1 which is incompatible. bleach 1.5.0 has requirement html5lib!=0.9999,!=0.99999,<0.99999999,>=0.999, but you'll have html5lib 1.0.1 which is incompatible.
发现tensorflow-tensorboard要求7个9,同时bleach也不支持9个9
所以这些冲突恶性循环了。。。
再试试直接install tensorflow,还是报错
当然想更新上述几个包的举动都不可行,因为TensorFlow的依赖全部用的是
==
进行版本控制意识到了这一点后发现了一个很严重的问题:是不是TensorFlow只能全部件装一个版本,如果你试图单独安装新版tensorflow部件就是装不上去的
所以干脆uninstall掉整个TensorFlow组件(它的依赖也都会被卸载):
pip uninstall tensorflow-tensorboard pip install tensorflow
- 突然就成功了~
突发奇想,如果先装好了老版TensorFlow,然后upgrade会怎么样?
- 结果和直接install tensorflow一模一样
于是发现要安装新版tensorflow,如果报错,最好的解决方案就是完全卸载tensorflow,然后重新install就完事了
成功方案
如果你曾经单独安装过tensorflow老版组件
- 卸载所有tensorflow相关组件
- 重新安装tensorflow
如果你试图更新tensorflow并发现报了依赖错误
- 卸载tensorflow
- 重新安装tensorflow
总结
- html5lib这个包的版本号到底是谁编的,这么吉利
- TensorFlow本身处于一种非常微妙的平衡之中,不要试图打破它
- 如果你已经安装过了TensorFlow的某个部件,过了几个月试图安装新部件,不用尝试单独安装其他部件了,直接把tensorflow相关部件全部uninstall掉,重装完整TensorFlow吧