Sublime Text 3 plugin Anaconda can't do multiple-line lint - python

I am using Sublime Text 3 (build 3047) using package control and the newest Anaconda plugin for python development. However I am facing a rather odd issue.
Using the default linter included in anaconda (not pylint), the plugin only displays the very first error it encounters.
So, if for example I am having errors in line 3, 5 and 10, only line number 3 will be highlighted. PEP8 is also currently disabled.
Is there any way to work around this problem and show all errors in a file at once?
Thank you.

There is no reason that you don't get any more errors linted in the buffer. The only thing that come to my mind is a possible incompatibility with any other ST3 plugin that you have installed as well.
You can do several things to try to figure out what can be wrong:
1) Take a look at the Sublime Text console to see if there are errors raised by Anaconda or other plugin
2) Take a look at your Anaconda JsonServer logs, you can fin them on: $HOME/Library/Caches/Jedi on Mac OS X, $HOME/.cache/jedi on GNU/Linux or %APP_DATA%\Jedi\Jedi on Windows.
You can get some support as well just joining the Anaconda mailing list at https://groups.google.com/forum/#!forum/anaconda-st3-plugin or just opening a new ticket in the project GitHub site: https://github.com/DamnWidget/anaconda/issues

Related

Installed Python 3.10.2 and now my Pip installs are not being found

Everything in my code was working perfectly fine up until I decided I wanted to utilize match-case in Python. Find out its only a thing in 3.10+, so I quickly install it and change it to be the interpreter in command palette.
Then I try to run my code same as before, and I'm not sure what changed but my Keyboard import is giving me 'Import "keyboard" could not be resolved'. Issues. The same issue was actually present as well with the 'from nis import match' module.
I installed keyboard initially using 'pip install keyboard' when running my 3.9 version, and legit everything was fine. This all started after I installed 3.10 (which I did from Pythons website yes); and I did add to PATH, but I dont think that would have any impact on my imports in VScode.
Confused as heck right now, please look at my screenshots for clearest explanation of what I'm facing.
Import could not be resolved
.
Module Not Found Error
.
pip3.10 show keyboard
.
My interpreter list from command palette
Any and all help appreciated, I'm extremely confused and think I've tried it all now
New Python versions use new site-packages folders. You need to reinstall everything. This is why poetry, pipenv, or requirements.txt are used
I think the linter-like extension/whatever Pylance is is the problem. Why? Because as we've tried, pip install keyboard and pip install --upgrade keyboard just confirm that the requirement is satisfied and the latest version of keyboard is already installed.
What I did was change Pylance's settings. Yes, it's not an actual error (with the code), but Pylance's problem. It just didn't see enough files in the keyboard package to satisfy its hunger, or Microsoft was just too lazy to pass more checks and update it accordingly, because however it happened, when I tried changing the setting to display an "error" at "missing imports" for fun, it didn't show errors or the default "warning" but "none", because I had run the file before I changed it back to display an error (maybe Pylance observed that when the file was run, there was no ModuleNotFoundError, and so stopped showing the warning).
I better shut now, because the setting I changed/overrode by adding it in settings.json is:
"python.analysis.diagnosticSeverityOverrides": {"reportMissingImports":"none"}
which is in:
{
...,
...,
...,
"python.analysis.diagnosticSeverityOverrides": {"reportMissingImports":"none"}
}
Here is a list of keys like "reportMissingImports" whose values you can change. These are the allowed values for the keys in python.analysis.diagnosticSeverityOverrides:
error (red squiggle)
warning (yellow squiggle)
information (blue squiggle)
none (disables the rule)
You would want to change their values only if you want to change their behaviour.
You can find settings.json by its path or by going to the settings GUI and clicking on any "Edit in settings.json" link-like button. You can also make settings.json open instead of the GUI by default.
Now, you won't see any more warnings when you import modules and can code without being anxious about the stupid warning.
Wow, So as it turns out, a solution I tried previously, to no avail is now working to solve this bizarre issue.
Simply put, I once again went to Command Palette (Ctrl+Shft+P), and looked through my interpreters I had to see what could be wrong.
Decided to click on the 'recommended' option I assumed I had been running this whole time. Turns out I was using this 'third' option as shown in the screenshot (the one not highlighted ofcourse); and it's the reason my module installs were being found on my machine, but not by the interpreter; as such giving me errors and not running the module for the program.
Simple error, but thanks to those who did help.

Python 3 Pyperclip Installed but Module not Found

I'm trying to copy some text to clipboad in my python program, so I've installed pyperclip via pip command via Windows command line interface, it says everything is successfully installed, not a problem. However, when I import the thing into my project, I get
from tkinter import *
from tkinter import ttk
import pyperclip
import binascii
#my code...
...
ModuleNotFoundError: No module named 'pyperclip'
So I was like *** that, maybe it's broken, I found a little library that does exactly the same, called "clipboard". Exactly the same installation procedure - from the command line. Same successful installation. Same ModuleNotFoundError. So clearly something wrong on my side, but I have no idea what it is, no idea where to look and what to do. I just want to be able to copy some text to clipboard. Multiplatform. That's it.
It's Python 3.8, Windows 10
pyperclip-1.8.0
pip-20.2.2
If I need to show you some logs or tell you something about my installation, please tell me what exactly to do and where to find information you may need. I'm good with instructions, but I don't have much (any) experience rummaging through logs and python installation folders.
Similar posts have slightly different problems, I didn't find any clear solution or hints that I could understand. No reply seemed like a solution to me.
Anyway, I would really appreciate any help from the community. Being unable to simply copy something to clipboard is killing me, especially since it's the only thing I can't implement. And it's just one function for one button to copy one short piece of text. It's like being stuck at 99% loading, when everything is done, and you just can't write the final line of code, haha.
Pycharm uses a virtualenv for pycharm projects. Navigate through:
Pycharm >> File >> Settings(or press Ctrl+Alt+S on win) >> Project:Name >> Project Interpreter >> Click on the plus(+) symbol above the scroll bar and type in pyperclip and press install package.
And this will install pyperclip for your Pycharm IDE. Since pycharm uses a virtual env for its projects you can change it in the project interpreter section as well, and then the pyperclip you installed from the cmd using pip, will be available to be used on that global version of python(now used by your Pycharm too).
If you still have any errors or doubts, do let me know :D
Cheers

