Skip to contents

Python enables advanced features: NLP with spaCy, PDF tables, embeddings, and AI analysis.

Quick Setup

This automatically:

  1. Creates virtual environment textanalysisr-env
  2. Installs spacy and pdfplumber
  3. Downloads spaCy English model (en_core_web_sm)

Uses virtualenv (or conda if available).

Check Status

Common Issues

“Another Python already initialized”

Set preferred environment in .Rprofile:

Sys.setenv(RETICULATE_PYTHON_ENV = "textanalysisr-env")

Then restart R.

Environment in OneDrive

Avoid OneDrive paths. Use:

setup_python_env(method = "virtualenv", envpath = "C:/Python/envs")

spaCy Models

The default en_core_web_sm model is installed automatically. For word vectors (similarity):

python -m spacy download en_core_web_md  # Medium (91 MB)
python -m spacy download en_core_web_lg  # Large (560 MB)

Deep Learning (Optional)

For embeddings and neural sentiment:

pip install sentence-transformers transformers torch