Spyder on MacOS. Typing is very laggy - python

I am using Spyder with Anaconda on macOS. I have already updated Anaconda and Spyder to version 4.2.0 (4.2.1 was not found). The problem is now, that if I am typing in Spyder it takes about one second until the letters appear, which is very annoying. Is there somebody who also has this problem? Or does somebody have a suggestion on what might be the problem?

Had the same exact issue with Spyder 5.0.0, on Catalina; editor being very laggy (the console was fine).
Solution worked for me: Disable Kite!
From the top menus:
Python > Preferences... > Completion and linting,
Deselect any option that calls Kite:
Notify me when Kite can provide missing completions (but is unavailable!)
Enable Kite provider
PS: Tried pyqt solutions with no success (this now generates warnings in the terminal every time I open Spyder).

(Spyder maintainer here) There are two main causes of this problem:
We had several memory leakages and other serious inefficiencies that were causing a lot of sluggishness in the editor. Most of them are fixed in our 5.1.5 version, released in September 2021. Other improvements will come in 5.2.0, to be released in November 2021.
If you're still experiencing this problem with those versions, it could be because you're in Big Sur. The only way to get a fix for that is by using our mac OS installer

I'd like to chime in and say I'm getting this on Catalina (not Big Sur).
Using Spyder 5.0.5 seemed to fix it.
-- Edit
No it didn't. I'm on Catalina and it's still laggy as hell. Using v5.0.5

read: https://github.com/spyder-ide/spyder/issues/14218
One solution suggests downgrading pyqt and pyqtwebengine.
vancromy commented on 17 Nov 2020 I just pip installed pyqt==5.12 and pyqtwebengine=5.12 in my base conda environment and noticed a
substantial decrease in the latency! Still a bit of latency but not as
pronounced as before. :)
Note: Please don't use this solution if you're using Anaconda because it could break your environments.

tools -> reset spyder to factory defaults
and it worked

Two years later, and this is still an issue. Sypder recommends installing from their DMG, which resolves the issue.
What I did was create my virtual environment and instead of installing Spyder there, I installed:
conda install spyder-kernels=2.2
v2.2 is important because otherwise there may be conflicts and it won't install.
Then, deactivate your environment and launch Spyder from the conda base environment.
In the bottom right of Spyder is text with the environment name. For example, mine says: conda:base(Python:3.9.12)
Click that and then "Change default environment in Preferences"
In the Preferences frame, under Python Interpreter, select Use the Following Python Interpreter
From the drop down menu, select the one with the name of your environment. It should look something like:
/Users/YourComputerName/opt/anaconda3/envs/environmentname/bin/python
Click Apply, then okay.

Spyder works flawlessly when you install its standalone version and not from the anaconda distribution (not sure why anaconda is still not fixing it).
If you want to make use of conda virtual environment with Spyder standalone IDE, see the solution detailed below. It worked for me very well.
https://medium.com/#apremgeorge/using-conda-python-environments-with-spyder-ide-and-jupyter-notebooks-in-windows-4e0a905aaac5
# install Anaconda and create a new conda environment
conda create -n env_name python=3.7.4
# activate environment
conda activate env_name
conda install package_name
# get path of the environment
python -c “import sys; print(sys.executable)”
# install spyder-kernels (version >= 2.3.0 and <= 2.4.0)
pip install spyder-kernels
# copy the env path in Spyder IDE and restart Spyder IDE
Spyder -> preferences -> python interpreter -> use the following Python interpreter -> choose from the drop-down list or copy the env path

Experienced this issue on MacOS Mojave via Anaconda. Upgrading both Anaconda (v4.10.3) and Spyder (v5.0.5) didn't help. Ended up following this guide, which suggested upgrading PyQt5 and PyQtWebEngine modules. A warning was produced upon upgrading:
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
spyder 5.0.5 requires pyqtwebengine<5.13, which is not installed.
spyder 5.0.5 requires pyqt5<5.13, but you have pyqt5 5.15.4 which is incompatible.
Despite the incompatibility warning, I no longer experience latency.
Note: Please don't use this solution if you're using Anaconda because it could break your environments.

Related

Unable to install PsychoPy module in Python

I tried to install the psychopy module in python, using Anaconda Prompt and python -m pip install PsychoPy and it gave me error messages I have no idea how to interpret:
enter image description here
followed by a bunch of white text mostly starting with "Requirement already satisfied: [...]" and two other red walls of text "ERROR: Command errored out with exit status 1: [...]" (I can also post pictures of them, if needed)
Additional Info:
I use a Windows 10, Version 21H2, x64-based System
For Python (3.8.8) I use Sypder
Anaconda Navigator is Version 2.0.3
I also have the PsychoPy Standalone (Coder, Runner & Builder) installed (version 2022.2.0)
Any and all help is appreciated!!
Please also tell me if I did this question-thing right, this is my first time posting here and I don't know the etiquette yet
This is not for sure.
Maybe you already solve this problem.
I have experienced some problem of psychopy.
So, I hope this is helpful for you and many other researchers with psychopy.
First, update conda will solve many kind of problems.
'''
conda update --all
'''
Second, In anaconda environment using 'conda' command is recommendation.
In anaconda environment use(except for impossible) 'conda' command is recommended. Generally, mixed use of 'pip' and 'conda' command is not matter. BUT, SOMETIMES, this could occur minor error like this question.
Third, use anaconda virtual environment.
Anaconda provide virtual environment. Initially virtual environment looks confused but, this could safe and secured develop your experiment program.
Lastly, this probelem.
In the middle of your error message. "requires-python>=3.6" <- maybe this means your environment is not appropriate the environment. but your environment is 3.8.8.
For now this is just hypothesis. I think your environment have more than 2 of python could be installed. So, delete all python and reinstall the anaconda and use virtual environment could be safe.
I haven't used this community for a long time so I don't know the etiquette. If I was rude, thank you for your understanding.

Desktop VSCode vs Anaconda VSCode?

