Python quits silently upon importing tensorflow, no error/logs

Viewed 215

I currently have a problem with tensorflow that I've been stuck with for almost 2 weeks now.

No matter what Python script I run, every time tensor flow is imported import tensorflow Python just quits with no error, no logs, nothing. It just silently quits similar to when exit() is called, any code that was supposed to execute after import tensorflow simply doesn't run.

I've tried both conda and pip, created an virtual environment and installed tensorflow, I tried without virtual environment too (which generally isn't recommended but I did just to see if it would make a difference).

I've tried every Python version available that works with Tensorflow 2. I've tried both command prompt and powershell, inside Visual Studio and outside in the file explorer.

I've tried CPU and GPU, installed, removed, re-installed Cuda and everything, including my Nvidia drivers and everything else required to run tensorflow on GPU, also with every Python version, I've tried nearly every Tensorflow 2 version. I've even tried forcing the GPU/CPU before Tensorflow gets imported. Even the basic/barebones CPU version simply won't run.

The worst part is that this issue not only happens on my computer that I use at work but it also happens on my personal computer at home, I barely have to do anything as this problem reproduces itself.

I at first thought it had to do with my project but I quickly figured that even just writing a brand new, fresh and empty script with a brand new, fresh and empty virtual env solves nothing (even without virtual env). Even a clean re-install of Python and Conda did nothing.

I am clueless at this point, I haven't been able to find any solutions on the internet I depend on tensorflow and this problem is stopping me right in my tracks and prevents me from even testing or doing basic tutorials.

For those who need to know, here is how you could reproduce the issue yourself.

  1. Install Python 3.8 or Conda.

  2. (Optional but recommended) Create an virtual environment in the path/directory of choice with no other package installed than the latest version of Tensorflow 2.

  3. Write a simple script with the following Python code.

print('This prints')
import tensorflow
print('This will never print')
  1. Activate Python/Conda environment.

  2. Do python MyScript.py in the command prompt.

  3. The script should now run but stop after importing tensorflow, the second print statement should never print.

SPECS INFO: I use Windows 10 on all computers, all have Intel CPUs (Both i7). One of them a Nvidia GTX 1050 the other PC has a Nvidia TITAN Black.

I will try to add more information soon when I have some time. I don't know if this issue is reproducable for everyone but I've had the same issue on multiple computers with slightly different specs so far even with a clean Python install and environment.

UPDATE: This issue has somehow resolved itself after a recent Tensorflow update, it now functions just as expected. I still haven't found what caused the problem but it's fixed now, thank you to those who tried to help me out earlier.

0 Answers
Related