In order to do several deep learning tasks in Python, I want to have TensorFlow, Theano en Keras installed on my computer.
As these are packages created for Python 3.5, I have created a new environment using:
conda create -n py35 python=3.5 anaconda
Then, after I have activated py35, I have installed Theano and TensorFlow:
conda install theano
conda install tensorflow
After I run Spyder at this point, it still launches. However, if I install Keras as well (code from: https://anaconda.org/conda-forge/keras):
conda install -c conda-forge keras
And try to run Spyder afterwards, I get the following error:
'Python has stopped working - A problem caused the program to stop working correctly. Please close the program.'
What can I do to install Keras in my environment and not get this error?
Related
I'm having issues with running tensorflow.
Important! I have already looked through other threads - they didn't solve my problem.
I'm on a MAC.
It looks like it got installed, but when on Jupyter I'm running
import tensorflow as ft
I get the error
ModuleNotFoundError: No module named 'tensorflow'
What I tried:
In the beginning I tried installing it with python 3.6 - that didn't work as during the pip installation process it ended with a fail saying i need python >= 3.7
OK, I created a new envt:
conda create -n tensorflow python=3.9
pip install --ignore-installed --upgrade tensorflow
conda install tensorflow
all ran successfully.
I can run now
pip show tensorflow
it gives me
Name: tensorflow
Version: 2.11.0
However the error in Jupyter still remains.
I tried installing it on PyCharm - it runs well, but not in Jupyter.
PyCharm is using python v. 3.9 (same as my tensorflow env)
And if I check my python v. in Jupyter, it's also 3.9
I even tried restarting my laptop to see if maybe that would help, but no.
Please give me ideas if any, what else could work.
Many thanks!
I dont think this is related to tf itself, more likely related to the imports and the enviroment.
Things you can try:
Activate your tensorflow environment in Jupyter: "conda activate tensorflow"
Install tensorflow in the base environment: "conda install tensorflow"
Check your Jupyter environment: make sure that you are running it in the same environment where tensorflow is installed "conda info --envs"
Reinstall Jupyter: If none of the above steps work, you can try reinstalling Jupyter "conda deactivate" to exit the tensorflow environment, "conda install jupyter" and "conda activate tensorflow" again to activate the environment.
I am using python 3.8 and I installed Tensorflow-gpu on it via command prompt. Now I am going to install keras on it, but I can't. I am using
conda activate tensorflow
conda install -c keras-gpu
but it fails.
I also tried from anaconda navigator. But whenever I try to add keras-gpu, it doesn't show anything. No packages come on pop-up window. When I try keras, it says that my python version is 3.8. Keras can't be installed. What can I do now? If there is a offline process to install keras on tensorflow environment, it will be helpful for me. So can you please help me?
Tried to install tensorflow using conda and its throwing a spec conflict error. I do not have python 3.5 installed
conda install -c conda-forge tensorflow
Fetching package metadata ...............
Solving package specifications: .
UnsatisfiableError: The following specifications were found to be in conflict:
- python 3.6*
- tensorflow -> python 3.5*
Use "conda info <package>" to see the dependencies for each package.
python --version
Python 3.6.0 :: Anaconda custom (64-bit)
I cannot seem to run tensorflow on the normal python IDE and it says module not found. So I installed Anaconda and everything seems good except for tensorflow. Any way to install this?
You seem to be installing tensorflow for python3.5 on a python3.6 environment. I would suggest you to create a seperate python environment for tensorflow. You can do it as follows
conda create -n Tensorflow anaconda python=3.5
This will create a anaconda environment called Tensorflow and install all the anaconda packages. You can also specify any other python distribution of your choice. Be sure you download the right tensorflow distribution depending on the python version you choose.
Then activate the newly created anaconda environment as follows
source activate Tensorflow
On windows
activate Tensorflow
This will switch the python environment. Then proceed to installing Tensorflow using pip as follows
pip install --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/windows/cpu/tensorflow-1.1.0-cp35-cp35m-win_amd64.whl
If you wish to install tensorflow with GPU support, you should install CUDA toolkit and the CUDNNv5.1. More details here
I am trying to install Tensorslow on my Windows 7 64 bit computer.
I have installed Anaconda with Python 3.5.
After that I did
conda install theano
it is successfully done.
conda install mingw libpython
successfully done.
pip install tensorflow
Error
I am not able to install Tensorflow in the same way I installed these other packages. Am I missing something basic?
Ok, I've updated instructions:
*Launch your Anaconda CMD as Admin
#if tensorflow virtual env has been created, remove it first
conda remove --name tensorflow --all
conda create -n tensorflow --python=3.5 anaconda
activate tensorflow
conda install spyder
conda install ipython
pip install --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/windows/cpu/tensorflow-1.0.1-cp35-cp35m-win_amd64.whl
spyder
Tensorflow on windows only works with Python 3.5 64-bit version, I don't know why doesn't work with Python > 3.5. Try this
conda create --name newEnv python=3.5
activate newEnv
(newEnv)C:> pip install tensorflow
This install Tensorflow in that particular environment. For testing run
(newEnv)C:> python
>>>import tensorflow as tf
>>>hello = tf.constant('Hello Tensorflow!')
>>>sess = tf.Session()
>>>sess.run(hello)
It should run without any error with output "Hello Tensorflow). Tested it on Windows 10 with python 3.5 64-bit and installed tensorflow 1.0.1 cpu version.
For Windows 10 (With NVidia 840M GPU)
If you have a different GPU check here to make sure your Compute number is > 3.0. My GPU has a 5.0
Mostly following instructions from official install instructions and steps from Stack Overflow Answer
I have found most answers do not combine the full installation from a clean install.
Configure the machine first
Download and install Anaconda from Download Anaconda-Windows Link
Installed Anaconda as User (I did not test installing as admin)
Download cuDNN v5.1 (Jan 20, 2017), for CUDA 8.0
Requires entering your email address and signing up.
Unzip this folder and add the */cuda/bin folder to your %PATH%
Install NVIDIA Cuda Version 8 for Windows 10
Also ensure this is in your path
Check for missing DLL: if where MSVCP140.DLL returns nothing you may need to either add it to the path or find it here
Open Anaconda CMD (with admin privilages)
Now install using conda and to test the installation
In Anaconda CMD (using Admin):
conda create -n tensorflow python=3.5 anaconda
activate tensorflow
pip install --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/windows/cpu/tensorflow-1.0.1-cp35-cp35m-win_amd64.whl
In Python:
import tensorflow as tf
hello = tf.constant('Hello, TensorFlow!')
sess = tf.Session()
print(sess.run(hello))
Also use the code in this answer to further confirm you are using the GPU
I am using an Ubuntu docker image. I've installed Anaconda on it with no issues. I'm not trying to install tensorflow, using the directions on the tensorflow website:
conda create --name tensorflow python=3.5
source activate tensorflow
<tensorflow> conda install -c conda-forge tensorflow
It installs with no errors. However, when I import in iPython, it tells me there is no module tensorflow. But if I import when in Python, it works fine.
What's going on and how do I fix it?
You have to install IPython in the conda environment
source activate tensorflow
conda install ipython
I went through the same thing. We are installing tensorflow in different conda environment. So It may not consist of all the packages. I needed to install jupyter notebook separately in order to work.