pythonemacsvirtualenvanacondajedi

Can virtualenv be avoided when using Emacs Jedi (in Anaconda)?


I'm using the Anaconda python framework. Anaconda has it's own virtual environment system, and it's not clear to me if virtualenv can be used safely with Anaconda.

Emacs Jedi seems to require virtualenv. Is it used at "runtime" or is it used only during installation? Is it possible to use Jedi without having virtualenv installed? Can virtualenv be un-installed once Jedi installation is complete?

Is there some way to ask this question directly of the Jedi developers? (couldn't find a way)


Solution

  • Is there some way to ask this question directly of the Jedi developers?

    You can use their github issue tracker which lives here.

    The emacs-jedi website states that virtualenv is optional so I guess jedi will work without it. If you can post how you are installing jedi or how you want to install it (manually, using el-get or some other way) then people here will be able to help you better.

    UPDATE

    Here is one way to install jedi manually without virtualenv

    1) Install jedi from melpa. Do M-x list-packages, mark the package jedi by pressing I and then press X to install the package (this will install all the dependencies as far as elisp is concerned)

    2) Then install the python dependencies, you can download the requirements.txt from here and then do pip install -r requirements.txt, this will install the python dependencies.

    3) Add a python-mode hook to start jedi when you open python files, basically add the following to your init file

    (autoload 'jedi:setup "jedi" nil t)
    (add-hook 'python-mode-hook 'jedi:setup)
    

    The above should setup jedi, if you face problems in any of the above steps do not hesitate to ask

    UPDATE 2

    Below are the steps to get emacs-jedi working with 'conda environment framework` (I used miniconda but this should work even with full conda installation)

    1) Create a conda environment (for current example the environment is named emacs-jedi) by doing

    conda create -n emacs-jedi python
    

    2) Build the package for jedi, epc and sexpdata (required for for emacs-jedi)

    a) Clone the conda-recipes repository

    b) Build the required package by doing conda build /path/to/conda-recipies/<pkgname>

    3) Switch to the environment created above by doing source activate emacs-jedi and install the packages built above by doing

    conda install --use-local jedi sexpdata epc
    

    --use-local is used to instruct conda to install from locally built packages

    4) Finally instruct emacs to use this environment with jedi, this simply add the following to your init file

    (eval-after-load "jedi"
        '(setq jedi:server-command (list "/path/to/emacs-jedi/bin/python" jedi:server-script)))