Emacs-jedi does not find numpy improvements

I installed emacs-jedi to get some code completion for python in emacs. All in all, I have to say that I am very impressed! It works great and quickly finds improvements for the built-in libraries. However, I use python for scientific purposes and rely on numpy and scipy for my work. For some reason, I am not getting terminations for these modules.

Example:

import numpy testVector = numpy.array([1,2,3]) 

now we type testVector. and expectations, nothing is displayed

+8
python numpy emacs python-jedi
source share
2 answers

I wonder why this is not working. This looks like a sys.path problem, but it should work without any configuration. But here is some idea to fix brute force.

(1) Run the following script to get the boot path for numpy.

 import os import numpy print(os.path.dirname(os.path.dirname(numpy.__file__))) 

(2) Install jedi:server-args as follows to force the path to be added.

 (setq jedi:server-args '("--sys-path" "THE/PRINTED/PATH/FOR/NUMPY" "--sys-path" "THE/PRINTED/PATH/FOR/SCIPY")) 

See also: http://tkf.github.com/emacs-jedi/#jedi:server-args


Change 1

Read your comment on @syohex's answer, it looks like you messed up some installation methods. jeid.el uses virtualenv "env /" in the directory in which you have jedi.el, if one exists. el-get automatically creates "env /" if you have virtualenv. So, if you like installing the system, you should tell Jedi.el to ignore "evn /" by doing the following:

 (require 'jedi) (setq jedi:server-command (list "python" jedi:server-script)) 

See also: http://tkf.github.com/emacs-jedi/#jedi:server-command


Edit 2

I do not know why this comes from your description. Here are some ways to narrow down the problem.

  • Run make tryout in the directory in which jedi.el is installed (e.g. ~/.emacs.d/el-get/jedi/ ).

    This opens clean (i.e. does not read your setting). Emacs process with minimal setup for jedi.el. See if you can complete numpy and scipy.

  • Can you import numpy and scipy into Emacs? In Emacs and shell, you can have a different environment variable. Launch M-! python -c 'import numpy' RET M-! python -c 'import numpy' RET . If this does not give you an error, then this is normal.

  • Can you import numpy and scipy using env/bin/python ? The best way to do this is to check it with Emacs.

    So, first go to the directory where jedi.el is installed (for example, Cx Cf ~/.emacs.d/el-get/jedi/ RET ).

    Then run M-! env/bin/python -c 'import numpy' RET M-! env/bin/python -c 'import numpy' RET . If this does not give you an error, then it should be possible to import numpy and scipy.

I hope that at least one of them will give you an error, otherwise I need to think about another possibility.

+5
source share

I can get such a case. As after

enter image description here

You can use old requirements modules (jedi, epc, argparse). You must update them and try again.

+1
source share

All Articles