0

I installed tensorflow.

I then went back and created a virtual env called tensorflow and installed it there as well yet my Jupyter notebook is unable to import it. I have been troubleshooting through many posts here and elsewhere across the internet for two days now and have not had any luck I just keep getting the

"ModuleNotFoundError: No module named 'tensorflow'"

Anybody willing to get me a start to finish walkthrough of how I can get this running on a Mac?

I felt like I installed this much easier on my previous Mac (may 2018) but Im seeing there have been some version changes so I think that may be why things are different this time around.

Seem to be having the same issue with importing sklearn.

Versions installed are below:

Python 3.6.8 :: Anaconda, Inc.

conda 4.6.14

Name: tensorflow
Version: 1.13.1
Location: /Users/boston/miniconda3/envs/tensorflow/lib/python3.6/site-packages

Name: sklearn
Version: 0.0
Location: /Users/boston/.local/lib/python3.6/site-packages

keras-2.2.4 pyyaml-5.1

I know many people have this issue however none of their solutions have worked for me. Any help is greatly appreciated.

warped
  • 8,947
  • 3
  • 22
  • 49
db4
  • 41
  • 1
  • 5
  • did you activated the venv where you installed tensorflow? – Pavel Kovtun May 07 '19 at 15:58
  • I believe so. I activated a virtual env called 'tensorflow' then installed it there. you see here: Location: /Users/boston/miniconda3/envs/tensorflow/lib/python3.6/site-packages – db4 May 07 '19 at 16:06
  • This is saying its installed in the venv correct? – db4 May 07 '19 at 16:07
  • yes. but when you run your python file, do you run it using the python interpreter from the tensorflow-gpu venv? – Pavel Kovtun May 07 '19 at 16:07
  • Sorry to sound so uninformed but I do not know so I will assume no. could you explain what the python interpreter is? and how to run tensorflow using it – db4 May 07 '19 at 16:09
  • literally activate it: https://uoa-eresearch.github.io/eresearch-cookbook/recipe/2014/11/26/python-virtual-env/ – Pavel Kovtun May 07 '19 at 16:10
  • Did you install a jupyter kernel in your virtual env as well or is the notebook using the regular kernel? – Andy May 07 '19 at 16:42
  • may be using a regular kernal. how would I know if I am? – db4 May 07 '19 at 18:03
  • at this point im willing to pay $20 bucks or whatever is appropriate to whoever helps me solve this issue. – db4 May 07 '19 at 18:43
  • @db4, there are basically two ways to go from here (1) install jupyter notebook into the environment with tensorflow - activate the environment and then run jupyter notebook (2) install a separate notebook kernel in the tensorflow environment (see here for an example https://stackoverflow.com/questions/30492623/using-both-python-2-x-and-python-3-x-in-ipython-notebook/30492913#30492913) – cel May 07 '19 at 19:58
  • @cel I activated my anaconda environment with python 3.6.8 installed tensorflow there. yet its still giving me the module not found error when i go to import in my ipynb. any other advice you have? – db4 May 08 '19 at 19:16
  • I've noticed a few people reporting issues loading modules when there are multiple `site-packages` in the `import sys; sys.path`. That fact that you show loading `sklearn` from outside the env looks indicative of this. I'd try ensure that everything needed is installed (and loaded) from your env. And remove any other Python package sources that could be getting loaded through `PATH` or `PYTHONPATH` environment variables. – merv May 10 '19 at 05:32
  • @merv if you dont mind could you be so kind as to walk me how to do that. Trying to clean up the mess I've created on my own has only set me back several days at this point. – db4 May 10 '19 at 20:10
  • @db4 I give some general guidelines in this other answer: https://stackoverflow.com/a/55152014/570918 The other user ended up removing the non-Conda managed `site-packages` from their `PATH` and that fixed things. – merv May 10 '19 at 23:37

0 Answers0