Spyder IDE environment in Python - python

I am currently using Spyder and have been for a long time, however I downloaded anaconda recently and started using Spyder for Python 3.5 which gives me several problems.
Whenever I run a script in the Python Console, I have to run it twice and then when I am finished running it and want to run a new I have to kill the current process and reload it.
I am currently using some scripts with threading, but that never used to be a problem before I upgraded, anyone have similar experiences and know how to fix it?

(Spyder developer here) We're aware of these problems in the Python console, but unfortunately we don't know how to fix them.
Please use the IPython console instead because the Python console is going to be removed in Spyder 3.2.

I observe some problems of users about Spyder Console.Effective example for solution;
via Anaconda prompt:
conda create -n spyder-env spyder=4
conda env list
conda activate speder-env
spyder

Related

"r.start is not a function" Fermipy Conda Error

I've been using the Fermipy conda environment on Python 2.7.14 64-bit on macOS Catalina 10.15.5 and overnight received the error "r.start is not a function" when trying to connect to the Jyputer server through Vscode (if I try on Jupyter Notebook/Lab the server instantly dies). I had a bunch of clutter on my system so I ended up formatting it and reinstalling all the dependencies needed (such as Conda through Homebrew, Fermitools through Conda and Fermipy through the install script on their site), but still get the same error, although I was previously running python scripts just fine. It gives me no other error or output, if it did I would attach it here. This is the error I get.
Edit: I get the same error using any version of Python 2.7.XX and not for python 3.7.XX.
As answered here, https://github.com/microsoft/vscode-python/issues/12355#issuecomment-652515770
VSCode changed how it launches jupyter kernels, and the new method is incompatible with python 2.7.
Add this line to your VSCode settings.json file and restart.
"python.experiments.optOutFrom": ["LocalZMQKernel - experiment"]
I got the same message. (r.start is not a function.) I had an old uninstalled version of anaconda on the computer which had left behind a folder containing its python version. Jupyter was supposed to be running from new venv after setting both python and jupyter path in vscode. I fully deleted remaining files from old anaconda install - message went away and notebook ran fine. Maybe try getting rid of all conda stuff and pip install jupyter and anything else you need.

Problem running Spyder 4.0.0+ on a New Environments on Anaconda

Windows 10 - 64x.
I am new to Python as well as to Anaconda. I downloaded what I believe is the latest version of Anaconda from the official webpage, and I wanted to create a new environment for a new project for which I need Spyder.
Every time I try to launch Spyder, the program doesn't respond and I get the following error:
[16748:16200:0331/091204.775:ERROR:broker_win.cc(59)] Error reading broker pipe: The pipe has been ended. (0x6D)[3424:6876:0331/091204.775:ERROR:broker_win.cc(59)] Error reading broker pipe: The pipe has been ended. (0x6D)
Please note that in the "base" environment i managed to make Spyder work just using the command:
conda update anaconda
after which version 4.0.1 of Spyder is running smoothly. Still, I cannot make the same version working on any other new environment I create. Neither the following Spyder versions work.
Please help!

Change Python:Run Python File in Terminal command in Visual Studio Code

I am using an anaconda environment in VS code when suddenly the Run Python File in Terminal command bound to the green play-button in the top right corner stopped working. It used to input: python_path file_path/file.py into the terminal and it worked perfectly fine.
But after running my code in the anaconda prompt program it has now changed to:
& conda run -n env_name python file_path/file.py and now I get a ModuleNotFoundError, that I don't have cv2 installed, which I do.
I can still run the code if I simply input: python file_path/file.py. My question is if it is possible to change the command that is bound to Run Python File in Terminal. I could not find a solution to this in a couple hours of searching. Thanks in advance.
One solution I found was to reinstall the older python plugin and the "conda run -n" command would not be used at runtime.
Reinstallation method, Extension --> Python--manage--> install another version
You're most likely running into a bug in conda 4.8. You can either downgrade the extension until a point release comes out with a fix or simply wait for a fix (hopefully Monday).

Change the interpreter in Pycharm but it doesn't work

I changed the interpreter from python3.7 to python2.7 in Pycharm. But after I did this process, the interpreter showed success but actually, when I ran the code it still was running with python 3.7.
The interpreters are set from the anaconda.
This image shows that I have changed the external library to Python 2.7 but when I test the type of python in the terminal, it still shows in Python3.7.
I really struggle about this problem, hope someone can help me.
I believe you face a known PyCharm bug: PY-23417. IDE fails to activate the conda environment in the terminal so you end up running Python 2 instead of 3 by python executable as it uses the first interpreter in PATH.
Try PyCharm 2019.1 EAP build. The problem should be resolved there.

Anaconda on Windows 10: iPython and Spyder fail to start in Python3 environment

I'm using Windows 10 and I have Anaconda with Python 2 installed, so my root environment is Python 2. I created an additional Python 3 environment and among other packages installed iPython and Spyder into it. I used the Anaconda Navigator to install the packages.
I can activate and deactivate the environment using Windows CMD just fine. After activating the Python 3 environment in the CMD the ipython command typed into the same CMD starts up Python 3.6.1.
The Anaconda Startmenu folder does contain shortcuts to iPython and Spyder both for Python 2 and Python 3 now. I can use those to start both for Python 2 as before, but the Python 3 versions won't start. And there is no error message or crash or anything.
When clicking on the Python 3 iPython shortcut a command prompt pops up for a split second and immediatly closes again. Spyder does not even open a command prompt, it does absolutely nothing, I presume it's because iPython fails. Checking the task manager shows that there is no Python running in the background at all, so it really does not start.
Now I know that iPython 3 itself is not broken because I can start it from within CMD after switching environments, nonetheless I deinstalled and reinstalled them both, no change.
I then went into the shortcut to get the exact command it was executing to write a small batch file with a pause command to see if anything gets displayed when iPython fails. Doing a right-click on the shortcut and executing "open file location" leads me to python.exe in the Python 3 environment base folder, and executing that works fine of course.
So now I'm stumped since I have no leads to solve or even analyze the problem properly, over the entire course of action not a single error message ever appeared anywhere.
Any hints and suggestions are appreciated.
EDIT:
The target of the Python 3 shortcut in the properties looks like this:
C:\Users\My.Name\AppData\Local\Continuum\Anaconda2\envs\Python3\python.exe C:\Users\My.Name\AppData\Local\Continuum\Anaconda2\cwp.py C:\Users\My.Name\AppData\Local\Continuum\Anaconda2\envs\Python3 "C:/Users/My.Name/AppData/Loca
The working shortcut to Python 2 looks pretty much the same:
C:\Users\My.Name\AppData\Local\Continuum\Anaconda2\python.exe C:\Users\My.Name\AppData\Local\Continuum\Anaconda2\cwp.py C:\Users\My.Name\AppData\Local\Continuum\Anaconda2 "C:/Users/My.Name/AppData/Local/Continuum/Anaconda2/pyth
I found the problem.
As it turns out the module menuinst wasn't automatically installed into the new environment so I had to manually install it. Now everything works.

Categories