How to install Keras and Tensorflow in Python 2.7.18? - python-2.7

I have an assignment that I need to work with Python 2
and I also need Keras and Tensorflow. At which version should I downgrade
each package so I can install it in a Jupyter notebook or in Spyder 4.0.1 ?
Thank you.

try
pip install tensorflow==1.13.1
and
pip install keras==2.2.4

Related

pip install in google deep learning vm

I'm using one of the deep leaning images but am really only familiar with installing packages using conda which appears to not be used in the image. How do I pip install a package to my jupyter notebook kernel?
You can install python packages from Jupyter Kernel like this:
# Install a pip package in the current Jupyter kernel
import sys
!{sys.executable} -m pip install numpy
You can have a look at this document for more detailed information.

installing seaborn without sudo

I am trying to install seaborn without using sudo. I have already installed on my python 2.7 and windows 7 setting with the following cmd commands :
pip install pandas
pip install xlrd
pip install matplotlib
and they all were installed like charm.
`pip install seaborn` did not work
i have attached the error message.[last lines of emssage][1]
You may be interested in installing precompiled python wheel binaries for Windows.
That, or use something like Anaconda python.

how avoid Anaconda to hijack pip

I have 2 versions of Python installed on my PC (Windows 7, 64Bit).
Python 2.7 Version installed with Anaconda
Python 3.6 Version installed directly from python.org (the "regular IDLE")
Now, i would like to install the necessary packages on the 3.6 using pip, but anaconda keeps on hijacking the command.
For example, on typing in the cmd window:
pip install numpy
and i get:
Requirement already satisfied: numpy in
c:\users\georges\anaconda2\lib\site_packages
Which is the case for python2.7, but i was trying to install it for version 3.6 installed without Anaconda.
I tried re-installing pip hoping it would erase the hijacking by Anaconda2 ... failed.
I am contemplating to remove Anaconda2 altogether although i risk that in windows, removing a programme does not necessaraly remove the dependencies.
Any lead please ?
I think what you are looking for is pip3 install pip3 and you should be able install packages for python3
It should come as standard with python3 installation setup.
First check if it is there with
where pip3
For any further issues check this post
You don't need to uninstall anaconda2. Both python versions can co-exist and libraries different managed by different package installers pip for python 2 and pip3 for python 3 respectively.
Hope this answers your question.
Install it with pip3, because you want it for python 3:
pip3 install numpy

How do I install Keras and Theano in Anaconda Python on Windows?

I am trying to work on neural networks in Python using the following Keras packages:
from keras.utils import np_utils
from keras.layers.core import Dense, Activation, Dropout
from keras.models import Sequential
from keras.layers.core import Dense, Dropout, Activation, Flatten
from keras.layers.convolutional import Convolution2D, MaxPooling2D
from keras.optimizers import SGD
But, I am getting the following error:
15 import theano
---> 16 from theano import gof
17 from theano.compat.python2x import partial
18 import theano.compile.mode
ImportError: cannot import name gof
Installing installed conda install keras. Later I tried to use pip install Theano, but it did not work. I Tried to install using pip install git, but I am getting this error: cannot find command git. So I installed Git and I set the environment variables.
So, is there any procedure to install these packages?
It is my solution for the same problem
Install TDM GCC x64.
Install Anaconda x64.
Open the Anaconda prompt
Run conda update conda
Run conda update --all
Run conda install mingw libpython
Install the latest version of Theano,
pip install git+git://github.com/Theano/Theano.git
Run pip install git+git://github.com/fchollet/keras.git
The trick is that you need to create an environment/workspace for Python. This solution should work for Python 2.7 but at the time of writing keras can run on python 3.5, especially if you have the latest anaconda installed (this took me awhile to figure out so I'll outline the steps I took to install KERAS in python 3.5):
Create environment/workspace for Python 3.5
C:\conda create --name neuralnets python=3.5
C:\activate neuralnets
Install everything (notice the neuralnets workspace in parenthesis on each line). Accept any dependencies each of those steps wants to install:
(neuralnets) C:\conda install theano
(neuralnets) C:\conda install mingw libpython
(neuralnets) C:\pip install tensorflow
(neuralnets) C:\pip install keras
Test it out:
(neuralnets) C:\python -c "from keras import backend; print(backend._BACKEND)"
Just remember, if you want to work in the workspace you always have to do:
C:\activate neuralnets
so you can launch Jupyter for example (assuming you also have Jupyter installed in this environment/workspace) as:
C:\activate neuralnets
(neuralnets) jupyter notebook
You can read more about managing and creating conda environments/workspaces
at the follwing URL: https://conda.io/docs/using/envs.html
In windows with anaconda, just go on conda prompt and use this command
conda install --channel https://conda.anaconda.org/conda-forge keras
I use macOS and used to have the same problem.
Running the following command in the terminal saved me:
conda install -c conda-forge keras tensorflow
Hope it helps.
In case you want to train CNN's with the theano backend like the Keras mnist_cnn.py example:
You better use theano bleeding edge version. Otherwise there may occur assertion errors.
Run Theano bleeding edge
pip install --upgrade --no-deps git+git://github.com/Theano/Theano.git
Run Keras (like 1.0.8 works fine)
pip install git+git://github.com/fchollet/keras.git
install by this command given below
conda install -c conda-forge keras
this is error "CondaError: Cannot link a source that does not exist" ive get in win 10.
for your error put this command in your command line.
conda update conda
this work for me .
In windows environment with Anconda. Go to anconda prompt from start. Then if you are behind proxy then .copndarc file needs to eb updated with the proxy details.
ssl_verify: false
channels:
- defaults
proxy_servers:
http: http://xx.xx.xx.xx:xxxx
https: https://xx.xx.xx.xx:xxxx
I had ssl_verify initially marked as 'True' then I was getting ssl error. So i turned it to false as above and then ran the below commands
conda update conda
conda update --all
conda install --channel https://conda.anaconda.org/conda-forge keras
conda install --channel https://conda.anaconda.org/conda-forge tensorflow
My python version is 3.6.7
Anaconda with Windows
Run anaconda prompt with administrator privilages
conda update conda
conda update --all
conda install mingw libpython
conda install theano
After conda commands it's required to accept process - Proceed ([y]/n)?

pip, easy_install commands not working in Ubuntu. Python 2.7 and 3.4 are installed

I'm fairly new to python. I'm using Ubuntu 14.04 and have both python 2.7.6 and python 3.4.0 installed. I was trying to install BeautifulSoup but couldn't because I get an error saying
The program 'pip' is currently not installed.
I found that it comes bundles with python 3.4. I tried to install pip using sudo easy_install pip as mentioned in another question on stackoverflow. But this gives an error sudo: easy_install: command not found.
What is the problem?
pip appears to have turned into python -m pip (in your case, python3 -m pip, as Ubuntu's keeping the 2.x line available as python) in Python 3.4.
easy_install for Python 2.7 comes as part of the python-setuptools package. Once installed, running easy_install pip would install pip for your Python 2.7 installation's use.
How aboutapt-get install python-pip? At least, Debian official repository has python-pip even from wheezy.
Unfortunately, effective as of April 2018, python-setuptools no longer ships with easy_install, as per Matthias's update:
https://ubuntu.pkgs.org/18.04/ubuntu-main-i386/python-setuptools_39.0.1-2_all.deb.html
However, you can still compile from the source code yourself, and it does work. I just tried it with sudo easy_install shodan, and it ran successfully.
git clone https://github.com/pypa/setuptools.git
cd ./setuptools
python3 bootstrap.py
sudo python3 setup.py install
Hope this helps.