Jupyter wont launch from Anaconda3 on Windows10 - python

I've recently installed Anaconda3 32bit version on Windows 10 but Jupyter won't launch.
I've updated anaconda using conda and everything looked ok with all packages including Jupyter downloading.
I've added the path to environmental variables.
I've tried to run jupyter notebook from cmd prompt but still get the same error message.
Trace:
Traceback (most recent call last): File "C:\Users\Edward\anaconda3\Scripts\jupyter-notebook-script.py", line 6, in
from notebook.notebookapp import main
ModuleNotFoundError: No module named 'notebook.notebookapp'; 'notebook' is not a package

If jupyter is installed on your system you can also use cmd to open i as:
jupyter notebook
If not then u can use pip to install jupyter:
pip install jupyterlab
or
pip install notebook
Then you can use cmd to open.

Maybe you did not download the latest version of Python.
Try downloading Python 3.9 first and see.
You can also download jupyter notebook from your OS terminal.

Thanks, but I have tried these ideas. The root of the problem (pun not intended!) is in the path definitions I think. I have tried adding path definitions. But things that used to work fine like running pip from the C:\ prompt no longer do. So I have given up on Anaconda and now use Visual Studio Code for everything, including running a Jupyter Notebook.
Don't know why the system path definition doesn't work. If I go to the directory containing pip it runs ok.
Many Thanks

Related

No module named 'sportsreference'

I pip installed the sportsreference package in my command prompt and it shows successful. Yet when I try to call it in my Jupyter Notebook it says no module named sportsreference.
Any help on what I'm doing wrong?
The interpreter that your Jupyter uses to run the cells is not the one you installed that package into. Remember you can have not only different versions of Python interpreter, but also different virtual environments associated with each Python interpreter in your machine.
So either install the package in the interpreter that Jupyter uses, or run the Jupyter from the interpreter you've installed that package into.
The simplest solution is to install it in a Jupyter cell with:
!pip install <your_package_name>
the ! allows you to execute command.
To check which interpreter currently runs your code you can check the output of:
import sys
print(sys.executable)

Can't run Jupyter notebook

I installed Jupyter Notebook using pip install notebook but I am not able to run it.
When I try runing using jupyter notebook, it gives me the CommandNotFoundException:
and
When I try runing using python -m notebook, it gives me the ImportError: cannot import name 'constants' from partially initialized module 'zmq.backend.cython':
I have added the following into PATH:
Path to python.exe present inside local folder.
Path to scripts folder present inside local folder.
Path to scripts folder present inside roaming folder.
All the jupyter dependencies(jupyter.exe, jupyter-core.exe, etc) are present in scripts folder inside 'Roaming' folder and not inside 'local' folder.
python version: 3.8.4
pip version: 20.1.1
Use: python3 -m notebook in the terminal.
I had worked with Jupyter Notebook and usually the cause for most of the cases is missing dependecy - Jupyter got a lot of them.
Please check if they are not missing by running:
python -m pip check
or
pip check
This will give you list of missed (sometimes there are versions problems) dependencies. Installing proper version with pip install <dep>==<version> should help.
Edited:
#Divyessh Maheshwari, if you have installed anaconda, then make sure you are running jupyter notebook in the anaconda prompt.
If you haven't and you don't want to install anaconda, you might need to downgrade Python according to this answer Is there a way to run Jupyter Notebooks Without Anaconda?

Pandas and Jupyter not found after upgrading to Catalina