How to change Python extension locale in VSCode?

I can't figure out how to install the Python extension in VSCode in another language, specifically - I want it to be in English, but instead it is being installed in the language of my operating system, which is Russian.
How can I install the Python extension in another language, or change the language to English?
The VSCode installation is in English. My OS is Windows 7.
I've tried googling it, no luck.
~~~
My "locale.json" config:
"locale":"en" // Changes will not take effect until VS Code has been
Ok, solved it.
Apparently the solution was to delete the "en" from "locale.json", type it back in.. restart VSCode.. And now the Python extension is in English.
"Truly" great design, Microsoft.
In detail the whole procedure is:
1 - Open VSCode
2 - press Ctrl+Shift+P
3 - type Configure Display Language -> hit Enter
4 - Delete the current locale("en" in my case), type the desired locale in
5 - Save the file
6 - Exit and re-open VSCode
7 - Enjoy the fixed language of the extension.
Following your instructions, below value worked for me in my "locale.json" config :
"locale":"en-US" // Changes will not take effect until VS Code has been restarted.

Theano + Windows + CUDA, work well using CMD, but encoutered error in eclipse (warning C4819)

I am working with `
Windows + CUDA 6.5 + VS2010 + Python2.7 + Theano.
My Python scripts works well when using command line, say:
python DDI_convnet.py
and I get results as:
However, when I run the same Python scripts in Eclipse, I get a lot of errors:
I think this is probably due to the difference of character Map of Eclipse and CMD, because the warning C4819 implies that a lot of .h files are not parsed correctly. How to fix it?
I find the answer myself. This is because, I installed Microsoft C++ for Python first, and then installed VS2010. The environment variable of Eclipse can only be updated after restarting windows.
However, after I restart windows, the problem changes, not warning C4819 any more, it began to report errors like "unresolved external ...", which is mainly due to some DLLs or libs are not included correctly by Eclipse.
Finally, I decide to change my IDE to PyCharm. Everything goes well so far.
I guess your system setting of 'system locale' is Chinese. Change it to English could possibly fix this problem.
https://stackoverflow.com/a/37871883/3148107

Importing mayavi from python creates pop-up with black background on UI (Mavericks/Canopy)

Image gallery: http://imgur.com/a/qZkTW#qGj7I0H
I just installed the new version of Canopy 1.3 from enthought. I opened up ipython, and I imported mayavi's mlab without issue. I then plotted a 3d sphere without issue using the following:
import mayavi
from mayavi import mlab
mlab.points3d(1,1,1)
mlab.show()
And I get what I would expect (See figure #2 in gallery). I can then open up the scene editor without issue (see figure #1 in gallery), but when I try to open any other traits editors for anything else, I get a weird black background with no text:
scalarscatter editor
This issue affects all other editors other than the scene editor. It has been reproduced after uninstalling canopy per the description on their website, restarting the computer and reinstalling canopy. It has persisted despite reinstallation with both 32- and 64-bit installations, and it also affects mayavi2 when run from the command line. I don't get this error when I open the Canopy.open an app and run everything from inside canopy, which is not really a viable option for my current workflow (I want to use ipython notebooks)
The only error I get via stderr seems to be unrelated:
Python[4434:d0f] CoreText performance note: Client called CTFontCreateWithName() using name ".Lucida Grande UI" and got font with PostScript name ".LucidaGrandeUI". For best performance, only use PostScript names when calling this API.
Python[4434:d0f] CoreText performance note: Set a breakpoint on CTFontLogSuboptimalRequest to debug.
I have updated all the canopy packages using the built-in installer. I'm using the built-in python for canopy. I never had any similar issues in the past with EPD, only since installing Canopy 1.3 on my computer.
I have searched the internet, and cannot find any other complaints of this issue. Please let me know if you have any ideas. I would really like to use the ipython notebook feature rather than opening Canopy.app every time.
Any help would be greatly appreciated!
Several notes:
1) This should do it:
ETS_TOOLKIT=qt4 ipython notebook --pylab qt
(These settings are default within the Canopy app).
2) Be sure that you are starting Canopy User Python from Terminal. sys.prefix in terminal should be the same as from within Canopy's (i)Python shell. For details, see https://support.enthought.com/entries/23646538-Make-Canopy-User-Python-be-your-default-Python
3) FWIW, IPython notebook is useable directly within Canopy (File / New / IPython Notebook), but admittedly the experience is still not as good as in a regular browser, especially on Mac. By Canopy 1.4 or 1.5 we hope that it will be, so you can have the best of both worlds.

Categories