secretflow: Incompatibility Between TensorFlow and Jupyter Notebook

Issue Type

Bug

Source

binary

Secretflow Version

1.6.1b0

OS Platform and Distribution

Linux Ubuntu 20.04

Python version

3.10.14

Bazel version

No response

GCC/Compiler version

No response

What happend and What you expected to happen.

当我使用新版的secretflow时,安装了jupyter notebook来运行,似乎遇到了一些问题。

cannot import name 'TypeAliasType' from 'typing_extensions' (/usr/local/lib/python3.10/site-packages/typing_extensions.py)
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.
tensorflow 2.12.1 requires typing-extensions<4.6.0,>=3.6.6, but you have typing-extensions 4.12.0 which is incompatible.

麻烦官方童鞋看一下兼容性,不胜感激🥹

Reproduction code to reproduce the issue.

single line import secretflow in Jupyter notebook ipynb

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 17 (6 by maintainers)

Most upvoted comments

@kylin5207

重新尝试了一下,可以复现这个问题;具体而言,当 pip install 仅指定 secretflow 和 notebook 时,pip 将会解析到以下依赖

  • tensorflow==2.12.1
  • typing-extensions==4.5.0

此时安装会成功,但由于 typing-extensions 版本过旧,在 Notebook 上首次运行任何代码时,ipykernel 会失败

潜在的解决方式是同时指定 secretflow 和 typing-extensions 的版本到最新版:

pip install "secretflow==1.6.1b0" "typing-extensions==4.12.0" "notebook"

会解析到 tensorflow==2.12.0,仍然在兼容范围内;结果如下:

IMG_0890

可以使用这个命令在全新的 Python 3.10 虚拟环境中尝试

secretflow 完整版的依赖相对复杂,没有办法完全确保所有用法的兼容性(特别是当上游依赖本身没有保证兼容性时);另一个建议是,如果有可能的话,直接使用已经打包好的镜像,或者基于这个镜像制作其他镜像,见文档:https://www.secretflow.org.cn/zh-CN/docs/secretflow/v1.6.1b0/getting_started/installation#option-2-from-docker

如果有额外的问题,请开启新的 issue

@kylin5207

pip install "secretflow==1.6.1b0" "notebook==7.2.0"

requirements-linux-arm64.txt