2
votes

I am using windows, Python 3.6.7, and conda 4.5.12

Here is what I've done so far:

-since tensorflow only works on Python 3.4, 3.5, and 3.6 I created an environment in anaconda prompt conda create -n py36 python=3.6 anaconda

  • activated the environment conda activate py36

  • attempted to install tensorflow using anaconda but it failed:

    (py36) C:\Users\jim>conda install -c conda-forge tensorflow

Solving environment: failed

CondaUpgradeError: This environment has previously been operated on by a conda version that's newer than the conda currently being used. A newer version of conda is required. target environment location: C:\Users\jim\Anaconda3\envs\py36 current conda version: 4.5.12 minimum conda version: 4.6

  • so I just installed it with pip and it worked:

    (py36) C:\Users\jim>pip install tensorflow

  • this screenshot confirms that tensorflow is installed

  • went into anaconda navigator, switched to py36, and opened up a jupyter notebook (doesn't work in Spyder either), and got this:

    import tensorflow as tf


ModuleNotFoundError Traceback (most recent call last) ModuleNotFoundError: No module named 'numpy.core._multiarray_umath'


ImportError Traceback (most recent call last) ImportError: numpy.core.multiarray failed to import

The above exception was the direct cause of the following exception:

SystemError Traceback (most recent call last) ~\Anaconda3\envs\py36\lib\importlib_bootstrap.py in _find_and_load(name, import_)

SystemError: returned a result with an error set


ImportError Traceback (most recent call last) ImportError: numpy.core._multiarray_umath failed to import


ImportError Traceback (most recent call last) ImportError: numpy.core.umath failed to import

and then the kernel dies and it resets.

Any thoughts on what might be wrong?

3
numpy is installed ;Dimitris Kougioumtzis
yes it is: numpy 1.15.4 py36h19fb1c0_0 numpy-base 1.15.4 py36hc3f5095_0Jim

3 Answers

2
votes

You can try these steps:

    1.conda create --name tf_env python=3.6

    2. conda activate tf_env

    3. conda install -c conda-forge tensorflow=1.12.0

    4. Try importing tensorflow 

    5. conda deactivate
1
votes

create tensorflow environment than active it:

conda create -n tensorflow_env tensorflow
    conda activate tensorflow_env
0
votes

In my case I was having trouble importing keras after running conda install keras

It worked when I upgraded my numpy installation. This site suggests numpy version 1.16 will work better, and that pip install may be needed (vs conda install):

pip install numpy==1.16

Also, after installing conda install keras, some of my colleagues had a different error; an error like "Could not find module named tensorflow". We fixed this by installing tensorflow: pip install tensorflow