Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ipython 7.12.0 tab completion doesn't work with numpy and scipy, but with matplotlib #12121

Closed
Kadelka opened this issue Feb 11, 2020 · 21 comments
Milestone

Comments

@Kadelka
Copy link

Kadelka commented Feb 11, 2020

The ipython-shell:
Python 3.8.1 (default, Jan 9 2020, 22:55:38)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.12.0 -- An enhanced Interactive Python. Type '?' for help.

import readline
readline.parse_and_bind('tab: complete')

import numpy
numpy.__v tab completes to numpy.version
similar for numpy._anything, but
numpy.lin tab should complete to numpy.linspace(, but doesn't
ipython works fine with eg. matplotlib and other modules.

@Kadelka Kadelka changed the title ipython 7.12.0 tab completion doesn't work with numpy and scipy ipython 7.12.0 tab completion doesn't work with numpy and scipy, but with matplotlib Feb 11, 2020
@Carreau
Copy link
Member

Carreau commented Feb 12, 2020

Try to upgrade jedi; if jedi crashes you will not get any completions.

@Kadelka
Copy link
Author

Kadelka commented Feb 12, 2020

Just upgrades jedi. Completion now seems to be o.k. Thank you.

@Kadelka Kadelka closed this as completed Feb 12, 2020
@david-mandelman
Copy link

I am experiencing the same problem - autocomplete works with pandas and seaborn, but NOT numpy. I'm using latest Jedi version 0.14.1. in fact, I updated all pkgs with conda in late April, 2020, so everything up-to-date:
numpy 1.18.1
Jupiter 1.0.0

@Kadelka Kadelka reopened this Apr 27, 2020
@Kadelka
Copy link
Author

Kadelka commented Apr 27, 2020

My jedi-version is 0.16.0. With conda it is 0.15.1. Maybe your upgrade is not complete.

@david-mandelman
Copy link

david-mandelman commented Apr 27, 2020 via email

@david-mandelman
Copy link

I'm trying: conda install jedi=0.15.1
but conda seems stuck at Solving environment. Should I get the Jedi pkg directly from Jedi site?

@david-mandelman
Copy link

OK, performed full conda update and now have Jedi 0.15.2, but numpy still NOT autocompleting. Frustrating. Any suggestions?

@Kadelka
Copy link
Author

Kadelka commented Apr 27, 2020

I think you sould address @Carreau directly. I'm only a user.

@Carreau
Copy link
Member

Carreau commented Apr 27, 2020

Latest jedi on conda-forge is 0.17 (https://github.com/conda-forge/jedi-feedstock/pull/30/files) though you have to use -c conda-forge when upgrading all.

Which Python version are you on ? It might be that you are on an older one which does not have newer packages.

Avoid old version of Jedi, the latest IPython will not be compatible with them.

You can use conda-export and pip-freeze if you want to see version of all your packages.

@david-mandelman
Copy link

david-mandelman commented Apr 27, 2020 via email

@prasunsrivastava
Copy link

prasunsrivastava commented Aug 14, 2020

Hi @Carreau . I am also facing a similar issue on 7.16.0. To reproduce the issue, I created a minimal conda environment with only Numpy and IPython. Below are the packages installed in the environment:

# Name                    Version                   Build  Channel
_libgcc_mutex             0.1                        main  
backcall                  0.2.0                      py_0  
blas                      1.0                         mkl  
ca-certificates           2020.6.24                     0  
certifi                   2020.6.20                py38_0  
decorator                 4.4.2                      py_0  
intel-openmp              2020.1                      217  
ipython                   7.16.1           py38h5ca1d4c_0  
ipython_genutils          0.2.0                    py38_0  
jedi                      0.17.0                   py38_0  
ld_impl_linux-64          2.33.1               h53a641e_7  
libedit                   3.1.20191231         h14c3975_1  
libffi                    3.3                  he6710b0_2  
libgcc-ng                 9.1.0                hdf63c60_0  
libstdcxx-ng              9.1.0                hdf63c60_0  
mkl                       2020.1                      217  
mkl-service               2.3.0            py38he904b0f_0  
mkl_fft                   1.1.0            py38h23d657b_0  
mkl_random                1.1.1            py38h0573a6f_0  
ncurses                   6.2                  he6710b0_1  
numpy                     1.19.1           py38hbc911f0_0  
numpy-base                1.19.1           py38hfa32c7d_0  
openssl                   1.1.1g               h7b6447c_0  
parso                     0.8.0                      py_0  
pexpect                   4.8.0                    py38_0  
pickleshare               0.7.5                 py38_1000  
pip                       20.2.2                   py38_0  
prompt-toolkit            3.0.5                      py_0  
ptyprocess                0.6.0                    py38_0  
pygments                  2.6.1                      py_0  
python                    3.8.5                hcff3b4d_0  
readline                  8.0                  h7b6447c_0  
setuptools                49.2.0                   py38_0  
six                       1.15.0                     py_0  
sqlite                    3.32.3               h62c20be_0  
tk                        8.6.10               hbc83047_0  
traitlets                 4.3.3                    py38_0  
wcwidth                   0.2.5                      py_0  
wheel                     0.34.2                   py38_0  
xz                        5.2.5                h7b6447c_0  
zlib                      1.2.11               h7b6447c_3  

I am running Python 3.8.5 with conda 4.8.2 on Ubuntu 20.04 LTS.

Also, I tried checking the results fro the Completer object and found that it works for some of the modules and not for others. Below is an example where it shows an empty list for Numpy whereas it provides values for sys.

In [1]: import IPython                                                                                                                                                                                     

In [2]: import numpy as np                                                                                                                                                                                 

In [3]: import sys                                                                                                                                                                                         

In [4]: ipy = IPython.get_ipython()                                                                                                                                                                        

In [5]: ipy.Completer.all_completions('np.')                                                                                                                                                               
Out[5]: []

In [6]: ipy.Completer.all_completions('sys.')                                                                                                                                                              
Out[6]: 
['sys.abiflags',
 'sys.addaudithook',
 'sys.api_version',
 'sys.argv',
 'sys.audit',
 'sys.base_exec_prefix',
 'sys.base_prefix',
 'sys.breakpointhook',
 'sys.builtin_module_names',
 'sys.byteorder',
 'sys.call_tracing',
 'sys.callstats',
 'sys.copyright',
 'sys.displayhook',
 'sys.dont_write_bytecode',
 'sys.exc_info',
 'sys.excepthook',
 'sys.exec_prefix',
 'sys.executable',
 'sys.exit',
 'sys.flags',
 'sys.float_info',
 'sys.float_repr_style',
 'sys.get_asyncgen_hooks',
 'sys.get_coroutine_origin_tracking_depth',
 'sys.getallocatedblocks',
 'sys.getcheckinterval',
 'sys.getdefaultencoding',
 'sys.getdlopenflags',
 'sys.getfilesystemencodeerrors',
 'sys.getfilesystemencoding',
 'sys.getprofile',
 'sys.getrecursionlimit',
 'sys.getrefcount',
 'sys.getsizeof',
 'sys.getswitchinterval',
 'sys.gettrace',
 'sys.hash_info',
 'sys.hexversion',
 'sys.implementation',
 'sys.int_info',
 'sys.intern',
 'sys.is_finalizing',
 'sys.maxsize',
 'sys.maxunicode',
 'sys.meta_path',
 'sys.modules',
 'sys.path',
 'sys.path_hooks',
 'sys.path_importer_cache',
 'sys.platform',
 'sys.prefix',
 'sys.ps1',
 'sys.ps2',
 'sys.ps3',
 'sys.pycache_prefix',
 'sys.set_asyncgen_hooks',
 'sys.set_coroutine_origin_tracking_depth',
 'sys.setcheckinterval',
 'sys.setdlopenflags',
 'sys.setprofile',
 'sys.setrecursionlimit',
 'sys.setswitchinterval',
 'sys.settrace',
 'sys.stderr',
 'sys.stdin',
 'sys.stdout',
 'sys.thread_info',
 'sys.unraisablehook',
 'sys.version',
 'sys.version_info',
 'sys.warnoptions']

Also, let me know if you want me to open a new issue for the same. Thanks for the help.

@david-mandelman Are you using specific nbextension for the autocomplete? I tried doing the same and did not get the autocomplete suggestions. I turned on hinterland, and it still can not perform the auto-completions.

Any help from the community will be much appreciated.

Thanks

@tsokar
Copy link

tsokar commented Aug 21, 2020

Hi, I am experiencing the same issue on "stock" ipython/python/numpy in Manjaro and archlinux.
I followed the test proposed by @prasunsrivastava and get the same behaviour.
Any hint ?

Thanks !

@jjstickel
Copy link

Same behavior with macports-installed python, ipython, numpy, etc., on Mac:

python36 @3.6.11_0 (active)
py36-ipython @7.16.1_0 (active)
py36-numpy @1.19.1_0+gcc8+openblas (active)

@Carreau
Copy link
Member

Carreau commented Aug 21, 2020

run with --IPCompleter.debug, so see if you get tab completions that trigger tracebacks in jedi.

(they will appear as fake tab completion items saying jedi has crashed).

Try jedi 0.17.2,

Python 3.6 is not supported anymore, so you likely want to be on at least 3.7.

@jjstickel
Copy link

run with --IPCompleter.debug, so see if you get tab completions that trigger tracebacks in jedi.

With which command should this be run?

(they will appear as fake tab completion items saying jedi has crashed).

Try jedi 0.17.2,

Python 3.6 is not supported anymore, so you likely want to be on at least 3.7.

Sorry, still transitioning to python-3.8 (slow utilization by some science libs). I tested with:

python38 @3.8.5_0 (active)
py38-jedi @0.17.2_0 (active)
py38-ipython @7.17.0_0 (active)
py38-numpy @1.19.1_0+gfortran+openblas (active)

and same behavior.

@tsokar
Copy link

tsokar commented Aug 26, 2020

@Carreau : I tested with jedi git v0.17.2 r141.216f976f and completion works again with numpy.
Thanks a lot !
Just a question, what (in your opinion) changed in jedi 0.17.2 vs 0.17.0 that may lead to the issue ?

T.

@Carreau
Copy link
Member

Carreau commented Aug 26, 2020

I don't know, I just know that when david wake patch releases it's often for critical bugs. I also know that 0.17.0 had bugs as many software (spyder for example) explicitly exclude it.

@jjstickel
Copy link

jjstickel commented Aug 30, 2020

I figured out how to run ipython with --IPCompleter.debug=True. I get this

In [1]: np.araOops Jedi has crashed, please report a bug with the following:
   ...: """
   ...: '/opt/local/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/num
   ...: py/__init__.py'
   ...: s"""

Not a lot of information. FWIW, you can disable use of jedi with the option --IPCompleter.use_jedi=False, and auto-completion works again.

@mdruiter
Copy link

mdruiter commented Dec 7, 2020

I had accidentally installed parso 0.8.0, which jedi 0.17.2 didn't like. I reinstalled jedi, which downgraded parso to 0.7.1, and now it works again!

@imavo
Copy link

imavo commented Jan 25, 2021

Using ipython 7.19.0 with Python 3.8.5 on ubuntu 20.04.

Tab completion causes crash with module subprocess.

The parso verison is 0.8.1 (makes no difference if downgraded to 0.7.1, same crash).

The jedi verison ist 0.18.0.

Using ipython --IPCompleter.use_jedi=False lets tab completion work for this module.

Using `ipython --IPComplete.debug

Traceback (most recent call last):
File "/home/xxx04/pyenv1/lib/python3.8/site-packages/IPython/terminal/ptutils.py", line 113, in get_completions
yield from self._get_completions(body, offset, cursor_position, self.ipy_completer)
File "/home/xxx04/pyenv1/lib/python3.8/site-packages/IPython/terminal/ptutils.py", line 129, in _get_completions
for c in completions:
File "/home/xxx04/pyenv1/lib/python3.8/site-packages/IPython/core/completer.py", line 438, in _deduplicate_completions
completions = list(completions)
File "/home/xxx04/pyenv1/lib/python3.8/site-packages/IPython/core/completer.py", line 1818, in completions
for c in self._completions(text, offset, _timeout=self.jedi_compute_type_timeout/1000):
File "/home/xxx04/pyenv1/lib/python3.8/site-packages/IPython/core/completer.py", line 1861, in _completions
matched_text, matches, matches_origin, jedi_matches = self._complete(
File "/home/xxx04/pyenv1/lib/python3.8/site-packages/IPython/core/completer.py", line 2029, in _complete
completions = self._jedi_matches(
File "/home/xxx04/pyenv1/lib/python3.8/site-packages/IPython/core/completer.py", line 1373, in _jedi_matches
interpreter = jedi.Interpreter(
File "/home/xxx04/pyenv1/lib/python3.8/site-packages/jedi/api/init.py", line 725, in init
super().init(code, environment=environment,
TypeError: init() got an unexpected keyword argument 'column'

@Carreau
Copy link
Member

Carreau commented Jan 30, 2021

#12793 fixes it.

@Carreau Carreau closed this as completed Jan 30, 2021
@MrMino MrMino modified the milestone: 7.20 Apr 1, 2021
@MrMino MrMino added this to the 7.20 milestone Apr 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants