Question

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)

Was it helpful?

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

OTHER TIPS

Jedi.el dev here. As of Jedi.el v0.2.0, virtualenv becomes the default and highly recommended. Manual installation is still supported but discouraged since you need to manually sync version of Jedi.el and Python modules. See:

I have no idea what anaconda is, but I suppose here that it has own environment. If it is just a wrapper of virtualenv then follow the instruction in the manual and use --virtual-env. If not, you can use --sys-path to tell Jedi.el about additional site-path. See:

First, you need to find anaconda-specific site-path. Run

python -c 'import sys; print(sys.path)'

in anaconda and find some anaconda-specific paths (I have no idea what it will be. But I guess it includes "anaconda" in the path). Then add these paths using --sys-path. See jedi:server-args document for the code.

Here is my hack to set the jedi:server-command variable:

(setq jedi:server-command
        `("python"
          ,(concat (file-name-directory
                   (buffer-file-name
                    (car
                     (find-definition-noselect 'jedi:setup nil))))
                  "jediepcserver.py")))
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top