-
Notifications
You must be signed in to change notification settings - Fork 260
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
Elpy seems partially incompatible with Emacs 25's 'native completion' feature #887
Comments
Hello, and thanks for the report. What's the value of |
No virtualenv in any case. The bug happens regardless of the value I give to python-shell-interpreter in my .emacs ( |
Could you copy the definition of the function print ('python.el: native completion setup loaded')
except:
raise
print ('python.el: native completion setup failed') i.e. add a |
Sorry, I don't think I explained this clearly. There is no error; the python repl buffer contains this after the warning is shown:
The reason the warning is shown seems to be that the |
There's nothing Elpy does here that should interfere with that code. I have no idea what's going on there. :-( |
I'll close this then, and I'll try to investigate it myself next time it pops up :) |
I receive the same warning as cpitclaudel running Emacs 25.1.50 (9.0) built with homebrew on my mac. |
I also have been getting this same warning, I ended up just setting I do have working tab-completion in python shell buffers with that setting with |
Looks like this is happening again on master :/ |
Interestingly, even setting |
Not much. This is a problem with python-mode in Emacs, not Elpy specifically. I suspect this is yet another problem with the newer ipython stuff. As a wild shot, could you add |
Hmm. I'm not using IPython (I use the regular CPython); besides, everything works fine in both |
But the output you showed above was from ipython? |
Indeed; that's what I guess I was testing out at the time. This happens with 2.7 and 3.5 as well. |
Could you copy the definition of the function print ('python.el: native completion setup loaded')
except:
raise
print ('python.el: native completion setup failed') i.e. add a |
@jorgenschaefer I'm confused. Didn't you ask me to do this before? :) I made the requested change, but there is no error to see:
The |
Yes I did, but that was with ipython which might have had different code paths :-) When trying to debug some weird behavior, it's confusing when the environment changes randomly. What does I'm still confused why anything that Elpy does would affect this. If you add |
I'll try this. I'll also try to debug this on my own a bit, because this is getting complex and annoying, and I don't think I'm being very helpful. Let me create a minimal test case, and see if that helps me; otherwise, I'll at least have stuff to report here :) |
I too am facing same problem as @cpitclaudel.
Even with |
I have a question. How can I |
Closing this: after a while I ended up opening an Emacs bug report, and was pointed to another, existing one. See https://debbugs.gnu.org/cgi/bugreport.cgi?bug=24401 Sorry for the confusion, and thanks for the help and the hard work on Elpy! |
Thank you for finding that upstream bug! That solves one of my headaches here :-D |
Hi @npostavs, There is only a line in the
BTW, where can I find the python code for testing that you mentioned? Thank you so much! |
Oh, huh. I guess it's all good then.
It's in python.el, |
I'm sorry to keep this going, I'm running Fedora 27, emacs 25.3.1, python 3.6.4, elpy 20180318.856 but I still see this issue. I have set python-shell-interpreter to "python3". |
What's the value of |
I have the same problem, but only with C-c C-c (that is, C-c C-p followed by C-c C-c works, but C-c C-c alone gives the error message). IOW, the problem happens when Python is started by the same function that sends the contents of the buffer (elpy-shell-send-region-or-buffer). |
If I try to run
Does elpy suppress/circumvent this? |
It does, yes. I think that's the source of the issue. (Btw, |
Hmm, the waiting loop in https://github.com/jorgenschaefer/elpy/blob/1.18.0/elpy-shell.el#L257 |
I don't think so, no. And it does look like the issue is related to that loop, at least on my machine. |
Still getting the 'readline' warning on Windows 7, using Emacs 25.3_1 release, which from what I read people were saying would fix this issue. I also tried starting with no init file (emacs -Q) to make sure it wasn't my .emacs. |
@saltycraig there is no fix on Windows, just https://debbugs.gnu.org/cgi/bugreport.cgi?bug=28580 |
Thank you @npostavs , this is what I ended up doing and just guarded it with a 'windows-nt' system-type detect, hopefully it really is suppressed on Emacs 26, as I did read several answers on threads that this was supposed to have been fixed at or around 25.1. |
I'm encountered this problem when running a conda-based python 2.7.14
What I have not been able to determine is why (run-python "python -i")
returns nil, but if you look in the Python process buffer, that The call to (elpy-shell-get-or-create-process 0.001) above waits just Side note: Not even sure this is relevant: I discovered I had package
evaluated to nil even though comint-prompt-regexp is non-nil. This M-x emacs-version returns:
lsb_release -r -i returns:
M-x elpy-config returns:
|
I solved the problem with |
@jojojames Thanks! You saved my days. Python 3.7 installed by brew works perfectly. |
I was having a similar error with no autocompletion and it was solved by downgrading ipython from 7.2.0 to 6.2.1. Just in case it helps anybody I am writing this here. |
I also have the same error. Given log, when I apply
|
This error everytime gets longer and longer: Python 3.9.1 (default, Jan 6 2021, 06:04:49)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.19.0 -- An enhanced Interactive Python. Type '?' for help.
In [1]: import codecs, os;__pyfile = codecs.open('''/var/folders/51/77zp4bqd4_53zn95hng9pt3h0000gn/T/pyoyHfVB''', encoding='''utf-8''');__code = __pyfile.read().encode('''utf-8''');__pyfile.close();os.remove('''/var/folders/51/77zp4bqd4_53zn95hng9pt3h0000gn/T/pyoyHfVB''');exec(compile(__code, '''/Users/max/code/binsearch.py''', 'exec'));;
>>> -1 15 7
>>> 7 15 11
>>> 11 15 13
>>> 13 15 14
15
In [2]: iimmppoorrtt ccooddeeccss,, ooss;;____ppyyffiillee == ccooddeeccss..ooppeenn((''''''//vvaarr//ffoollddeerrss//5511//7777zzpp44bbqqdd44__5533zznn9955hhnngg99pptt33hh00000000ggnn//TT//ppyyccBBiibbhhCC'''''',, eennccooddiinngg==''''''uuttff--88''''''));;____ccooddee == ____ppyyffiillee..rreeaadd(())..eennccooddee((''''''uuttff--88''''''));;____ppyyffiillee..cclloossee(());;ooss..rreemmoovvee((''''''//vvaarr//ffoollddeerrss//5511//7777zzpp44bbqqdd44__5533zznn9955hhnngg99pptt33hh00000000ggnn//TT//ppyyccBBiibbhhCC''''''));;eexxeecc((ccoommppiillee((____ccooddee,, ''''''//UUsseerrss//mmaaxx//ccooddee//bbiinnsseeaarrcchh..ppyy'''''',, ''eexxeecc''))));;;;
>>> -1 15 7
>>> 7 15 11
>>> 11 15 13
>>> 13 15 14
15
In [3]: iiimmmpppooorrrttt cccooodddeeecccsss,,, ooosss;;;______pppyyyfffiiillleee === cccooodddeeecccsss...ooopppeeennn((('''''''''///vvvaaarrr///fffooollldddeeerrrsss///555111///777777zzzppp444bbbqqqddd444___555333zzznnn999555hhhnnnggg999pppttt333hhh000000000000gggnnn///TTT///pppyyyPPPFFFPPPsssYYYuuu''''''''',,, eeennncccooodddiiinnnggg==='''''''''uuutttfff---888''''''''')));;;______cccooodddeee === ______pppyyyfffiiillleee...rrreeeaaaddd((()))...eeennncccooodddeee((('''''''''uuutttfff---888''''''''')));;;______pppyyyfffiiillleee...ccclllooossseee((()));;;ooosss...rrreeemmmooovvveee((('''''''''///vvvaaarrr///fffooollldddeeerrrsss///555111///777777zzzppp444bbbqqqddd444___555333zzznnn999555hhhnnnggg999pppttt333hhh000000000000gggnnn///TTT///pppyyyPPPFFFPPPsssYYYuuu''''''''')));;;eeexxxeeeccc(((cccooommmpppiiillleee(((______cccooodddeee,,, '''''''''///UUUssseeerrrsss///mmmaaaxxx///cccooodddeee///bbbiiinnnssseeeaaarrrccchhh...pppyyy''''''''',,, '''eeexxxeeeccc'''))))));;;;;;
>>> -1 15 7
>>> 7 15 11
>>> 11 15 13
>>> 13 15 14
15
In [4]: iiiimmmmppppoooorrrrtttt ccccooooddddeeeeccccssss,,,, oooossss;;;;________ppppyyyyffffiiiilllleeee ==== ccccooooddddeeeeccccssss....ooooppppeeeennnn((((''''''''''''////vvvvaaaarrrr////ffffoooollllddddeeeerrrrssss////55551111////77777777zzzzpppp4444bbbbqqqqdddd4444____55553333zzzznnnn99995555hhhhnnnngggg9999pppptttt3333hhhh0000000000000000ggggnnnn////TTTT////ppppyyyynnnnJJJJppppmmmmUUUUbbbb'''''''''''',,,, eeeennnnccccooooddddiiiinnnngggg====''''''''''''uuuuttttffff----8888''''''''''''))));;;;________ccccooooddddeeee ==== ________ppppyyyyffffiiiilllleeee....rrrreeeeaaaadddd(((())))....eeeennnnccccooooddddeeee((((''''''''''''uuuuttttffff----8888''''''''''''))));;;;________ppppyyyyffffiiiilllleeee....cccclllloooosssseeee(((())));;;;oooossss....rrrreeeemmmmoooovvvveeee((((''''''''''''////vvvvaaaarrrr////ffffoooollllddddeeeerrrrssss////55551111////77777777zzzzpppp4444bbbbqqqqdddd4444____55553333zzzznnnn99995555hhhhnnnngggg9999pppptttt3333hhhh0000000000000000ggggnnnn////TTTT////ppppyyyynnnnJJJJppppmmmmUUUUbbbb''''''''''''))));;;;eeeexxxxeeeecccc((((ccccoooommmmppppiiiilllleeee((((________ccccooooddddeeee,,,, ''''''''''''////UUUUsssseeeerrrrssss////mmmmaaaaxxxx////ccccooooddddeeee////bbbbiiiinnnnsssseeeeaaaarrrrcccchhhh....ppppyyyy'''''''''''',,,, ''''eeeexxxxeeeecccc''''))))))));;;;;;;;
>>> -1 15 7
>>> 7 15 11
>>> 11 15 13
>>> 13 15 14
15
In [5]: ``` |
Hi,
My OS is macOS BIg Sur (Version 11.1).
Any help is much appreciated, |
Looks like something problem I already saw on macos. I would try to address this error message:
and eventually report to python.el |
… Python shell This change creates a custom variable that allows MacOS users to decide whether to use a pipe or a pseudo-terminal (pty) to connect to the Python shell when `elpy-shell-get-or-create-process` is called. Before this commit, all Mac users are forced to use a pipe if the Python shell is created using this function, even though this is not necessary for all users. Some MacOS users experience issues connecting to the Python shell using a pty. One of major problems is the inability to send greater than 1024 characters to the shell at one time. These issues are caused by versions of Python that use the libedit version of Readline rather than the GNU version. By default, MacOS does not have GNU Readline installed, so it instead uses the libedit version for the versions of Python built into the OS. This may also be the case for other versions installed on a Mac if GNU Readline was not installed first. Using a pipe instead a pty alleviates all of these issues at the expense of creating a few smaller issues (e.g. sending an EOF signal into pdb causes the entire shell to exit). However, many MacOS users use versions of Python that are built with GNU Readline which means that the pty will work properly for them. It is unnecessary for them to connect via a pipe. Additionally, users may run into confusing behavior where the Python shell created via `run-python` (which uses a pty unless `process-connection-type` is set to nil) acts differently than one that is created via an Elpy command. Since a pipe connection to the Python shell works for users with and without versions of Python installed with GNU readline, this continues to be a sane default for Mac users. Creating this custom variable provides an easy, if somewhat difficult to discover, way to allow Mac users to decide which process type they want to use. In the future, it may be best to ask Mac users on their first usage of Elpy whether to use a pipe or pty. Alternatively, this could be automatically detected and a message could be sent to the Python interpreter to suggest that they change this variable's value. In addition to jorgenschaefer#1867, this change is also a fix for jorgenschaefer#1907 and jorgenschaefer#1948. Other related issues and commits include: jorgenschaefer#887, jorgenschaefer#1550, jorgenschaefer#1838, and jorgenschaefer#1671.
I have the same warning with elpy 1.35.0 in GNU Emacs 28.2 on MacOS 12.6.7. The warning occurs because I set python-shell-interpreter to 'ipython', which do not support readline. While So, I add Hope this helps. |
to surpress the warning reported here jorgenschaefer/elpy#887
In Emacs 25, when starting Python with C-c C-c, I get the following message:
On the other hand, if I disable elpy, start the repl, and re-enable it, everything works fine. Is elpy introducing a process filter for the python process, or something similar? That warning comes from this bit of
python.el
:which deep down relies on explicitly doing an
accept-process-output
, which sounds rather bad.In any case, I'm enclined to think that
python.el
is doing something wrong and elpy doing something right, but I'd love to get a bit of help pinpointing the bad interaction before opening an Emacs ticket, if we determine this to be the right course of action; especially since Emacs 25 is in a pretty deep freeze, so there's little chance that this will get fixed on the Emacs side before the release.Let me know if I can help :)
The text was updated successfully, but these errors were encountered: