ipython and jupyter notebooks not autocompleting(Fixed, Solution explained) - python

My Original Error:
I am new to python and am using anaconda 4.8.3. When I try to autocomplete after math. or sentence. nothing shows up. I have tried installing both pyreadline and jedi, but both are already installed with anaconda apparently. I have not disabled or enabled anything outside of the normal process of learning to use conda, like setting up shells and feeling out how to use ipython/notebooks.
The Fix that I was able to find:
%config Completer.use_jedi = False
Put this line of code literally anywhere, I recommend making a separate text file for this specifically if you are having this issue, and you just need to run it before coding. You will need to do this every time that you open up the notebook but aside from that it is an easy fix. If you know anyone with this problem please share this with them. So far I have not found anything else that works for me, so if there is a more permanent option I would love to see it.

For ipython version 7.19.0 add the following to your ipython config file. default is at where your other profile files are lurking at
.ipython/profile_default/ipython_config.py
c.Completer.use_jedi=False
Looks like some stability issues are still being worked on.
ref IPython core.completer

Related

Python note book autocomplete not working in VSCode with environment being CVE

I have done some research, but none of the solutions work for me and it seems that my situation is much worse than everybody else. Currently, my VSCode editor is just acting like a plain text editor for any ipynb files. For example, this is how my import block looks like:
Nothing has been highlighted, and I'm working with this for quite a long time and now I can't bear with this anymore. If this is not bad enough, then take a look at the following:
Literally, nothing happens. I think now the only help I get from VSCode is plain text auto-completion, but that is far from what anyone should have.
The configuration is pretty simple. I have the following kernels I can choose from:
And I'm mainly using anaconda3 for my kernel. Further, I only have
in my setting.json for python configuration.
As for extension, I have the standard python extension with python extension pack installed, which are the only two extensions I installed for python.
I'm really tired of working with plain text python code, if any information is needed, I can provide as much as I can.
-- Edit
It seems that the default language is not python, but CVE. Futhermore, I can't find the proper language to choose. All the language options are listed below.
The error happened because of the extension Dependency Analytics. Please uninstall it and reload window.
Reference: jupyter conflict with Dependency Analytics.
Click here and select Python.
CVE seems to be the default language for notebooks for some reason. Please check the settings.

How to prevent the repetition of object name for Python using autocompletion in VSCode?

I am using VSCode for writing Python code in a Jupyter Notebook. The relevant extensions installed are Python, Pylance and Jupyter. The problem occurs when I try to use tab to autocomplete method names for any object. For example, if the suggestion box looks like this:
and I press Tab to accept the suggestion, the object name database is repeated i.e the code looks like dataset.dataset.as_numpy_iterator instead of dataset.as_numpy_iterator. How can I remove this object name duplication? Thanks!
After wasting a lot of time searching for a fix, I tried using the latest Insider's build (instead of the stable build) of VSCode and surprise surprise - it did not have this issue. Moreover, even in the stable build, it occurs only in Jupyter Notebooks and not in standalone .py files. I am posting this as an answer so that other people don't have to waste more time on this!
It looks like provided by some extension you have installed. Such as Tabnine AI, Kite and so on. But I can't reproduce it on both of them.
I can't get to know which extension provides it in your picture, it looks like was cut off in your picture. But it does not provide by the Python extension.
I bumped into the same issue. Simply disabling and re-enabling the Jupyter Keymap extension solved my problem.
Judging from the lack of related search results, this issue seems to occur only under some rare circumstance...

Why aren't my imports for Python working in VSCode?

First of all, I am new to both Python as well as the world of VSCode (recently moved over from Atom). I will also say that I am using an Early 2014 MacBook Air running macOS Catalina. I really do love VSCode! It's amazing in many ways, but this... this is just too unclear.
Okay, I have tried literally almost everything and I don't understand why my imports won't work! I have looked at the documentation on the issue on Github (I will say I may have something with the directory wrong there, referring to the docs). I have tried the "python.autoComplete.extraPaths": [], thing. I have tried changing my (virtual) environment and, of course, setting up a new one myself. I have tried setting "python.languageServer:" to Jedi and back to Microsoft. I can't even find the "python.jediEnabled: false" comment that everybody is telling me to uncomment.
Yet, my imports are still "unresolved (Microsoft language server)" or "not found (Terminal)" or "unable to be imported (Pylint)". It just makes me so angry and I don't understand what I've done wrong!
I've seen modules like pygame and requests work just fine on VSCode for many others (YouTube), yet mine has yet to work.
Can someone please tell me the secret that I don't apparently know? Thanks.
Update Post: My Virtual Environment is using my System Python rather than my Venv's Python
Thank you for everyone who has helped (so far). I am getting a lot closer to solving this. ^-^
They had removed "python.jediEnabled" setting instead of "python.languageServer", you can refer to here.
Maybe you haven't installed the package which you want to import, because you had used the wrong 'pip'. When you select the right environment, you need to activate it(Ctrl+Shift+`), otherwise, you'd use the wrong 'pip'. You can type 'pip --version' to check which 'pip' you are using. Then you can try to install the package you want to import.

Spyder/Anaconda not installed properly. How do I find it?

I have tried installing anaconda multiple times on my Windows’s 10 laptop however, when I look for it after installation in the start menu it isn’t there?
Neither is spyder? I tried downloading win python but that didn’t work either. Any help would be much appreciated. Thankyou.
For a standard installation you should have this folder
C:\Users\<USERNAME>\.anaconda\navigator\scripts
If so, start anaconda-navigator-app.bat and see if it works.
P.S.: I really can't recommend Spyder anymore, since it has multiple problems especially if you might work with Qt. VS Code seems to be a better alternative.

Python3/MacOSX integration into pycharm

I have had trouble setting up the pycharm ide on my macosx10.7 with python3..
I have scoured every resource available and tried hundreds of approaches, at this point I must accept my incompetence and seek help via this channel.
In my research, I notice a lack of ground-up explanations on python integration into macosx and how to configure pycharm to import modules, run code within the editor, etc. If i ever solve this I will make a very detailed tutorial.
I have imported python3 successfully, it looks like it is linked appropriately from /sys/lib/frameworks to /usr/lib ...etc -- version control is working just fine.
I think my issue is either in setting environmental variables (tried the program to fix this and tried macports) and in the script needed to execute. it will catch errors throughout but final product does not run in python and returns printout of :
/Library/Frameworks/Python.framework/Versions/3.2/bin/python3.2 /Users/anon/Desktop/pythonpractice/Py_Ex/classes.py
Process finished with exit code 0
i really need to get this configuration sound for my python programming class. please help (I've been through every line of pycharm website) .. preferably is there a way to map it via terminal? thanks for anyone who took the time to read this.
Summary of the discussion above:
Python 3.2.2 installation was broken on this Mac, installing ActiveState Python 3.2.2 from scratch and configuring it in PyCharm has fixed the problem.
Python path to be used in PyCharm settings: /Library/Frameworks/Python.framework/Versions/3.2/bin/python3
Incompatible third-party plug-ins may break PyCharm, uninstall/disable them in Preferences | Plugins.
Ensure the latest PyCharm version is installed.
User's code depends on the graphics.py module which was not in the project or in the PYTHONPATH. Putting it into the project has solved the problem.
Most likely the wrong Run/Debug configuration was used in PyCharm, the easiest way to run or debug such scripts is by using the editor context menu Run and Debug actions. PyCharm creates the configuration automatically and debugging works fine as shown of the screenshot:
If one wants to configure and debug it, he can use the code.zip file to get started.
Sorry for the comments mess above, but it was not possible to move it into chat as user had only 1 reputation point, hence not able to use the chat feature of StackOverflow.

Categories