Skip to content

Instantly share code, notes, and snippets.

@samlexrod
Last active March 12, 2018 22:05
Show Gist options
  • Save samlexrod/d1ab30fcec9670f9d203b85ed750932b to your computer and use it in GitHub Desktop.
Save samlexrod/d1ab30fcec9670f9d203b85ed750932b to your computer and use it in GitHub Desktop.
Here is a list of useful codes found online. I will add more as I find problems and do more research

Anaconda Distribution

Adding Extensions to Jupyter Notebooks

  • To install notebook extensions, type the following commands and then relaunch jupyter notebook from your shell:
conda install -c conda-forge jupyter_contrib_nbextensions
jupyter contrib nbextension install --user

Manually Registering Kernels in Anaconda Distribution

Configure the python 2.7 environment

  conda create -n py27 python=2.7
  source activate py27
  conda install notebook ipykernel
  ipython kernel install --user
  
  # Change the python version that you want to add to the enviroment accordingly

Direct Source: https://stackoverflow.com/questions/30492623/using-both-python-2-x-and-python-3-x-in-ipython-notebook

*Kernel stop working on Jupyter Notebook

  python -m ipykernel install --user

This simple install will solve the issue

Direct Source: ipython/ipython#10346

Creating, activating, and removing environments

To see the list of environments available

  conda info --envs
    or
  conda env list

To create and isntall the environment and version of python

  conda create -n myenv python=3.6

To check the packages installed in the environment

  conda list -n myenv
    or when active
  conda list

To remove environments

conda remove --name myenv --all

Direct Source: https://conda.io/docs/user-guide/tasks/manage-environments.html

Installing NLTK Stopwords

In the Anaconda prompt type the following:

  python -m nltk.downloader -d /directory... all

In jupyter notebook or python interpreter test the following:

  from nltk.corpus import brown
  brown.words()

  [u'The', u'Fulton', u'County', u'Grand', u'Jury', ...]

Direct Source: http://www.nltk.org/data

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment