Skip to content

Latest commit

 

History

History
203 lines (179 loc) · 11.1 KB

Install_Import_Modules_Packages.md

File metadata and controls

203 lines (179 loc) · 11.1 KB

Install Python on Windows

when installing python check mark - add python to Path var https://towardsdatascience.com/setup-an-environment-for-machine-learning-and-deep-learning-with-anaconda-in-windows-5d7134a3db10
https://www.youtube.com/watch?v=A7E18apPQJs
https://www.reddit.com/r/Python/comments/2crput/how_to_install_with_pip_directly_from_github/
https://machinelearningmastery.com/setup-python-environment-machine-learning-deep-learning-anaconda/ To install python packages using cmd
Setup python in Environmental variables - https://www.pythoncentral.io/add-python-to-path-python-is-not-recognized-as-an-internal-or-external-command/
If adding to environment vars doesnt work - set path=C:\Python24 in cmd, then type 'python' to check if it z working
set - cd PATHoftheModule
Type - python setup.py install]
pip.main(['install','-e','C:/Users/spashikanti/Downloads/scikit-plot-master'])

Install git

  • In git - Type bash, git commands to see if they are working

Install C++ compiler for python

Download Visual studio installer - https://visualstudio.microsoft.com/downloads/
How to install visual studio installer - https://stackoverflow.com/questions/29846087/microsoft-visual-c-14-0-is-required-unable-to-find-vcvarsall-bat

Install Anaconda 64 bit, git

http://docs.anaconda.com/anaconda/user-guide/getting-started/

  • After installation, check if anaconda prompt and anaconda navigator are installed
  • In Anaconda prompt, type python, conda (or) conda list , jupyter notebook to see if they are installed or not
  • Run Anaconda navigator as Administrator if error related to user appears

If python/conda are not recoginzed - https://medium.com/@GalarnykMichael/install-python-on-windows-anaconda-c63c7c3d1444
https://stackoverflow.com/questions/31935714/how-to-install-rodeo-ide-in-anaconda-python-distribution
https://medium.com/@GalarnykMichael/setting-up-pycharm-with-anaconda-plus-installing-packages-windows-mac-db2b158bd8c
https://stackoverflow.com/questions/11438727/how-to-use-subprocess-to-run-a-virtualenv-package-install
https://www.youtube.com/watch?v=z0qhKP2liHs

To install pip - After installing Anaconda Nagivator use cmd - conda install pip Update Anaconda - "conda update conda" , "conda update --all"
Install packages - conda install package-name #In Anaconda Prompt
Update packages - conda update package-name #In Anaconda Prompt

Upgrade Packages using pip - "python -m pip install --upgrade pip" #In Anaconda Prompt
conda update pip #In Anaconda Prompt
check pip version - pip --version #In Anaconda Prompt

To Open jupyter notebook type - jupyter notebook in Anaconda prompt

Jupyter Notebook Basics

https://nbviewer.jupyter.org/github/fastai/course-v3/blob/master/nbs/dl1/00_notebook_tutorial.ipynb

  • Install packages directly in Jupyter notebook
    import sys
    !{sys.executable} -m pip install gensim

Google colab

PyCharm IDE

Install Specific Packages - Anaconda website, whl, github


* A few ways to solve errors https://www.tensorflow.org/install/errors
https://github.com/aymericdamien/TensorFlow-Examples
#### Create Environments https://media.readthedocs.org/pdf/tensorflow-object-detection-api-tutorial/latest/tensorflow-object-detection-api-tutorial.pdf
To identify environments installed: conda info --envs
Environments are loaded at: C:\ProgramData\Anaconda3\envs
Ideally you should install each variant(tensorflow & tensorflow-gpu) under a different (virtual) environment.
* tensorflow_cpu - Environment for * tensorflow - Environment to do chapter2,3 of Tensorflow setup documentation pdf
conda install scipy
pip install --upgrade sklearn
pip install --upgrade pandas
pip install --upgrade pandas-datareader
pip install --upgrade matplotlib
pip install --upgrade pillow
pip install --upgrade requests
pip install --upgrade h5py
pip install tensorflow==1.8.0
pip install keras==2.2.0

To install packages that has '-' in their package name

Use either _ instead of -
Use no space/join words instead of -
Use shortform direct in import command. for eg- scikit-optimize is used in pip install command, but in import command directly use skopt

Install in Rodeo - New Version of pip

  • Install/Upgrade Packages import pip
    import subprocess
    subprocess.check_call(["python", '-m', 'pip', 'install', 'scipy']) # install pkg - pkg name should all be small letter NO CAPITALS
    subprocess.check_call(["python", '-m', 'pip', 'install',"--upgrade", 'scipy']) # upgrade pkg - pkg name should all be small letter NO CAPITALS
    from scipy import *
    import scipy as sy
  • Check Version of pip installed
    pip.version
  • List of all installed packages
    import subprocess
    import sys
    reqs = subprocess.check_output([sys.executable, '-m', 'pip', 'freeze'])
    installed_packages = [r.decode().split('==')[0] for r in reqs.split()]
    print(installed_packages)

Install in Rodeo - old Version of pip

  • Upgrade pip
    pip.main(['install', '--upgrade', 'pip'])
  • Install and Upgrade Packages in Rodeo
    import pip
    pip.main(['install','SciPy']) # install pkg
    pip.main(['install', '--upgrade', 'statsmodels']) # upgrade pkg
    from scipy import *
    import scipy as sy
    • Packages that have - import pip
      pip.main(['install','scikit-learn'])
      pip.main(['install', '--upgrade', 'statsmodels'])
      from sklearn import *
      import sklearn as sklearn

Packages for Data Science

  • General import numpy as np
    import pandas as pd
    import os
  • Visualization import seaborn as sns
    import matplotlib.pyplot as plt
    %matplotlib inline

Set up new environment for a project

https://github.com/andfanilo/ieee-fraud-detection

Packages unable to install

Errors

  • Could not find a version that satisfies the requirement opencv (from versions: ) No matching distribution found for opencv
    • Either the python version required for the package is not present
    • Module/Package name is wrong/incorrect. Eg codecs is actually part of 'openapi-codec'
  • Building wheel error: pip install --no-cache-dir MODULENAME
  • python setup.py egg_info failed with error code 1
    • pip install --upgrade setuptools
Path Var

C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Program Files (x86)\Intel\iCLS Client;C:\Program Files\Intel\iCLS Client;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Program Files\Hewlett-Packard\SimplePass;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\WiFi\bin;C:\Program Files\Common Files\Intel\WirelessCommon;C:\Program Files\Git\cmd;C:\Users\User\AppData\Local\Programs\Python\Python37\Scripts;C:\Users\User\AppData\Local\Programs\Python\Python37;C:\Users\User\Anaconda3;C:\Users\User\Anaconda3\Library\mingw-w64\bin;C:\Users\User\Anaconda3\Library\usr\bin;C:\Users\User\Anaconda3\Library\bin;C:\Users\User\Anaconda3\Scripts;C:\Users\User\AppData\Local\rodeo\app-2.5.2\bin;C:\Users\User\AppData\Local\rodeo\app-2.5.2\resources\conda