I have vscode installed on my computer already. I noticed a while back that it is now included with the anaconda distribution. Is there any benefit to using the vscode included with anaconda vs the vscode i already have installed?
FYI im a python developer if that makes a difference.
As far as I know, VS Code is an independent (in terms of your question!) software which is just shipped with Anaconda. It does not matter if you install them separately or first install Anaconda and install VS Code from there. Anaconda add some extensions by default to VS Code, but you can always install them yourself.
What you can do is updating your VS Code when new versions are released (see https://code.visualstudio.com/)
Also, VS Code is a code editor and one might use it with Python installed from for instance python.org or Anaconda distribution. You can tell VS Code what is your Python path in the settings.
And finally you may want to read this (quoted form https://docs.anaconda.com/anaconda/user-guide/tasks/integration/vscode/):
VS Code is free for both private and commercial use, runs on Windows, macOS and Linux, and includes support for linting, debugging, task running, version control and Git integration, IntelliSense code completion and conda environments.
VS Code is openly extensible and many extensions are available. When you install VS Code with Anaconda it comes with the Python Extension for Visual Studio Code for editing Python code, and the RedHat YAML extension for editing YAML files such as conda configuration files.
When installing Anaconda, you may select whether to install VS Code. VS Code is not offered during silent mode Anaconda installs, but you can easily install VS Code after the Anaconda install completes.

Handling folds in Spyder

I am coming from a VScode background , and for my recent project (on Deep Learning) I am having to manage huge code files in Spyder (Version 3), and I am not seeing any option of code folding?
I am not willing to switch to another IDE , as Spyder is very productive for my project.
Please suggest any hack to do it , if it is not there in the Spyder codebase.
(Spyder maintainer here) You can install the first beta of Spyder 4 to get code folding.
If you use Anaconda, you need to use the following commands:
conda update anaconda
conda update spyder
or if you use pip, then you need to run
pip install -U --pre spyder
This beta is quite stable and it has been tested for more than a year.
Spyder 4.0.1 is released, which supports code folding.
If you are using anaconda, use
conda update --all
to get it.
If you want to fold more that just a loop or a function, you can also try:
#%%
Code that you want to fold
#%%

Anaconda update for Spyder has failed

Windows 10, 64 bit Anaconda 4.2, Python 3.5
I opened Spyder today to do some work. (so much for that idea, several hours later)
Spyder gave notice that there was new (3.1) version. I was on 3.0.2
So, I tried updating
conda update spyder
but it told me that it needed to DOWNGRADE it because of dependencies (I think, I wasn't taking notes at the time - so much for optimism)
Then I tried to update conda but that made things worse at this point, Spyder wouldn't start at all.
So, I uninstalled everything. At least, I think I did.
I went through Windows Programs and looked for anything that looked like it might be part of Anaconda, python, or Spyder.
I tried reinstalling Anaconda.
I got the 3 error messages about menus, path, and directories (there's a bunch of tickets on those). My path is short (800 characters or so) and my user name is in English.
I uninstalled and tried again.
Same results.
I created and ran the Fix.bat
"C:\My_Stuff\Program_Files\Anaconda3\pythonw.exe" -E -s "C:\My_Stuff\Program_Files\Anaconda3\Lib\_nsis.py" addpath
"C:\My_Stuff\Program_Files\Anaconda3\pythonw.exe" -E -s "C:\My_Stuff\Program_Files\Anaconda3\Lib\_nsis.py" mkdirs
"C:\My_Stuff\Program_Files\Anaconda3\pythonw.exe" -E -s "C:\My_Stuff\Program_Files\Anaconda3\Lib\_nsis.py" mkmenus
and that at least gave me my menus.
From a command prompt (either Anaconda or Windows),
conda list
shows no packages.
Spyder and Anaconda Navigator do not start ("This application failed to start because it could not find or load the Qt platform plugin "windows"
in "".)
Typing python from a command prompt (either one) appears to work and references Anaconda 4.2.0
I'm going around in circles.
Any help appreciated.
Craig
I had posted this on Github too, as I ran into a larger problem while trying to get my system back.
The last comment from that thread (https://github.com/conda/conda/issues/4369) is repeated here:
I have, I believe, successfully installed Anaconda 4.2 64bit Python 3.5 version
I uninstalled the software again using the Windows 10 uninstall from Programs and Features.
I manually removed the Anaconda paths from the user PATH variable.
I manually removed the Anaconda folder from the Startup menu.
I manually removed selected references to Anaconda in the registry.
(I did not see the Anaconda clean program until later - https://docs.continuum.io/anaconda/install)
I rebooted.
I installed from the exe I had downloaded last year (4.2)
This time, I installed for all users, not just me.
Testing
`conda list
returns many packages. Yeah!
Calling python from a command prompt works too.
Spyder starts and remember my previous project, so that is nice too.
I think I can work again.
I may need to upgrade some packages, so hopefully that will go well too.
Craig

Anaconda Spyder Qt library error on launch

When launching Spyder from the Anaconda python installation on Linux Mint 13 I get the following error:
Cannot mix incompatible Qt library (version 0x40801) with this library (version 0x40805)
Aborted
$PATH is
/home/ron/anaconda/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
Has anyone found a work around?
Anaconda web-site indicates that Spyder may not launch correctly on Linux machines.
http://docs.continuum.io/anaconda/
*** Resolved
I am a little sheepish. Discovered that I installed Anaconda as sudo. Reinstalled as indicated in documentation and everything works fine. Thanks everyone for the help.
I use anaconda 1.8 on kubuntu alpha. It uses qt 4.8.5. I can see it with
find $ANACONDA/lib -name '*.4.8.5'
My system qt libs is 4.8.6. I can see it with
find /usr/lib -name "*so.4.8.6"
If Your system qt version is 4.8.5, and anaconda is 4.8.1 -- maybe You can just update anaconda? Try to run
conda update conda
conda update anaconda
Edit
It seems that the problem is spyder picking up Your system libraries. I tried to sheild the libs using evnironment variables LD_LIBRARY_PATH and various qt-related. But nothing works. However simple copying system libs to $ANACONDA/lib solves the problem.
Go to $ANACONDA/lib and move all *.4.8* files to another dir. Then go to /usr/lib/x86_64-linux-gnu (are You using 64 bit?) and copy all *.4.8* to $ANACONDA/lib. That's it: run spyder!
The qtlibs are usually stored as files and links: for example if there's a libQtGui.so.4.8.6 file then there's also a symbolic link libQtGui.so.4.8. You have to copy/move links too.
Edit 2:
There's a suggestion to
unset QT_PLUGIN_PATH
I tried to set it to nothing export QT_PLUGIN_PATH=, but didn't try to unset it.
(Spyder dev here) Just for the record, this is a know bug in Anaconda that hopefully will be fixed in its next version (to be released in October/2014).
For me, the best solution was (inspired by #Adobe's answer) to go to the directory in which Anaconda was installed, then the subdirectory lib and to move all the files libQt* out of the way (I moved them to a temporary subdirectory I created for the purpose). Anaconda will now pick up the system libraries. I expect there will be a problem when I update Anaconda and it installs new Qt libraries, but that's for later.
My version is conda 3.9.1 with python 3.4.3 and qt 4.8.5, installed on Debian testing (current as of today) with libqtcore4 version 4:4.8.6+git64-g5dc8b2b+dfsg-3; the architecture is amd64.
Unsetting QT_PLUGIN_PATH and/or setting it to empty did work in the first instance, in that it allowed me to start spyder, but it has some disadvantages. Most importantly, whenever I tried to plot something using matplotlib and inline graphics, I got the error message "it seems the kernel died unexpectedly" instead of the plot I wanted.

Categories