I've been using Juptyer Notebook for more than a year now with python3 and I recently saw through the Anaconda Navigator that an update to the 5.7.0 version was available. I installed it but the first Notebook that I tried to launch wouldn't work : I run the most simple expressions such as:
test = [1,2,3]
print(len(test))
It keeps buffering and nothing comes out of this. Additionally, when I try to define a function, the font doesn't become green and bold like always.
Then I tried to go back to the older version, and that didn't work too. Now I'm back with the up-to-date version but still doesn't work.
I'm on a Windows machine and I don't know very much about source code or precise things to look for in this case.
Could you please follow the below steps and share the feedback. It seems that new update installed in a different path.
Step 1:- Get an Anaconda command prompt and run jupyter notebook in it, It will probably won't work, but you could get a detail error message saying what's failing.
Step 2:- After your anaconda update, if that's left over from the older version of Anaconda. The shortcut properties might tell you what it's trying to call - there may be a wrong path to Anaconda or something wrong, so you can go to anaconda desktop shortcut, then right click on it and check the properties. And also run the %appdata% command in windows 'Run' and check the installed anaconda app data directory.
Stop 3:- If the shortcut was the issue. You can manually change the "Shortcut target" (in windows) to the following
Eg: C:\Users\'yourusername'\AppData\Local\Continuum\Anaconda2\Scripts\jupyter-notebook.exe
Related
I want to be able to have a working jupyter notebook working for VS code out of the box, with minimal work on my side.
I tried opening a jupyter notebook. I immediately found the interpreter and used my conda env with the command pellet (command + shift + P then in the drop down menu found my conda env). This seems to make the terminal work since which python points to the right place:
(automl-meta-learning) brandomiranda~/automl-meta-learning ❯ which python
/Users/brandomiranda/miniconda3/envs/automl-meta-learning/bin/python
also running python scripts from VS Code seems to be working fine too, see output:
(automl-meta-learning) brandomiranda~/automl-meta-learning ❯ /Users/brandomiranda/miniconda3/envs/automl-meta-learning/bin/python /Users/brandomiranda/automl-meta-learning/python_playground.py
x = 1
my_str = this is a string
y = 2
but when I try the jupyter notebook it doesn't work.
Most noticeably my VS code does not have a kernel connected, look at the screenshot:
I tried clicking on a couple of arrows as suggested on reddit (vs_code_jupyter_server_no_kernel_python_not):
When I try running things in my jupyter notebook I get the following error:
Error: Activating Python 3.7.6 64-bit ('base': conda) to run Jupyter failed with Error: StdErr from ShellExec, /Users/brandomiranda/.bashrc: line 31: jump-module.bash: No such file or directory
CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'.
To initialize your shell, run
$ conda init
Currently supported shells are:
- bash
- fish
- tcsh
- xonsh
- zsh
- powershell
See 'conda init --help' for more information and options.
IMPORTANT: You may need to close and restart your shell after running 'conda init'.
.
which is strange. My shell is not even bash so I don't know why that message is being shown to me (maybe VS Code doesn't know Mac OS Catalina uses zsh? not sure how to fix that for VS Code). Regardless, I proceeded to do what I think the error message is suggesting. So I did the following:
I ran conda init and then went down to the terminal inside vs code and restarted the shell by running zsh but the jupyter kernel still doesn't work on my notebook in vs code. Not sure what's wrong.
In addition, I did what the error message suggested:
(automl-meta-learning) brandomiranda~/automl-meta-learning ❯ conda init zsh
no change /Users/brandomiranda/miniconda3/condabin/conda
no change /Users/brandomiranda/miniconda3/bin/conda
no change /Users/brandomiranda/miniconda3/bin/conda-env
no change /Users/brandomiranda/miniconda3/bin/activate
no change /Users/brandomiranda/miniconda3/bin/deactivate
no change /Users/brandomiranda/miniconda3/etc/profile.d/conda.sh
no change /Users/brandomiranda/miniconda3/etc/fish/conf.d/conda.fish
no change /Users/brandomiranda/miniconda3/shell/condabin/Conda.psm1
no change /Users/brandomiranda/miniconda3/shell/condabin/conda-hook.ps1
no change /Users/brandomiranda/miniconda3/lib/python3.7/site-packages/xontrib/conda.xsh
no change /Users/brandomiranda/miniconda3/etc/profile.d/conda.csh
no change /Users/brandomiranda/.zshrc
No action taken.
but it seems it made no difference.
Any idea how to fix this?
I was suggessted by the developers of the VS code python extension to follow whatever they did here:
https://github.com/microsoft/vscode-python/issues/9566
but I can't figure out exactly it is they want me to do.
How do I fix this?
Related resources:
reddit: https://www.reddit.com/r/vscode/comments/eq2bfv/vs_code_jupyter_server_no_kernel_python_not/
gitissue: https://github.com/microsoft/vscode-python/issues/9636
I initially thought it was a conda issue so I looked into this question: Activate conda environment stopped working in vscode
https://www.reddit.com/r/vscode/comments/eshxka/how_does_one_connect_a_jupyter_kernel_to_vs_code/
https://www.quora.com/unanswered/How-does-one-connect-a-Jupyter-Kernel-to-VS-Code-if-one-does-not-connect-automatically
You need to select the python interpreter for jupyter, you can do it by following the step
Open command panel
Mac: CMD+Shift+P
PC: CTRL+SHIFT+P
Then search for select Interpreter to start jupyter server then hit enter, it will list all the interpreter, then select any interpreter and done!
it's just a one time process, after this, it will get connected automatically.
As bizarre as it seems, I also noticed this the other day and the only thing that works so far for me is to open VS Code by launching it from the Anaconda Navigator:
Then I get, as expected:
If you see the very long discussion I had in the git issue (https://github.com/microsoft/vscode-python/issues/9566) once I removed all the errors thrown by my .bashrc and .zhrc, the jupyter feature in VS code started working for me again. It's super weird (specially because I am NOT using bash at all and I am using zsh as my shell, I would have expected VS code to be robust to my .SHELLrc files throwing errors but it's not).
If that doesn't work, then you might have to install the vsix view extension and install the ms-python-insiders.vsixlinked in the issue (https://github.com/microsoft/vscode-python/issues/9566).
If on Windows VSCode, what worked for me was installing and enabling the Python and Jupyter extensions, then CTRL+SHIFT+P, select Interpreter to start jupyter server. Those extensions were the bottleneck.
I installed Anaconda 3. After Install I reboot the computer but, when I opened Anaconda Navigator, this keep happening, first this CMD window appears Conda.exe
and then this window appears gpython.exe
Before reboot, everything fine, I could open Anaconda Navigator. After reboot, (insert Billy Butcher from the Boys) BOOM, this happen.
This also happens everytime I type "conda" on the command prompt,with the python interpreter (second picture) keep appearing. So pretty much any solution on the internet that told me to use "conda" doesnt help.
Also this happens to every Anaconda Application (Anaconda Prompt, Anaconda Navigator).
I believe that whenever you launch anaconda conda.exe will run, at least it does for me.
Regarding gpython.exe, I could only find the following question referring to it
Django error: Command throws a python window when executing makemigrations command in a Python/Django project
This makes it seem like your anaconda may require a reinstall, I checked my anaconda files and couldn't find a gpython.exe in the path where yours appears, so this may be the case. Hope this helps.
I'm getting started on Python 2.7, using the Anaconda package and its Spyder IDE, but when I find out that something I want to do requires that I execute a command that starts with the word "conda", I have terrible trouble.
I first assumed that those were commands to type in the IPython console in Spyder, but instead of executing what I commanded, it told me NameError: name 'conda' is not defined.
I also tried the Windows Command Prompt (cmd.exe), but it told me conda is not recognized as an internal or external command. Some results when I googled that claimed that I had to add one of the Anaconda-related folders to Windows' Path, so I tried that, but still no good.
How can I carry out conda commands on Windows 10?
Just Run Command Prompt with Admin permission then it will install desired package and will work perfectly
First thing, you're right that those commands are not intended for the IPython console. Second, there is a good reason they are not working in the cmd.exe Command Prompt.
They are actually intended to be given to the Anaconda Prompt. On Windows, start typing "Anaconda Prompt" and, if you have Anaconda correctly installed, you should see an icon very similar to that of cmd.exe, except the "C:_" on the black background will be grey instead of white. That is where these commands are to be given.
If you are not sure which user/users Anaconda was installed for, it may take some extra time. If it was installed for all, or you're not sure, then you should go ahead and left-click the icon. If it was installed for you, everything should go fine, at least as far as permissions go.
If it was not installed for you, then it will at first seem to be obeying you when you command it to modify the software. It will fetch the metadata, tell you that these things will be installed or updated, and then ask you Proceed ([y]/n)? And then, after you type in y and hit Enter, it will tell you CondaIOError: IO error: Missing write permissions in: C:\Program Files\Anaconda3. Now you know, you need to open the Anaconda Prompt by right-clicking the icon and clicking "Run as administrator". Then you can type in your conda install... or conda update... command and see it carried out.
(This might only be possible if your Windows account is an administrator account; if that is true and you're not an administrator, you'll probably need to ask someone who has an administrator account for help.)
Credit to users on Google Groups for showing this solution.
I had a working version of Anaconda 2.3 on my Windows 10 PC. (I use PowerShell as my preferred command line interface.)
After updating to Anaconda 2.4, any command using conda or anaconda resulted in the message failed to start process.
I tried and uninstalling, redownloading and reinstalling, and even tried reverting to 2.3. Nothing worked!
Starting to get desperate, I eventually found the solution: I used python to run the script conda-script.py, which is apparently what the command conda.exe runs when called:
python PATH_TO_ANACONDA\Anaconda3\Scripts\conda-script.py
(Here, I'm using PATH_TO_ANACONDA to represent the directory in which the Anaconda3 folder resides on my particular system.)
Thereafter, both conda and anaconda commands work perfectly, and continue to work. (e.g. No need to repeat the process every time I launch PowerShell.). But I have no idea why the problem occurred, or why that happened to be the solution.
If you know, please reply. If not, I just hope this solution saves others an hour or so of frustration.
One of the projects that I work on in Python is pretty big and uses a lot of libraries.
I started developing it in Spyder then switched to VS Code.
I also use conda environment.
The problem is with VS Code only: when I open VS Code itself and try to run the project - I get all kinds of import errors.
However, if I open the conda terminal first and just type "code" in it and execute it - the VS Code opens, I can select my project and everything runs just fine, no errors.
In both cases the environment is the same, I did the Ctrl+Shift+P to select it, plus it shows as selected in the bottom left corner anyway. It's the default env.
How can I fix this so I don't have to start VS Code from conda terminal each time?
at the conda the modules are installed by default.
in vscode or any other of ides you have to install it manually.
open your terminal or cmd and type:
pip install module-name
I found what the problem was so I'll just leave it here in case it may happen to someone else.
My VS Code was using Powershell as the default shell, even though the input was right with the correct conda env selected (the base in my case), even with running
conda activate base
command to ensure it, it would still somehow mess up and complain about missing imports
So the solution was to set the default shell in VSC to regular Windows cmd.exe - that was the only needed change