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)
Anaconda Navigator
head over to Environments
section.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.
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>
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
Numpy
to version 1.X.pip install "numpy<2.0"
python -m pip install tensorflow==2.10.0
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.