2

I can't get tensorflow to work on two different Windows PCs and on both I get "ModuleNotFoundError: No module named 'tensorflow' when try to import them in python.

Numpy for example works on one machine not the other. Checked a dozen of posts on stackoverflow, nothing really helps. Clearly somethings wrong with the paths, can't really figure out what and how to trouble check it. I followed this set-up https://github.com/Unity-Technologies/ml-agents/blob/master/docs/Installation-Windows.md I need the 1.7.1 version of TF for Unity ML-agents to work

                  OS: windows 10
      conda version : 4.4.11
conda-build version : 3.4.1
     python version : 3.6.4.final.0

Even a clean install of Anaconda didn't help.

Mike Wise
  • 22,131
  • 8
  • 81
  • 104
Ren
  • 41
  • 1
  • 5

2 Answers2

2

I finally managed to fix this (not with ML-agents, but that's a different story). I uninstalled Anaconda and Python as well as cleared the registry from all Python information. I had a previous installation of Python 3.7 and I'm guessing this might have caused some issues. Clean install of Anaconda with a 3.6 env and TF is working both with cpu and gpu support.

Ren
  • 41
  • 1
  • 5
0

These problems often happen when you are on the wrong environment, or when you do not activate your environment. Please try the following steps and see if the problem persists:

  1. Open Anaconda prompt
  2. Activate the environment in which you installed tensorflow by using conda activate YOUR_ENV_NAME
  3. Type python to launch python
  4. try to import tensorflow

And see if the error persists.

Psychotechnopath
  • 2,471
  • 5
  • 26
  • 47
  • Just to clarify. Yes, I did activate the environment and I tried both using conda and pip install (pip initially as I followed the ML-agents set-up) – Ren Aug 26 '19 at 20:25
  • What happens if you type conda list in the activated environment? Is tensorflow there? – Psychotechnopath Aug 26 '19 at 20:30
  • Yes. The environment has all the packages installed in the list. The thing that is a bit more puzzling is that in the Anaconda Navigator the env is only showing 9 packages and 'conda list' shows 83. But I've tried installing tensorflow from the Navigator and I still get the same error 'ModuleNotFoundError '. – Ren Aug 26 '19 at 20:37
  • Did you create a new environment and installed tensorflow, or are you working with the base environment? – Psychotechnopath Aug 27 '19 at 11:10
  • Nvm, I see you managed to resolve the issue; different python versions on path can sometimes cause weird issues. My advice is to stick with the anaconda installation, and create new environments if you have projects thst require specific dependencies (like python 2 programs). You should accept the answer that solved your issue, that shows other ppl your issue was resolved, and gives the person who helped you credit. You can also accept your own answers! – Psychotechnopath Aug 27 '19 at 11:12
  • Thanks for the help. I need to wait till tomorrow to accept my own answer. – Ren Aug 27 '19 at 11:36