TensorFlow 2.15 cannot be imported after Poetry install on Windows
cc: @mraunak  Hi @RRiva, the issue has been addressed in https://github.com/tensorflow/tensorflow/issues/58674#issuecomment-1593891706
I just successfully imported TF 2.15 on the Windows using the Poetry tool.
Before running the command poetry add tensorflow==2.15.0
please run the command poetry add tensorflow-io-gcs-filesystem==0.31.0
TF 2.15 supports Python 3.9-3.11, please add it in the pyproject.toml
![image](https://github.com/tensorflow/tensorflow/assets/83710963/a2f9e167-1817-401e-98b8-0dff6827a898)

![image](https://github.com/tensorflow/tensorflow/assets/83710963/ffaee371-bdb3-4bfc-8340-be81daa2dea9)

 Hi @mraunak, thanks for trying, but it doesn't work yet. To demonstrate it, I made a new clean repo, with the pyproject.toml that you have written. It's available at

https://gitlab.windenergy.dtu.dk/surrogate-models/test-poetry-and-tensorflow

As you can see, the last pipeline still fails with `ModuleNotFoundError: No module named 'tensorflow'`.

https://gitlab.windenergy.dtu.dk/surrogate-models/test-poetry-and-tensorflow/-/jobs/238494 Hi @RRiva, please run the command below to fix your issue. 
poetry add tensorflow-intel 
![image](https://github.com/tensorflow/tensorflow/assets/83710963/66f33259-e951-4ea3-89b3-7305f19d3c7b)
 Hi @RRiva, we are working to fix the issues of separate poetry installation of dependent packages Hi @mraunak, thanks a lot! It is now possible to import TensorFlow on both Windows and Linux 🙂 The only difference is that I had to specify that `tensorflow-intel` is only available for Windows, since Poetry cannot infer it from the metadata. The pyproject.toml now looks like
```
python = ">=3.9,<3.12"
tensorflow-io-gcs-filesystem = "0.31.0"
tensorflow = "2.15.0"
tensorflow-intel = {version="^2.15.0", platform = "win32"}
```
It should be noted though that `tensorflow-io-gcs-filesystem` 0.31.0  is not compatible with `tensorflow` 2.15.
 Thank you @RRiva, yes Intel releases tensorflow-intel for the Windows platform. In pip installation, TensorFlow-intel is automatically installed while installing TensorFlow on the Windows platform. We are working to fix it for Poetry Installation as well which should be available in the TF 2.16 release > Thank you @RRiva, yes Intel releases tensorflow-intel for the Windows platform. In pip installation, TensorFlow-intel is automatically installed while installing TensorFlow on the Windows platform. We are working to fix it for Poetry Installation as well which should be available in the TF 2.16 release

Will this also fix all the other metadata issues? Can't install tensorflow-io-gcs-filesystem on alpine linux (I know not ideal but it's a specific environment requirement) Sorry if this is unrelated, wondering if the metadata will fix all Hi @ZachHandley, thank you for letting us know about the issue with Alpine Linux. Request you to raise a separate Github issue to TensorFlow. We will work to fix it. Hi, I just checked if the installation improved with TF 2.16, but unfortunately nothing has changed for Windows:

- `tensorflow-intel` still needs to be specified as a requirement, since it's not found automatically.
- `tensorflow-io-gcs-filesystem` does not provide recent Windows wheels, and therefore does not support python 3.12.

I hope that the fix that you mentioned will be available with the next release 🙂  Hi @RRiva, yes the fix for automatic installation of tensorflow-intel using poetry, will be available with the next release. I will contact tensorflow/io team to check the latest release of tensorflow-io-gcs-filesystem on the Windows platform Hey @mraunak do you have any idea on the status of tensorflow-io-gcs-filesystem on windows? Can't seem to locate an answer in any of the issues, or at least find the correct one. Hi @Nicba1010 I have raised an issue https://github.com/tensorflow/io/issues/1966. I haven't heard anything yet. If you are getting any errors please let me know.
### 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_