Repository: tensorflow
Issue: TensorFlow 2.15 cannot be imported after Poetry install on Windows
Labels: stat:awaiting tensorflower,type:build/install,subtype:windows,TF 2.15

### Issue type

Bug

### Have you reproduced the bug with TensorFlow Nightly?

No

### Source

binary

### TensorFlow version

2.15.0

### Custom code

No

### OS platform and distribution

Windows

### Mobile device

_No response_

### Python version

3.11

### Bazel version

_No response_

### GCC/compiler version

_No response_

### CUDA/cuDNN version

_No response_

### GPU model and memory

_No response_

### Current behavior?

I expect to be able to install and import TensorFlow on the `python:3.11-windowsservercore` Docker container, using Poetry.

I made a new project with the following pyproject.toml, copied from [Poetry issue 8271](https://github.com/python-poetry/poetry/issues/8271#issuecomment-1712020965)

```
[tool.poetry]
name = "project-tf"
version = "0.1.0"
description = ""
authors = [""]
readme = "README.md"

[tool.poetry.dependencies]
python = "^3.10,<3.12"
# Issue between poetry and tensorflow metadata since >=2.11
# This is a temporary workaround
# related to https://github.com/python-poetry/poetry/issues/8271
# Inspired from https://github.com/tensorflow/tensorflow/blob/adb39b04e9cb116df4659a7e2de9eea27e62f25c/tensorflow/tools/pip_package/setup.py#L148-L162
tensorflow = {version = "^2.13.0" }
tensorflow-macos = { version = "^2.13.0", platform = "darwin", markers = "platform_machine=='arm64'" }
tensorflow-intel = { version = "^2.13.0", platform = "win32" }
tensorflow-cpu = [
    { version = "^2.13.0", platform = "linux", markers = "platform_machine!='arm64' and platform_machine!='aarch64'" },
    { version = "^2.13.0", platform = "darwin", markers = "platform_machine!='arm64' and platform_machine!='aarch64'" },]
tensorflow-cpu-aws = { version = "^2.13.0", platform = "linux", markers = "platform_machine=='arm64' or platform_machine=='aarch64'" }
# https://github.com/tensorflow/tensorflow/blob/adb39b04e9cb116df4659a7e2de9eea27e62f25c/tensorflow/tools/pip_package/setup.py#L107-L108
# https://github.com/python-poetry/poetry/issues/8271#issuecomment-1697740447
tensorflow-io-gcs-filesystem = [
    { version = ">= 0.23.1", markers = "platform_machine!='arm64' or platform_system!='Darwin'" },
    { version = "< 0.32.0", markers = "platform_system == 'Windows'" }
]

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
```

Then, I generate the lock file and on the Docker container `python:3.11-windowsservercore`, and install my package with
```
# Allow long file paths, or otherwise installing TensorFlow fails.
Set-ItemProperty -Path HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem -Name LongPathsEnabled -Value 1
# Install Microsoft Visual C++ Redistributable, or otherwise importing TensorFlow fails.
Invoke-WebRequest -Uri https://aka.ms/vs/17/release/vc_redist.x64.exe -OutFile .\VC_redist.x64.exe
.\VC_redist.x64.exe /install /quiet /norestart
# Install Poetry.
pip install poetry==1.7.1
# Install this package and run the tests.
poetry install
```

Finally, `pytest` fails as soon as it tries to import TensorFlow.

The reason for this behavior is described at [Poetry issue 8271](https://github.com/python-poetry/poetry/issues/8271#issuecomment-1928038659).


### Standalone code to reproduce the issue

```shell
See above.
```


### Relevant log output

_No response_