Anaconda after update: Command propmpt responding very slowly and IPython not loading - python

I ran the conda update --all command, but unfortunately something went wrong with the update process and windows crashed. Now if I try to redo the update the terminal is responding very slowly, to the point where installing the update is impossible. Even worse I ran conda update ipython, which also executed very slowly and now the ipython console no longer works reporting: ImportError: No module named 'IPython.kernel.zmq.kernelapp'.
I tried to update anaconda as I recived the error: line magic function %pyomo not found, when executing one of the basic examples using pyomo.
What should be done to restore anaconda? I am using the Spyder IDE.

Related

Spyder 5.3.2 and 5.3.3 silently crash on startup

I'm using pip rather than conda to manage Spyder and all my python packages. I've found that in the last couple of spyder releases, trying to run spyder in the console results in my mouse cursor changing to the "working" cursor for a split second, then the command executes with no output and I'm on to the next line in the console. The Spyder window never appears. Version 5.3.1 works as expected, however. I've tried updating all my packages through pip but haven't had any success. Does anyone know what I can do to further troubleshoot this? I'm at a loss, since I'm not even getting an error message.

"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.

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).

Jupyter notebook not running code. Stuck on In [*]

My code was running fine before I did not change anything and I ran it again. Now it doesn't return anything not even an error. It is just stuck on "In [*]".
This means that Jupyter is still running the kernel. It is possible that you are running an infinite loop within the kernel and that is why it can't complete the execution.
Try manually stopping the kernel by pressing the stop button at the top. If that doesn't work, interrupt it and restart it by going to the "Kernel" menu. This should disconnect it.
Otherwise, I would recommend closing and reopening the notebook. The problem may also be with your code.
updating ipykernel did it for me. it seems arch linux's ipykernel package had been outdated for some time
just do pip install --upgrade ipykernel
reference here: github solution
I have installed jupyter with command pip3 install jupyter and have the same problem. when instead I used the command pip3 install jupyter ipython the problem was fixed.
pip install ipykernel --upgrade
https://github.com/jupyter/notebook/issues/1133
I had the same problem and not any of the above mentioned solutions worked.
Until I updated conda packages:
conda update conda
conda update anaconda
and ... Voila! It all works!
The answers that state that your kernel is still executing the code in the cell are correct. You can see that by the small circle in the top right. If it is filled with a black/grey color, then it means it is still running.
I just want to add that I experienced a problem in JupyterHub where the code in the cell would just not execute. I stopped and restarted the kernel, shutdown and reloaded the notebook, but it still did not run.
What worked for me was literally copy pasting the same code to a new cell and deleting the old one. It then ran from the new cell.
This is mean your program is still running in background, you need to click shutdown (Shown in attached Image).
*** Shutdown the Running cell and again run your program.
I fixed this issue
just only type this command: jupyter notebook --no-browser
It will show you the path then copy and paste on Jupyter Notebook browser
The code will be executed in IPython Notebook Python 3
Usually, stopping and restarting that particular cell fixes this issue.
I had the same issue now:
Solved it by:
Just reloading the local weblink in which the Python is running
http://localhost:8888/notebooks/sec%201/Untitled.ipynb
Upgrading ipykernel, notebook and then downgrading tornado to 4.2.0 solved the issue for me.
My current package versions related to jupyter:
jupyter==1.0.0
jupyter-client==5.2.2
jupyter-console==6.1.0
jupyter-core==4.4.0
jupyterlab==2.2.5
jupyterlab-server==1.2.0
ipykernel==5.3.4
notebook==5.2.2
tornado==4.2
pyparsing==2.4.2
ipython==5.5.0
ipython-genutils==0.2.0
prompt-toolkit==1.0.15
Github
I had the same issue. I found that ipython must be running for jupyter notebook to execute.
Do the following:
Go to the folder where you have your ipython notebook(.ipynb)
Press shift and right click on the empty space then select "open command window here". This will open a command prompt window.
Type ipython. This will start ipython.
Open another command prompt window and open jupyter notebook.
Open your file again and go to cell>>>run cell.
This should work. It worked for me. Cheers!
This is because when we run a loop until it's termination the Kernel is in busy state and so IN [*] is shown up. Since Kernel is busy and if we just leave that cell to execute completely and switch to another cell to run, the corresponding cell will get busy and so again for that cell IN[*] is shown.
In that case you just need to restart your jupyter notebook and all is fine then.
But be sure that your loop will terminate this time or else again this error will turn up.
I have uninstalled jupyter, notebook and ipython, and installed jupyterlab. It is working for now (with just a few libraries installed and Python 3.6.8.
Something to discard: Uninstalling Python 3.7 completely with his libraries and reverting to 3.6 doesn't fix it, although it improves it, it works intermittently now (but once sth doesn't work properly, things start to get worse and worse, so I did the above).
Check the output on the server environment from which jupyter notebook was launched if you can. You'll probably find error messages and print() results.
Anaconda environments might cause this. I had to deactivate all conda environments and launch the notebook from root.
conda deactivate
To do so, cd into the directory in your terminal, run conda deactivate until there is nothing in the parantheses that precede your computer name and username. In the example below, I had to run conda deactivate twice.
(base) Your-Computer:~ Your-Username$ conda deactivate
(/Users/jw1/opt/anaconda3) Your-Computer:~ Your-Username$ conda deactivate
Your-Computer:~ Your-Username$ jupyter notebook
Then I was able to run jupyter notebook, and the code ran as expected.
I have also faced this problem number of times. I simply click the small square button (interrupt the kernel) beside Run button and click on Restart the kernel(with dialog) button (just beside square box) to run my program when struck on in [*].
The reason why it is happening is you are still talking to the same kernel instance in the second run, the variables from first run still exist and haven't been cleared.
This can be solved by adding this command before each run
%reset -f

Spyder IDE environment in 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

Categories