While launching Spyder from Anaconda Navigator or directly from the menu, it is showing the given error message:
Traceback (most recent call last):
File "C:\Users\charchil\anaconda3\Scripts\spyder-script.py", line 6, in
from spyder.app.start import main
File "C:\Users\charchil\anaconda3\lib\site-packages\spyder\app\start.py", line 22, in
import zmq
File "C:\Users\charchil\AppData\Roaming\Python\Python37\site-packages\zmq_init_.py", line 47, in
from zmq import backend
File "C:\Users\charchil\AppData\Roaming\Python\Python37\site-packages\zmq\backend_init_.py", line 40, in
reraise(*exc_info)
File "C:\Users\charchil\AppData\Roaming\Python\Python37\site-packages\zmq\utils\sixcerpt.py", line 34, in
reraise raise value
File "C:\Users\charchil\AppData\Roaming\Python\Python37\site-packages\zmq\backend_init_.py", line 27, in
ns = select_backend(first)
File "C:\Users\charchil\AppData\Roaming\Python\Python37\site-packages\zmq\backend\select.py", line 28, in
select_backend mod = import(name, fromlist=public_api)
File "C:\Users\charchil\AppData\Roaming\Python\Python37\site-packages\zmq\backend\cython_init.py", line 6, in
from . import (constants, error, message, context,
ImportError: cannot import name 'constants' from 'zmq.backend.cython' (C:\Users\charchil\AppData\Roaming\Python\Python37\site-packages\zmq\backend\cython_init_.py)
A similar issue was raised on Jupyter Notebooks GitHub so it seems likely that a similar solution will help you, i.e.:
Attempt:
conda uninstall pyzmq
conda install pyzmq
Using the conda packages should make sure that version compatibility is maintained. If, however, that still doesn't work (and some comments in the attached issue suggested that it didn't work for some people), attempt:
pip uninstall pyzmq
pip install pyzmq
You can check your version of pip with pip --version and might want to consider upgrading it first if it is a long way behind. Current version is 20.1.1. Command to upgrade pip is:
python -m pip install --upgrade pip
Open the Anaconda prompt
conda deactivate
conda update anaconda-navigator
https://docs.anaconda.com/anaconda/navigator/update-navigator/
For those who are still looking for a quicker answer then below solution might help you as well and this worked for me like a charm.
Open Anaconda Prompt
Run the command conda update --all
Re launch the Anaconda Navigator now
Now Launch, spyder or jupyter notebook. Probably it should work for you as well.
NOTE: If you are running any firewall application then, make sure you launch navigator in administrator mode and unblock any prompt requests accordingly for smooth launching. This is on windows systems again and may be a different way for other platforms.
Hope this helps someone in need again. All the best.
Related
Recently my jupyter notebook stopped launching. When I try the command jupyter notebook from anaconda prompt but it gives error
Traceback (most recent call last):
File "C:\Users\Dell\anaconda3\Scripts\jupyter-notebook-script.py", line 6, in
from notebook.notebookapp import main
File "C:\Users\Dell\anaconda3\lib\site-packages\notebook\notebookapp.py", line 51, in
from zmq.eventloop import ioloop
File "C:\Users\Dell\anaconda3\lib\site-packages\zmq_init_.py", line 50, in
from zmq import backend
File "C:\Users\Dell\anaconda3\lib\site-packages\zmq\backend_init_.py", line 40, in
reraise(*exc_info)
File "C:\Users\Dell\anaconda3\lib\site-packages\zmq\utils\sixcerpt.py", line 34, in reraise
raise value
File "C:\Users\Dell\anaconda3\lib\site-packages\zmq\backend_init_.py", line 27, in
ns = select_backend(first)
File "C:\Users\Dell\anaconda3\lib\site-packages\zmq\backend\select.py", line 28, in select_backend
mod = import(name, fromlist=public_api)
File "C:\Users\Dell\anaconda3\lib\site-packages\zmq\backend\cython_init.py", line 6, in
from . import (constants, error, message, context,
ImportError: DLL load failed while importing error: The specified module could not be found.
I even tried reinstalling anaconda and upgraded to python 3.8.3 on windows 10 but still get the same error. When I tried to check jupyter notebook's version it said that ipykernel and some other things were not installed. jupyter --version gives me this:
jupyter core : 4.6.3
jupyter-notebook : 6.1.1
qtconsole : 4.7.6
ipython : 7.18.1
ipykernel : not installed
jupyter client : not installed
jupyter lab : not installed
nbconvert : 5.6.1
But installing ipykernel with conda install ipykernel says
All requested packages already installed.
I also tried ipython kernel install --name <env_name> --user but this gives another dll error.
Reading some other problems in stackoverflow I went and checked my enviroment variables.
Is there a problem with this environment variable. Please help.
Screenshot of the anaconda prompt with error.
Edit: The anaconda navigator does not launch either. anaconda-navigator on the anaconda prompt gives another error:
I also tried:
conda install qt --force
conda install pyqt --force
But that did'nt help. Does previously installed anaconda cause such error?
Just for other people having similar issue.
In my case, when I run jupyter notebook on command line, I got the same error as #Anav Katwal . However if I run jupyter notebook on Anaconda Prompt, then the error is gone.
If you truly want to execute jupyter notebook on cmd, then you could add the following paths to your system environment variable:
C:\Users\USERNAME\anaconda3\Library\bin
C:\Users\USERNAME\anaconda3\Scripts
C:\Users\USERNAME\anaconda3\condabin
What worked for me was reinstalling one of the modules jupyter calls and reinstalling the newer version manually, via another SO answer:
pip uninstall pyzmq
pip install pyzmq==20
Import error while trying to run jupyter notebook
I found what I did wrong (silly me). Microsoft visual C++ 2015-2019 was somehow removed when I tried to install openCV manually. Didn't think that such an install would make such big impact, have to keep that in mind now but installing the latest solved all the problems.
P.S.: This solution might not work for someone else with similar problem. But its worth taking a note.
Use this code, instead of conda
pip install jupyter
As some brief background information: I was origianlly trying to use Miniconda (with conda) to install dependencies that I need for my project on my Raspberry Pi. After trying to use Conda to install the SimpleAudio package, I got an error saying that it did not exist, therefore I proceeded to install this through Pip. Pip found the correct package although I get the following error message:
pi#raspberrypi:~ $ pip install simpleaudio
Traceback (most recent call last):
File "/home/pi/miniconda3/bin/pip", line 7, in <module>
from pip._internal.cli.main import main
File "/home/pi/miniconda3/lib/python3.4/site-packages/pip/_internal/cli/main.py", line 10, in <module>
from pip._internal.cli.autocompletion import autocomplete
File "/home/pi/miniconda3/lib/python3.4/site-packages/pip/_internal/cli/autocompletion.py", line 9, in <module>
from pip._internal.cli.main_parser import create_main_parser
File "/home/pi/miniconda3/lib/python3.4/site-packages/pip/_internal/cli/main_parser.py", line 7, in <module>
from pip._internal.cli import cmdoptions
File "/home/pi/miniconda3/lib/python3.4/site-packages/pip/_internal/cli/cmdoptions.py", line 28, in <module>
from pip._internal.models.target_python import TargetPython
File "/home/pi/miniconda3/lib/python3.4/site-packages/pip/_internal/models/target_python.py", line 4, in <module>
from pip._internal.utils.misc import normalize_version_info
File "/home/pi/miniconda3/lib/python3.4/site-packages/pip/_internal/utils/misc.py", line 20, in <module>
from pip._vendor import pkg_resources
File "/home/pi/miniconda3/lib/python3.4/site-packages/pip/_vendor/pkg_resources/__init__.py", line 92, in <module>
raise RuntimeError("Python 3.5 or later is required")
RuntimeError: Python 3.5 or later is required
It seems I need to update Python, although when I print the verion on Spyder IDE, it says I am already using 3.7.
Have I caused some sort of mismatch between what version my IDE is using and what the default process the terminal uses to look up the version? I noticed that it is looking for the Python version under Miniconda. If I can update If so is there a fix for this?
Please as me for more information if required (I am fairly new to stack overflow).
UPDATE:
I have been able to install the updated version of Python to 3.6 using the following instructions:
https://stackoverflow.com/a/56852714/12361146
This generally solves the scope of this question in terms of how I update Python, but I am still confused as to why Spyder IDE uses a more up-to-date version of Python whereas the terminal shows otherwise.
To answer the question of why Spyder reports a more up-to-date version of Python, here's the reason. The default versions of Python that are installed with Raspbian are 2.7 and 3.5, located in the /usr/bin/ directory. When you install Spyder, however (either independently, or more commonly, using conda), it includes its own installation of Python, which it is configured to use in the IDE, and which is located in a different directory. Hence when you compare the versions, first by entering python3 --version on the command line, and then print(sys.executable) from the Spyder IDE, they're different.
Now the issue with using pip alongside conda for updating the Spyder installation of Python is that it has the potential to mess it up quite badly, so avoid that unless you really know what you're doing. From code you posted above, you have avoided that, though, since that will have impacted the default Raspbian installation of Python, not the Spyder one. Upgrading the latter version should be done using Conda, not pip.
Hopefully you're now all up and running.
You can install newer versions of python using the package manager apt or apt-get.
Start by getting up-to-date package definitions.
$ sudo apt-get update
Then you can show details about the python3 package.
$ apt-cache show python3
When I run that now I get "Version: 3.7.3-1".
To install the python3 package and all its dependencies.
$ sudo apt-get install python3
You will still need to type python3 and pip3 when you run the commands because you are not replacing the built-in python 2.7.
Try these commands to see what you get
$ python --version
$ python3 --version
If you want to change the default python to python3 then have a look at this answer How to change the default python version in Raspberry Pi
I had to install pytorch with conda, and next I had this error when trying to upgrade system :
sudo dnf upgrade
Traceback (most recent call last):
File "/bin/dnf", line 57, in <module>
from dnf.cli import main
File "/usr/lib/python3.6/site-packages/dnf/__init__.py", line 31, in <module>
import dnf.base
File "/usr/lib/python3.6/site-packages/dnf/base.py", line 26, in <module>
from dnf.comps import CompsQuery
File "/usr/lib/python3.6/site-packages/dnf/comps.py", line 29, in <module>
import dnf.util
File "/usr/lib/python3.6/site-packages/dnf/util.py", line 32, in <module>
import librepo
ModuleNotFoundError: No module named 'librepo'
I saw some answer that uses yum-deprecated for re install python, but it seems I don't have it on my machine. I don't want to reinstall linux another time, and I'm searching for kind an answer for that problem.
When installing pytorch via conda, it also installed cuda. Maybe it can be a problem ?
Before this, I remember (not sure, but kind of) I was running with python2.7 by default, and now it is python 3.6..
First the magic one-liner to fix things:
echo 'import sys;sys.path += ["/usr/lib64/python3.6/site-packages/", "/usr/lib64/python3.6/"]' | sudo tee /usr/lib/python3.6/site-packages/lib64.pth
I got the same error after using conda to install jupyterlab. For some reason conda installed its own version of python which shadows fedora's one. Conda's python searches libraries from /usr/lib/ while fedora's also searches /usr/lib64/. On most linux distros /usr/lib/ is a link for /usr/lib64/ or the other way so either one can be used. librepo is installed in /usr/lib64/.
My conclusions:
Fedora is not completely compatible with conda.
Fedora bug reports get closed as duplicate with links to obviously unrelated reports.
I have stumbled upon the same issue in Fedora 28. I used anaconda as root to update packages system wide, and this broke dnf with the message
ModuleNotFoundError: No module named 'librepo'
yum-deprecated did not work, although Fedora installed it for me after automatically querying for it (a bit strange that this worked since dnf and yum did not work).
In order to fix the issue, I deleted the existing libpython, downloaded the python3 and python3-lib rpms from rpmfind, and installed the new rpms
rm -rf /usr/lib/libpython3*.*
rpm -iv --replacepkgs python3-3.6.6-1.fc28.x86_64.rpm
rpm -iv --replacepkgs python3-libs-3.6.6-1.fc28.x86_64.rpm
Now I know it is better to use pip than anaconda system wide.
I ran the command conda update anaconda to update anaconda v4.4 to v5.0
After anaconda was successfully upgraded to v5.0, I had problems running pip.
This is the error output I see after running pip;
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\Scripts\pip-script.py", line 6, in <module>
from pip import main
File "C:\ProgramData\Anaconda3\lib\site-packages\pip\__init__.py", line 28, in <module>
from pip.vcs import git, mercurial, subversion, bazaar # noqa
File "C:\ProgramData\Anaconda3\lib\site-packages\pip\vcs\mercurial.py", line 9, in <module>
from pip.download import path_to_url
File "C:\ProgramData\Anaconda3\lib\site-packages\pip\download.py", line 41, in <module>
from pip._vendor.requests.adapters import BaseAdapter, HTTPAdapter
ModuleNotFoundError: No module named 'pip._vendor.requests.adapters'
How can I get pip to work again? I am using Windows10, 64-bit python v3.6 anaconda v5.0
Had the same problem fixed by renaming the directory:
%USERPROFILE%\Anaconda3\Lib\site-packages\pip
then running conda install --force-reinstall pip
(Then I guess it's safe to remove the renamed directory)
This occurs when broken pip. The broken pip caused by the failed upgrade can be fixed by running:
!easy_install pip
I will answer my own question.
The problem was fixed by uninstalling anaconda and doing a fresh re-install from the windows installation executable.
Based on this link https://github.com/pypa/pip/issues/2345, it seems something went wrong with the installation but the problem cannot be reproduced. I do not know what exactly what wrong with conda update anaconda.
When I attempt to run
$ jupyter qtconsole
The console shows up, with the message
Kernel died, restarting
________________________
Kernel died, restarting
________________________
Kernel died, restarting
________________________
Kernel died, restarting
________________________
Kernel died, restarting
________________________
Which continues.
Trying $ jupyter qtconsole --debug didn't print anything else, and neither has adding
c.Application.log_level = 0
c.Session.debug = True
into $USERHOME/.jupyter/jupyter_qtconsole_config.py
Also, I found nothing in $USERHOME/.ipython/profile_default/log/ and the other directories around there.
Nothing has changed in my configuration since last time I started up jupyter-qtconsole.
How can I at least find out what's going wrong with the kernel? Surely there is some option in Jupyter to get the kernel's STDERR output to see what exception had upset it?
Run this-
conda remove ipykernel ipython jupyter_client jupyter_core traitlets ipython_genutils
conda clean -tipsy
conda install ipykernel ipython jupyter_client jupyter_core traitlets ipython_genutils
jupyter notebook
I run
spyder --show-console
when I receive in spyder
Kernel died, restarting
I see message in console
Intel MKL FATAL ERROR: Cannot load libmkl_p4m.so or libmkl_p4.so.
It was helpfull for me
conda install nomkl numpy scipy scikit-learn numexpr
conda remove mkl mkl-service
Check the log. I had the same problem and my log shows no module named ipykernel_launcher. So, I just pip install ipykernel and solve the problem.
I tried several solutions and finally i found one which really works.
You just have to add an exception to your antivirus and/or firewall.
I currently use Avast, so adding an exception concerning the folder where i installed Anaconda and the virtual environments solved the problem and now Spyder works as a charm.
Encountered this problem when try to use pandas to read data in clipboard, tried many times in Spyder editor which is from the Anaconda3. I have also tried to solve the problem by updating the Spyder and other Anaconda3 packages, but failed to solve it.
Finally, without using the Anaconda3, in another PC install python 3.5.3, then
pip install pandas, the error dismissed.
Given that the kernel is another process, I was able to catch the command line it was started with, using Process Explorer. The command line was
$ pythonw -m ipykernel -f "$USERHOME/AppData/Roaming/jupyter/runtime/kernel-2744.json"
Then, I just launched python and tried importing ipykernel, and got this:
$ python
Python 2.7.12 [...] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import ipykernel
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Programs\Python2712\lib\site-packages\ipykernel\__init__.py", line 2,
in <module>
from .connect import *
File "C:\Programs\Python2712\lib\site-packages\ipykernel\connect.py", line 13,
in <module>
from IPython.core.profiledir import ProfileDir
File "C:\Programs\Python2712\lib\site-packages\IPython\__init__.py", line 48,
in <module>
from .core.application import Application
File "C:\Programs\Python2712\lib\site-packages\IPython\core\application.py", l
ine 25, in <module>
from IPython.core import release, crashhandler
File "C:\Programs\Python2712\lib\site-packages\IPython\core\crashhandler.py",
line 28, in <module>
from IPython.core import ultratb
File "C:\Programs\Python2712\lib\site-packages\IPython\core\ultratb.py", line
119, in <module>
from IPython.core import debugger
File "C:\Programs\Python2712\lib\site-packages\IPython\core\debugger.py", line
36, in <module>
from IPython.utils import PyColorize, ulinecache
File "C:\Programs\Python2712\lib\site-packages\IPython\utils\PyColorize.py", l
ine 55, in <module>
from IPython.utils.py3compat import PY3
File "C:\Programs\Python2712\lib\site-packages\IPython\utils\py3compat.py", li
ne 296, in <module>
PYPY = platform.python_implementation() == "PyPy"
AttributeError: 'module' object has no attribute 'python_implementation'
>>> exit()
And this quickly led to the problem, as described in this answer, being that the directory I was trying to start jupyter qtconsole in had a subdirectory called platform, which conflicted with the name of a module.
While this fixes this specific instance of "Kernel died, restarting", the general question still stands: how to make sure that the stacktrace, like the one above, is reported to the user of Jupyter console, instead of the kernel dying silently?
If the working directory where jupyter qtconsole is launched from contains some special characters, the "Kernel died, restarting" error may occur repeatedly.
For me, I had launched jupyter qtconsole from a working directory whose path contained spaces and ampersands (&). When I change directory to root drive (D:/ in my case) the problem goes away.
I'm having the similar problem when I run import Tensorflow as tf.
After downgrading to the Tensorflow 1.5 version, the problem was resolved.
Try uninstalling TensorFlow:
pip uninstall tensorflow
and then reinstalling 1.5:
pip install tensorflow==1.5
Jupyter_client and jupyter_core releases have been made available (and contain the fix for this issue), would you mind trying the following:
1. pip install jupyter_client --upgrade - this should replace your modified jupyter_client package with release 5.3.4 and install the updated version of jupyter_core (4.6.0)
2. If you find that jupyter_core is NOT 4.6.0 - please try pip install jupyter_core --upgrade.
Check out the thread here: https://github.com/jupyter/notebook/issues/4907
I had the same problem. I deleted the content at C:\Users\youruser\AppData\Roaming\jupyter\runtime then runs again jupyter notebook. it was helpful for me.
minimize your batch_size it's working for me
i tried updating ipykernel and i updated my numpy nothing seems to work for. just minimized my batch it's working
In my case, Updating Numpy, reinstall jupyter, reinstall anaconda, install module with conda all are not works for me...
I just Delete CUDNN folder, and that's it...