pip install in google deep learning vm - google-cloud-platform

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.

Related

How to install Keras and Tensorflow in Python 2.7.18?

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

Installing PyMC3 on Anaconda 3 / Win

This installation is a nightmare!!!
Using:
conda install -c conda-forge pymc3
Will not work.
I then tried to install theano first (and its dependencies), found out the hard way that it works with python=3.5, NOT 3.6.
# Install theano reqirements
conda install numpy scipy mkl-service libpython m2w64-toolchain
# Install theano
conda install theano pygpu
# You are using a different python version (3.5) from the base installation,
# you must point to the right kernel for Jupyter:
conda install ipykernel
python -m ipykernel install --user
# Install & test on jupyter, spyder
conda install jupyter spyder qt
# Install PyMC3
pip install pymc3
Everything imports, but then when I run the code the 'NUTS' thing won't initialize...
Not sure which process worked for me but this is the step I took
reset my whole laptop
re-download wsl2
install conda
go to this directory
path_to_your_python_env>/Lib/site-packages/theano/misc/windows.py
delete or comment out following
params['shell'] = True
Even though it works, the compiler is extremely still slows

Install opencv python package in Anaconda

Can someone provide the steps and the necessary links of the dependencies to install external python package "opencv-python" for image processing?
I tried installing it in pycharm, but it was not able to import cv2(opencv) and was throwing version mismatch with numpy!
Please help!
The good thing with anaconda is that it should make your life easier without getting your hands too dirty. If you use only basic libs, only install packages with anaconda commands to be sure not to corrupt your python environment.
if you're on linux, use conda install -c conda-forge opencv
on windows, do the same with the "anaconda prompt" terminal.
If you still have some trouble with you numpy version, try conda update numpy
Create a virtual env. Following which run following instals
pip install numpy scipy matplotlib scikit-learn jupyter
pip install opencv-contrib-python
pip install dlib
You may verify the install via this script in Python environment-
import cv2
cv2.version
Remove all previous/current (if any) python installation
Install Anaconda and add anaconda to PATH(Envirnoment variables:: Adavanced system setting->Environment variables->under system variables go to variable PATHand click edit to add new envirnomental variables)
(During installation check box involve PATH)
Open anaconda prompt with admin access. Type and enter:-
conda update --all
conda install -c conda-forge opencv
conda install spyder=4.0.0 (spyder updation)
conda update python (for python updation)
To install this package with conda run one of the following:
conda install -c conda-forge opencv
conda install -c conda-forge/label/gcc7 opencv
conda install -c conda-forge/label/broken opencv
conda install -c conda-forge/label/cf201901 opencv

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 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)?