New to Anaconda and Jupyter Notebooks but for some reason I can't run Jupyter Notebook in my environments running python 3. Every time my terminal displays this:
Traceback (most recent call last):
File "/anaconda3/bin/jupyter-notebook", line 11, in
sys.exit(main())
File "/anaconda3/lib/python3.6/site-packages/jupyter_core/application.py", line 267, in launch_instance
return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
File "/anaconda3/lib/python3.6/site-packages/traitlets/config/application.py", line 657, in launch_instance
app.initialize(argv)
File "", line 2, in initialize
File "/anaconda3/lib/python3.6/site-packages/traitlets/config/application.py", line 87, in catch_config_error
return method(app, *args, **kwargs)
File "/anaconda3/lib/python3.6/site-packages/notebook/notebookapp.py", line 1296, in initialize
self.init_webapp()
File "/anaconda3/lib/python3.6/site-packages/notebook/notebookapp.py", line 1093, in init_webapp
self.jinja_environment_options
File "/anaconda3/lib/python3.6/site-packages/notebook/notebookapp.py", line 167, in init
default_url, settings_overrides, jinja_env_options)
File "/anaconda3/lib/python3.6/site-packages/notebook/notebookapp.py", line 259, in init_settings
nbextensions_path=jupyter_app.nbextensions_path,
File "/anaconda3/lib/python3.6/site-packages/notebook/notebookapp.py", line 807, in nbextensions_path
from IPython.paths import get_ipython_dir
File "/anaconda3/lib/python3.6/site-packages/IPython/init.py", line 54, in
from .core.application import Application
File "/anaconda3/lib/python3.6/site-packages/IPython/core/application.py", line 25, in
from IPython.core import release, crashhandler
File "/anaconda3/lib/python3.6/site-packages/IPython/core/crashhandler.py", line 27, in
from IPython.core import ultratb
File "/anaconda3/lib/python3.6/site-packages/IPython/core/ultratb.py", line 115, in
from IPython.core import debugger
File "/anaconda3/lib/python3.6/site-packages/IPython/core/debugger.py", line 37, in
from IPython.utils import PyColorize
File "/anaconda3/lib/python3.6/site-packages/IPython/utils/PyColorize.py", line 47, in
from .colorable import Colorable
File "/anaconda3/lib/python3.6/site-packages/IPython/utils/colorable.py", line 12, in
import pygments
File "/Library/Python/2.7/site-packages/pygments/init.py", line 46
except TypeError, err:
^
SyntaxError: invalid syntax
Any recommendations on how to correct?
Related
When I am trying to run my application I got the following error
Traceback (most recent call last):
File "./app.py", line 32, in <module>
from pushservices.bootstrap import init_messaging_agents
File "/home/airnotifier/airnotifier/pushservices/bootstrap.py", line 2, in <module>
from .apns import *
File "/home/airnotifier/airnotifier/pushservices/apns.py", line 5, in <module>
from util import json_encode
File "/home/airnotifier/airnotifier/util.py", line 37, in <module>
import tornado
ModuleNotFoundError: No module named 'tornado'
I tried to run this command to install tornado
python3 -m pip install tornado
then I got the following message
Requirement already satisfied: tornado in /usr/local/lib/python3.8/dist-packages (6.0.3)
followed by the following error log
--- Logging error ---
Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/pip/_internal/utils/logging.py", line 177, in emit
self.console.print(renderable, overflow="ignore", crop=False, style=style)
File "/usr/local/lib/python3.8/dist-packages/pip/_vendor/rich/console.py", line 1752, in print
extend(render(renderable, render_options))
File "/usr/local/lib/python3.8/dist-packages/pip/_vendor/rich/console.py", line 1390, in render
for render_output in iter_render:
File "/usr/local/lib/python3.8/dist-packages/pip/_internal/utils/logging.py", line 134, in __rich_console__
for line in lines:
File "/usr/local/lib/python3.8/dist-packages/pip/_vendor/rich/segment.py", line 245, in split_lines
for segment in segments:
File "/usr/local/lib/python3.8/dist-packages/pip/_vendor/rich/console.py", line 1368, in render
renderable = rich_cast(renderable)
File "/usr/local/lib/python3.8/dist-packages/pip/_vendor/rich/protocol.py", line 36, in rich_cast
renderable = cast_method()
File "/usr/local/lib/python3.8/dist-packages/pip/_internal/self_outdated_check.py", line 130, in __rich__
pip_cmd = get_best_invocation_for_this_pip()
File "/usr/local/lib/python3.8/dist-packages/pip/_internal/utils/entrypoints.py", line 58, in get_best_invocation_for_this_pip
if found_executable and os.path.samefile(
File "/usr/lib/python3.8/genericpath.py", line 101, in samefile
s2 = os.stat(f2)
FileNotFoundError: [Errno 2] No such file or directory: '/usr/bin/pip3.8'
Call stack:
File "/usr/lib/python3.8/runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/usr/local/lib/python3.8/dist-packages/pip/__main__.py", line 31, in <module>
sys.exit(_main())
File "/usr/local/lib/python3.8/dist-packages/pip/_internal/cli/main.py", line 70, in main
return command.main(cmd_args)
File "/usr/local/lib/python3.8/dist-packages/pip/_internal/cli/base_command.py", line 101, in main
return self._main(args)
File "/usr/local/lib/python3.8/dist-packages/pip/_internal/cli/base_command.py", line 223, in _main
self.handle_pip_version_check(options)
File "/usr/local/lib/python3.8/dist-packages/pip/_internal/cli/req_command.py", line 148, in handle_pip_version_check
pip_self_version_check(session, options)
File "/usr/local/lib/python3.8/dist-packages/pip/_internal/self_outdated_check.py", line 237, in pip_self_version_check
logger.info("[present-rich] %s", upgrade_prompt)
File "/usr/lib/python3.8/logging/__init__.py", line 1446, in info
self._log(INFO, msg, args, **kwargs)
File "/usr/lib/python3.8/logging/__init__.py", line 1589, in _log
self.handle(record)
File "/usr/lib/python3.8/logging/__init__.py", line 1599, in handle
self.callHandlers(record)
File "/usr/lib/python3.8/logging/__init__.py", line 1661, in callHandlers
hdlr.handle(record)
File "/usr/lib/python3.8/logging/__init__.py", line 954, in handle
self.emit(record)
File "/usr/local/lib/python3.8/dist-packages/pip/_internal/utils/logging.py", line 179, in emit
self.handleError(record)
Message: '[present-rich] %s'
Arguments: (UpgradePrompt(old='22.1.2', new='22.2.2'),)
can anyone please tell me what should I do and what is the problem ?
Here's a possible scenario that could cause this:
you execute pip install tornado as a user but you run the tornado project as another user.
Sorry for my terrible english, hope you can understand
I have installed Anaconda and when I try to launch jupyter notebook It give error:
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\Scripts\jupyter-notebook-script.py", line 10, in
sys.exit(main())
File "C:\Users\Amartya Veer\AppData\Roaming\Python\Python37\site-packages\jupyter_core\application.py", line 268, in launch_instance
return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
File "C:\Users\Amartya Veer\AppData\Roaming\Python\Python37\site-packages\traitlets\config\application.py", line 663, in launch_instance
app.initialize(argv)
File "", line 2, in initialize
File "C:\Users\Amartya Veer\AppData\Roaming\Python\Python37\site-packages\traitlets\config\application.py", line 87, in catch_config_error
return method(app, *args, **kwargs)
File "C:\Users\Amartya Veer\AppData\Roaming\Python\Python37\site-packages\notebook\notebookapp.py", line 1720, in initialize
self.init_webapp()
File "C:\Users\Amartya Veer\AppData\Roaming\Python\Python37\site-packages\notebook\notebookapp.py", line 1448, in init_webapp
self.jinja_environment_options,
File "C:\Users\Amartya Veer\AppData\Roaming\Python\Python37\site-packages\notebook\notebookapp.py", line 158, in __init__
handlers = self.init_handlers(settings)
File "C:\Users\Amartya Veer\AppData\Roaming\Python\Python37\site-packages\notebook\notebookapp.py", line 294, in init_handlers
handlers.extend(load_handlers('notebook.tree.handlers'))
File "C:\Users\Amartya Veer\AppData\Roaming\Python\Python37\site-packages\notebook\notebookapp.py", line 138, in load_handlers
mod = __import__(name, fromlist=['default_handlers'])
ModuleNotFoundError: No module named 'notebook.tree'
I have tried reinstalling Anaconda in both single user and multiple users.
I'm using PyCharm 5.0.5 and Python3.6 installed by Anaconda.
the Project Interpreter in Pycharm has been correct set to python3.6
Run "import tensoflow" in python console is ok. but when I try to import in PyCharm, it throws error:
Traceback (most recent call last):
File "E:/myself/test/test.py", line 14, in <module>
import tensorflow as tf
File "D:\ProgramData\Anaconda3\lib\site-packages\tensorflow\__init__.py", line 24, in <module>
from tensorflow.python import *
File "D:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\__init__.py", line 52, in <module>
from tensorflow.core.framework.graph_pb2 import *
File "D:\ProgramData\Anaconda3\lib\site-packages\tensorflow\core\framework\graph_pb2.py", line 6, in <module>
from google.protobuf import descriptor as _descriptor
File "D:\ProgramData\Anaconda3\lib\site-packages\google\protobuf\__init__.py", line 37, in <module>
__import__('pkg_resources').declare_namespace(__name__)
File "D:\ProgramData\Anaconda3\lib\site-packages\pkg_resources\__init__.py", line 3088, in <module>
#_call_aside
File "D:\ProgramData\Anaconda3\lib\site-packages\pkg_resources\__init__.py", line 3072, in _call_aside
f(*args, **kwargs)
File "D:\ProgramData\Anaconda3\lib\site-packages\pkg_resources\__init__.py", line 3101, in _initialize_master_working_set
working_set = WorkingSet._build_master()
File "D:\ProgramData\Anaconda3\lib\site-packages\pkg_resources\__init__.py", line 565, in _build_master
ws = cls()
File "D:\ProgramData\Anaconda3\lib\site-packages\pkg_resources\__init__.py", line 558, in __init__
self.add_entry(entry)
File "D:\ProgramData\Anaconda3\lib\site-packages\pkg_resources\__init__.py", line 614, in add_entry
for dist in find_distributions(entry, True):
File "D:\ProgramData\Anaconda3\lib\site-packages\pkg_resources\__init__.py", line 1964, in find_on_path
for dist in factory(fullpath):
File "D:\ProgramData\Anaconda3\lib\site-packages\pkg_resources\__init__.py", line 2034, in distributions_from_metadata
root, entry, metadata, precedence=DEVELOP_DIST,
File "D:\ProgramData\Anaconda3\lib\site-packages\pkg_resources\__init__.py", line 2473, in from_location
py_version=py_version, platform=platform, **kw
File "D:\ProgramData\Anaconda3\lib\site-packages\pkg_resources\__init__.py", line 2835, in _reload_version
md_version = _version_from_file(self._get_metadata(self.PKG_INFO))
File "D:\ProgramData\Anaconda3\lib\site-packages\pkg_resources\__init__.py", line 2437, in _version_from_file
line = next(iter(version_lines), '')
File "D:\ProgramData\Anaconda3\lib\site-packages\pkg_resources\__init__.py", line 2626, in _get_metadata
if self.has_metadata(name):
File "D:\ProgramData\Anaconda3\lib\site-packages\pkg_resources\__init__.py", line 1790, in has_metadata
return name == 'PKG-INFO' and os.path.isfile(self.path)
File "D:\ProgramData\Anaconda3\lib\genericpath.py", line 33, in isfile
return stat.S_ISREG(st.st_mode)
AttributeError: module 'stat' has no attribute 'S_ISREG'
It's confusing that this problem didn't occur before util yesterday.
I can't search any help. How to solve it?
I teared down Django-oscar for practice and rebuild it not in capacity of a plugin app but as Django project. Now I am having this issue but couldn't figure out what it is related to exactly. Can someone help me to resolve this?
Following is the error I am getting:
When I run command "python manage.py shell" I get this error.
(supermarket) C:\Users\shazia\supermarket\market>python manage.py shell
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "C:\Users\shazia\supermarket\lib\site-packages\django\core\management\_
_init__.py", line 354, in execute_from_command_line
utility.execute()
File "C:\Users\shazia\supermarket\lib\site-packages\django\core\management\_
_init__.py", line 346, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Users\shazia\supermarket\lib\site-packages\django\core\management\b
ase.py", line 394, in run_from_argv
self.execute(*args, **cmd_options)
File "C:\Users\shazia\supermarket\lib\site-packages\django\core\management\b
ase.py", line 445, in execute
output = self.handle(*args, **options)
File "C:\Users\shazia\supermarket\lib\site-packages\django\core\management\c
ommands\shell.py", line 69, in handle
self.run_shell(shell=options['interface'])
File "C:\Users\shazia\supermarket\lib\site-packages\django\core\management\c
ommands\shell.py", line 58, in run_shell
return getattr(self, shell)()
File "C:\Users\shazia\supermarket\lib\site-packages\django\core\management\c
ommands\shell.py", line 41, in ipython
ip()
File "C:\Users\shazia\supermarket\lib\site-packages\django\core\management\c
ommands\shell.py", line 34, in _ipython
from IPython import start_ipython
File "C:\Users\shazia\supermarket\lib\site-packages\IPython\__init__.py", li
ne 47, in <module>
from .core.application import Application
File "C:\Users\shazia\supermarket\lib\site-packages\IPython\core\application
.py", line 22, in <module>
from traitlets.config.application import Application, catch_config_error
File "C:\Users\shazia\supermarket\lib\site-packages\traitlets\config\__init_
_.py", line 6, in <module>
from .application import *
File "C:\Users\shazia\supermarket\lib\site-packages\traitlets\config\applica
tion.py", line 120, in <module>
class Application(SingletonConfigurable):
File "C:\Users\shazia\supermarket\lib\site-packages\traitlets\config\applica
tion.py", line 291, in Application
def initialize(self, argv=None):
File "<decorator-gen-1>", line 2, in catch_config_error
File "C:\Users\shazia\supermarket\lib\site-packages\decorator.py", line 232,
in decorate
evaldict, __wrapped__=func)
File "C:\Users\shazia\supermarket\lib\site-packages\decorator.py", line 219,
in create
self = cls(func, name, signature, defaults, doc, module)
File "C:\Users\shazia\supermarket\lib\site-packages\decorator.py", line 109,
in __init__
setattr(self, a, getattr(argspec, a))
AttributeError: 'getfullargspec' object has no attribute 'default'
You are on Windows as per the error description. Use 'manage.py shell' instead of 'python manage.py shell'.
This is a fresh Anaconda 2.1 install on Windows 7 - 64, python 2.7.8 . The Spyder IDE fails to launch, and throws the same error/writes same traceback when python spyder --reset is run from cli. Looking at the traceback, it appears to be a problem loading zmq module. That module's \__init__.py looks for any precompiled libzmq file with one of these exts: pyd, so, dll, dylib, and adds them to list bundled, and then tries to load bundled[0].
bundled = []
bundled_sodium = []
for ext in ('pyd', 'so', 'dll', 'dylib'):
bundled_sodium.extend(glob.glob(os.path.join(here, 'libsodium*.%s*' % ext)))
bundled.extend(glob.glob(os.path.join(here, 'libzmq*.%s*' % ext)))
The confusing thing is that libzmq.pyd is located right in the Anaconda2.1\Lib\site-packages\zmq directory! After looking both at code and at the other questions on SO, I'm stumped. Please help.
Traceback:
C:\Users\someUser>cmd /K spyder
Traceback (most recent call last):
File "C:\Users\someUser\Anaconda2.1\Scripts\spyder-script.py", line 2, in <m
odule>
start_app.main()
File "C:\Users\someUser\Anaconda2.1\lib\site-packages\spyderlib\start_app.py
", line 85, in main
from spyderlib import spyder
File "C:\Users\someUser\Anaconda2.1\lib\site-packages\spyderlib\spyder.py",
line 45, in <module>
from spyderlib.ipythonconfig import IPYTHON_QT_INSTALLED, SUPPORTED_IPYTHON
File "C:\Users\someUser\Anaconda2.1\lib\site-packages\spyderlib\ipythonconfi
g.py", line 22, in <module>
IPYTHON_QT_INSTALLED = is_qtconsole_installed()
File "C:\Users\someUser\Anaconda2.1\lib\site-packages\spyderlib\ipythonconfi
g.py", line 15, in is_qtconsole_installed
pyzmq_installed = programs.is_module_installed('zmq')
File "C:\Users\someUser\Anaconda2.1\lib\site-packages\spyderlib\utils\progra
ms.py", line 272, in is_module_installed
actver = get_module_version(module_name)
File "C:\Users\someUser\Anaconda2.1\lib\site-packages\spyderlib\utils\progra
ms.py", line 218, in get_module_version
mod = __import__(module_name)
File "C:\Python27\Lib\site-packages\zmq\__init__.py", line 41, in <module>
_libzmq = ctypes.cdll.LoadLibrary(bundled[0])
File "C:\Users\someUser\Anaconda2.1\lib\ctypes\__init__.py", line 443, in Lo
adLibrary
return self._dlltype(name)
File "C:\Users\someUser\Anaconda2.1\lib\ctypes\__init__.py", line 365, in __
init__
self._handle = _dlopen(self._name, mode)
WindowsError: [Error 193] %1 is not a valid Win32 application
C:\Users\someUser>spyder --reset
Traceback (most recent call last):
File "C:\Users\someUser\Anaconda2.1\Scripts\spyder-script.py", line 2, in <m
odule>
start_app.main()
File "C:\Users\someUser\Anaconda2.1\lib\site-packages\spyderlib\start_app.py
", line 85, in main
from spyderlib import spyder
File "C:\Users\someUser\Anaconda2.1\lib\site-packages\spyderlib\spyder.py",
line 45, in <module>
from spyderlib.ipythonconfig import IPYTHON_QT_INSTALLED, SUPPORTED_IPYTHON
File "C:\Users\someUser\Anaconda2.1\lib\site-packages\spyderlib\ipythonconfi
g.py", line 22, in <module>
IPYTHON_QT_INSTALLED = is_qtconsole_installed()
File "C:\Users\someUser\Anaconda2.1\lib\site-packages\spyderlib\ipythonconfi
g.py", line 15, in is_qtconsole_installed
pyzmq_installed = programs.is_module_installed('zmq')
File "C:\Users\someUser\Anaconda2.1\lib\site-packages\spyderlib\utils\progra
ms.py", line 272, in is_module_installed
actver = get_module_version(module_name)
File "C:\Users\someUser\Anaconda2.1\lib\site-packages\spyderlib\utils\progra
ms.py", line 218, in get_module_version
mod = __import__(module_name)
File "C:\Python27\Lib\site-packages\zmq\__init__.py", line 41, in <module>
_libzmq = ctypes.cdll.LoadLibrary(bundled[0])
File "C:\Users\someUser\Anaconda2.1\lib\ctypes\__init__.py", line 443, in Lo
adLibrary
return self._dlltype(name)
File "C:\Users\someUser\Anaconda2.1\lib\ctypes\__init__.py", line 365, in __
init__
self._handle = _dlopen(self._name, mode)
WindowsError: [Error 193] %1 is not a valid Win32 application
EDIT: This issue is also preventing iPython Notebooks from opening. Identical error in traceback:
Traceback (most recent call last):
File "C:\Users\eric.adams\Anaconda2.1\Scripts/ipython-script.py", line 5, in <
module>
sys.exit(start_ipython())
File "C:\Python27\Lib\site-packages\IPython\__init__.py", line 120, in start_i
python
return launch_new_instance(argv=argv, **kwargs)
File "C:\Python27\Lib\site-packages\IPython\config\application.py", line 563,
in launch_instance
app.initialize(argv)
File "<string>", line 2, in initialize
File "C:\Python27\Lib\site-packages\IPython\config\application.py", line 92, i
n catch_config_error
return method(app, *args, **kwargs)
File "C:\Python27\Lib\site-packages\IPython\terminal\ipapp.py", line 321, in i
nitialize
super(TerminalIPythonApp, self).initialize(argv)
File "<string>", line 2, in initialize
File "C:\Python27\Lib\site-packages\IPython\config\application.py", line 92, i
n catch_config_error
return method(app, *args, **kwargs)
File "C:\Python27\Lib\site-packages\IPython\core\application.py", line 381, in
initialize
self.parse_command_line(argv)
File "C:\Python27\Lib\site-packages\IPython\terminal\ipapp.py", line 316, in p
arse_command_line
return super(TerminalIPythonApp, self).parse_command_line(argv)
File "<string>", line 2, in parse_command_line
File "C:\Python27\Lib\site-packages\IPython\config\application.py", line 92, i
n catch_config_error
return method(app, *args, **kwargs)
File "C:\Python27\Lib\site-packages\IPython\config\application.py", line 475,
in parse_command_line
return self.initialize_subcommand(subc, subargv)
File "<string>", line 2, in initialize_subcommand
File "C:\Python27\Lib\site-packages\IPython\config\application.py", line 92, i
n catch_config_error
return method(app, *args, **kwargs)
File "C:\Python27\Lib\site-packages\IPython\config\application.py", line 406,
in initialize_subcommand
subapp = import_item(subapp)
File "C:\Python27\Lib\site-packages\IPython\utils\importstring.py", line 42, i
n import_item
module = __import__(package, fromlist=[obj])
File "C:\Python27\Lib\site-packages\IPython\html\notebookapp.py", line 39, in
<module>
check_for_zmq('2.1.11', 'IPython.html')
File "C:\Python27\Lib\site-packages\IPython\utils\zmqrelated.py", line 35, in
check_for_zmq
import zmq
File "C:\Python27\Lib\site-packages\zmq\__init__.py", line 41, in <module>
_libzmq = ctypes.cdll.LoadLibrary(bundled[0])
File "C:\Users\eric.adams\Anaconda2.1\lib\ctypes\__init__.py", line 443, in Lo
adLibrary
return self._dlltype(name)
File "C:\Users\eric.adams\Anaconda2.1\lib\ctypes\__init__.py", line 365, in __
init__
self._handle = _dlopen(self._name, mode)
WindowsError: [Error 193] %1 is not a valid Win32 application
You are picking up an install of Python in C:\Python27 somehow. Do you have the PYTHONPATH environment variable set? If so, unset it.
The easiest solution is to just delete or set aside C:\Python27.