79551276

Date: 2025-04-02 18:10:52
Score: 0.5
Natty:
Report link

NOTE: I know the op question is not what im writing but since searching the error led me here, I just wanted to make sure people see this.

For Those who face this problem during import of fresh installed tensorflow:

A module that was compiled using NumPy 1.x cannot be run in NumPy 2.2.4 as it may crash. To support both 1.x and 2.x versions of NumPy, modules must be compiled with NumPy 2.0. Some module may need to rebuild instead e.g. with 'pybind11>=2.12'.

i can confirm that this is an easy working sample for having latest windows native tensorflow supporting gpu.

environment is as follow:

windows 11 pro 24H2 build 26100.3624
rtx3060 GPU with insatalled gpu driver (latest preferebelly)
Anaconda3-2024.10-1

so i try to be newbie friendly(as I'm one of those)

  1. After that open Anaconda Navigator head over to Environments section.
  2. From menu on the bottom of the screen click Create, choose a name for your environment, check the pyhton language and select Pyhton3.10.X-(in my case was 3.10.16 but should be ok if your X is different) and Press green button Create.

NOTE: According to Tensorflow windows-native installation guide and Tested GPU Build Configurations the latest python supported is 3.10 and

Tensorflow GPU will NOT SUPPORT PYTHON > 3.11 and 3.12 and later ON WINDOWS NATIVELY! (You can Install it using WSL2 following this guide.

  1. After Environment Creation, you see its activated and there is a little green play button click on it and select Open Terminal to open a cmd (or whatever command line) inside that environment, you can tell by the name of the environment inside a pair of prantheses before the path like below.
(my-tensorflow-env) C:\Users\someone>
  1. Use this command to install cudatoolkit and cudnn easilly inside your isolated environment. (for me was two ~650 MB files to download since the versions are fixed, you probabely see similar)
conda install -c conda-forge cudatoolkit=11.2 cudnn=8.1.0
  1. Now Before installing tensorflow downgrade Numpy to version 1.X.
pip install "numpy<2.0"
  1. Now for the last part install tensorflow.(it may take a while also prepare a reliable connection as pip is vulrenble to connection issue, also dont panic if it connection timed out or whatever, just the command again nothing is broken)
python -m pip install tensorflow==2.10.0
  1. to test the redemption inter this command:
python -c "import tensorflow as tf; print(tf.config.list_physical_devices('GPU'))"

if you see something like:

[PhysicalDevice(name='/physical_device:GPU:0', device_type='GPU')]

Congrats! enjoy GPU.

Reasons:
  • Blacklisted phrase (1): this guide
  • Long answer (-1):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: Toofan Mohammadi