I just updated my macOS to Catalina and I can't run python or open a jupyter notebook from terminal anymore. As an example, I get error message "ImportError: No module named pandas" when running my python code, and I get
zsh: command not found: jupyter
when running
jupyter notebook
This issue has brought me to anaconda (I would love someone to explain me why. Does python need anaconda to be ran?). I have tried several suggestions from https://github.com/ContinuumIO/anaconda-issues/issues/10998, e.g. I have tried copying folder "anaconda3" from "Relocated items" folder to "Users//", then
export PATH=''/Users/<username>/anaconda3/bin:$PATH"
but I get either
dquote>
or
zsh: /Users//Applications/anaconda3/bin/conda: bad interpreter: /anaconda3/bin/python: no such file or directory
I then tried to reinstall Anaconda using the graphic installer (from https://www.anaconda.com/distribution/#macos) following advice from someone from the anaconda team (https://www.anaconda.com/how-to-restore-anaconda-after-macos-catalina-update/) (I changed installation location to a folder I created in /Users//) but I still get the same error messages when running python3 or jupyter notebook.
How can successfully run python and jupyter notebook with macOS Catalina?
After installed macOS Catalina, we can switch the terminal from bash to zsh. There are many advantages from using zsh instead of bash, but One of the issues with zsh is some of the frameworks (jupyter notebook,conda) are not supported directly. Once I typed jupyter notebook in terminal to run it. It displayed “zsh: no such file or directory”.
The solver is simple but very difficult to find online.
If jupyter was already installed before the update and stopped working after zsh, you should be able to fix it by:
1.open zshrc in terminal by typing: open .zshrc or $open .zschrc
2. add the following line at the end of the file:
source ~/.bash_profile
It will ask zsh to use all the information from bash like the path of jupyter.
Hope it can help you out!
I'm answering to my own question in case it can help others ;)
I found my answer here: https://medium.com/#singhaniatanay18/mac-os-catalina-update-zsh-instead-of-bash-d688f68f70b8
(see comments as well)
Mac OS BigSur:
Uninstall Anaconda:rm -f Anaconda-Navigator.app
re-install pip3 install jupyterlab
I just updated to Catalina, two days before Big Sur release.. oh well.
Catalina came with changes to security and bash, that will remain for future releases. So Catalina moves your anaconda3 folder to /Users/Shared/Previously Relocated Items/Security/anaconda3 I tried to move it back to home directory, but that didn't work. So I deleted it, and reinstalled Anaconda using the command line installer Not the GUI installer, and it worked for me. You can follow instructions here and use /Users/me/anaconda3 folder as recommended here.
Here are the commands that worked for me,
shasum -a 256 /Users/username/anaconda3 . Although not sure it did anything
bash ~/Downloads/Anaconda3-2020.02-MacOSX-x86_64.sh or whatever the name of the command line installer from Conda in your Download folder, or wherever else you downloaded it.
Use sudo in front of the command if permission was denied, then enter your log in password for your Mac
source /Users/username/anaconda3/bin/activate conda init zsh
sudo conda init zsh then enter your Mac's password.
You should be all set now, and all commands like ipython, conda info, jupyter notebook, pyspark will all work.
The last command will make step3 command persist i.e. initialize conda base environment, such that you can run conda, ipython, jupyter notebook the next time you use terminal.
Install the Jupyter using Homebrew in zsh shell
If you don't Python install 3.3or higher.
Open terminal
Using Homewbrew install jupyter
brew install jupyter
Now, you start a notebook
jupyter notebook

A module is working in Anaconda prompt, but not in Spyder

I have been fighting with this problem for hours now, and it's a kind of complicated one.
I'm on windows 7, Python 2.7, Spyder 3.2.6
I tried to install OSMNX through cygwin, however I faced many issues. Finally managed to install it through windows cmd.
Through the anaconda prompt, I could import the osmnx with no error.
However, I'm trying to import it in spyder, but I keep receiving:
Traceback (most recent call last):
File "<ipython-input-2-2b99ab66aebb>", line 1, in <module>
import osmnx
ImportError: No module named osmnx
What is exactly wrong here? and how can I solve it?
The problem is the use of different environments for your anaconda prompt and your instance of spyder, as mentioned by #Simon. This problem and the different available solutions are reviewed here: GitHub discussion
You can solve the problem as follows. Provided that you have the package spyder-kernels already installed in your Anaconda prompt environment, run the following command in Anaconda prompt:
python -c "import sys; print(sys.executable)"
and copy the path returned to your console. Then, in Spyder go to Tools>Preferences>Python interpreter. Here you will see two options under Select the Python interpreter for all Spyder consoles. Check the second option and paste the path you copied from the Anaconda prompt. Close Spyder and open it again and now the import module command should work.
By doing this, Spyder will basically use the Python interpreter from the environment in which you have installed the new modules.
You need to sync the environment variables/path for both .
Just go to the anaconda promt and enter the command
> conda install spyder
It will automatically prepare the environment. Following that, just open up spyder and execute your code.
I have faced the same problem. I have installed the Spyder and Jupyter inside the conda environment. After that it's working fine for me.
source activate my_conda_env
conda install spyder
conda install jupyter notebook

Can't open Jupyter notebook with Anaconda

I just installed Anaconda, in my Surface Pro 3, with Windows 10, using the provided installer for 64-bit. When I try to launch "jupyter notebook" I always get the following message:
Microsoft Windows [Version 10.0.14393] (c) 2016 Microsoft Corporation.
All rights reserved.
C:\Users\Carlos>jupyter notebook Traceback (most recent call last):
File "C:\Program
Files\Anaconda3\Scripts\jupyter-notebook-script.py", line 3, in
import notebook.notebookapp
File "C:\Program
Files\Anaconda3\lib\site-packages\notebook\notebookapp.py", l ine 32,
in
from zmq.eventloop import ioloop
File "C:\Program Files\Anaconda3\lib\site-packages\zmq__init__.py",
line 34, in
from zmq import backend
File "C:\Program
Files\Anaconda3\lib\site-packages\zmq\backend__init__.py", l ine 40,
in
reraise(*exc_info)
File "C:\Program
Files\Anaconda3\lib\site-packages\zmq\utils\sixcerpt.py", lin e 34, in
reraise
raise value
File "C:\Program
Files\Anaconda3\lib\site-packages\zmq\backend__init__.py", l ine 27,
in
_ns = select_backend(first)
File "C:\Program
Files\Anaconda3\lib\site-packages\zmq\backend\select.py", lin e 26, in
select_backend
mod = import(name, fromlist=public_api)
File "C:\Program
Files\Anaconda3\lib\site-packages\zmq\backend\cython__init__ .py",
line 6, in
from . import (constants, error, message, context,
ImportError: DLL load failed: The specified module could not be found.
I tried to uninstall/install again several times, I tried to install it just for me or for all the users in the computer, I tried to update anaconda first...with no success. Any clue?
Thanks!
It seems to be a problem with the default installation of Anaconda. So, I removed the pyzmq package, which seems to be the problematic one.
This is what I have done:
conda uninstall pyzmq (This also removes jupyter related packages!)
conda install pyzmq (to reinstall it)
conda install jupyter (to reinstall jupyter related packages)
Now I can open Jupyter Notebook!
I also got somewhat same error today on my system and now it got resolved by following solution.
Please add following in the path variable, it will be resolved thereafter (I just checked):
C:\ML\installed_tools\anaconda3 (was already present)
C:\ML\installed_tools\anaconda3\Scripts (was already present)
C:\ML\installed_tools\anaconda3\Library\bin (added now)
C:\ML\installed_tools\anaconda3\Library\mingw-w64\bin (added now)
Refer this link for exact exception which I got (with exact versions of the modules) and resolved thereafter. Above exception might be of older anaconda version but solution should be same.
Here is what worked for me (You have to upgrade pyzmq):
python -m pip install --upgrade pip
pip install --upgrade pyzmq
After that it worked fine.
There are multiple options to fix this, i am still investigating on the root cause. However, you can try the solution given below..
if the Jupyter notebook version is 5.1.0 & above, you can uninstall using << conda uninstall notebook >> and then install Jupyter notebook from Anaconda Command prompt using << conda install notebook=5.0.0 >> This will help you launch the Anaconda Navigator from base environment itself.
Second option..,
Create another environment in conda << conda env create -f {name of yml file}.yml >>.
After creating, open the Anaconda navigator UI, switch the environment to the newly created environment and launch Jupyter ( this will work even with latest Jupyter notebook version 5.3.7 as well), it will work.
I am still investigating why the latest version is not opening with the base environment. however, we can use solution 1 or 2 based on your preference.
There may be access privileges issues with installing in the \Program Files folder.
I have Anaconda3 and installed into the root C:\ directory and had no problems with dll file installation like you have.
Try installing Anaconda3 as Anaconda3 with no spaces directly as its own folder in the C:\ directory.
Once installed, you can use the Anaconda Cheat Sheet to get started quickly to verify that installation works by going into the Anaconda3 folder and (if you are on Windows) SHIFT+RIGHT-CLICK-MOUSE and it will give you menu with open to open Command [Line] Window directly in that directory of Anaconda3. Open the Command Line window and run the commands from the Anaconda Cheat Sheet to quickly get started:
http://conda.pydata.org/docs/_downloads/conda-cheatsheet.pdf
You will need to follow instructions to create virtual Python development environment/folder within the Anaconda3. Then you will need to make sure you install the Jupyter Notebook into that virtual env/folder. Of course you will need to "activate" that virtual env after installing.
I hope this helps.
Regarding the issue of opening Jupyter Notebook with Anaconda, I was having this error message:
[W 12:34:52.309 LabApp] Permission to listen on port 8984 denied.
[C 12:34:52.309 LabApp] ERROR: the notebook server could not be started because no available port could be found.
It was trying each port but failing because of no permission. Running jupyter on a custom port fixed the problem:
jupyter notebook --port 9999
I just wasn't able to start Jupyter notebook directly after the installation.
Using a new terminal window was the solution for me.

Categories

Resources