Getting error in launching jupyter notebook - python

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.

Related

Why "pipenv install requests" command on windows powershell is showing error? [duplicate]

This question already has answers here:
pipenv Failing to Install Packages
(3 answers)
Closed 1 year ago.
I have already installed python's latest version and pipenv on Windows Powershell. When I try to install requests it is showing this error:
FileNotFoundError: [WinError 2] The system cannot find the file specified
ValueError: Not a valid python path: 'C:/ProgramData/Anaconda3/python.exe'
Full error code:
Traceback (most recent call last):
File "C:\Python39\Lib\site-packages\pipenv\vendor\pythonfinder\models\python.py", line 618, in parse_executable
result_version = get_python_version(path)
File "C:\Python39\Lib\site-packages\pipenv\vendor\pythonfinder\utils.py", line 105, in get_python_version
c = subprocess.Popen(version_cmd, **subprocess_kwargs)
File "c:\python39\lib\subprocess.py", line 951, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "c:\python39\lib\subprocess.py", line 1420, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the file specified
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "c:\python39\lib\runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "c:\python39\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "C:\Python39\Scripts\pipenv.exe\__main__.py", line 7, in <module>
File "C:\Python39\Lib\site-packages\pipenv\vendor\click\core.py", line 829, in __call__
return self.main(*args, **kwargs)
File "C:\Python39\Lib\site-packages\pipenv\vendor\click\core.py", line 782, in main
rv = self.invoke(ctx)
File "C:\Python39\Lib\site-packages\pipenv\vendor\click\core.py", line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "C:\Python39\Lib\site-packages\pipenv\vendor\click\core.py", line 1066, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "C:\Python39\Lib\site-packages\pipenv\vendor\click\core.py", line 610, in invoke
return callback(*args, **kwargs)
File "C:\Python39\Lib\site-packages\pipenv\vendor\click\decorators.py", line 73, in new_func
return ctx.invoke(f, obj, *args, **kwargs)
File "C:\Python39\Lib\site-packages\pipenv\vendor\click\core.py", line 610, in invoke
return callback(*args, **kwargs)
File "C:\Python39\Lib\site-packages\pipenv\vendor\click\decorators.py", line 21, in new_func
return f(get_current_context(), *args, **kwargs)
File "c:\python39\lib\site-packages\pipenv\cli\command.py", line 233, in install
retcode = do_install(
File "c:\python39\lib\site-packages\pipenv\core.py", line 1920, in do_install
ensure_project(
File "c:\python39\lib\site-packages\pipenv\core.py", line 576, in ensure_project
ensure_virtualenv(
File "c:\python39\lib\site-packages\pipenv\core.py", line 498, in ensure_virtualenv
python = ensure_python(three=three, python=python)
File "c:\python39\lib\site-packages\pipenv\core.py", line 388, in ensure_python
path_to_python = find_a_system_python(python)
File "c:\python39\lib\site-packages\pipenv\core.py", line 350, in find_a_system_python
return next(iter(finder.find_all_python_versions()), None)
File "c:\python39\lib\site-packages\pipenv\vendor\pythonfinder\pythonfinder.py", line 312, in find_all_python_versions
python_version_dict = getattr(self.system_path, "python_version_dict", {})
File "c:\python39\lib\site-packages\pipenv\vendor\pythonfinder\pythonfinder.py", line 120, in system_path
self._system_path = self.create_system_path()
File "c:\python39\lib\site-packages\pipenv\vendor\pythonfinder\pythonfinder.py", line 82, in create_system_path
return pyfinder_path.SystemPath.create(
File "C:\Python39\Lib\site-packages\pipenv\vendor\pythonfinder\models\path.py", line 682, in create
instance = instance._run_setup()
File "C:\Python39\Lib\site-packages\pipenv\vendor\pythonfinder\models\path.py", line 233, in _run_setup
new_instance = new_instance._setup_windows()
File "C:\Python39\Lib\site-packages\pipenv\vendor\pythonfinder\models\path.py", line 411, in _setup_windows
windows_finder = WindowsFinder.create()
File "C:\Python39\Lib\site-packages\pipenv\vendor\pythonfinder\models\windows.py", line 146, in create
return cls()
File "<attrs generated init pythonfinder.models.windows.WindowsFinder>", line 13, in __init__
File "C:\Python39\Lib\site-packages\pipenv\vendor\pythonfinder\models\windows.py", line 113, in get_versions
versions[py_version.version_tuple[:5]] = base_dir
File "C:\Python39\Lib\site-packages\pipenv\vendor\pythonfinder\models\python.py", line 365, in __getattribute__
result = super(PythonVersion, self).__getattribute__(key)
File "C:\Python39\Lib\site-packages\pipenv\vendor\pythonfinder\models\python.py", line 430, in version_tuple
self.patch,
File "C:\Python39\Lib\site-packages\pipenv\vendor\pythonfinder\models\python.py", line 375, in __getattribute__
instance_dict = self.parse_executable(executable)
File "C:\Python39\Lib\site-packages\pipenv\vendor\pythonfinder\models\python.py", line 620, in parse_executable
raise ValueError("Not a valid python path: %r" % path)
ValueError: Not a valid python path: 'C:/ProgramData/Anaconda3/python.exe'
It seems like you have two different Python distributions installed on your system: the Python 3.9 in C:\Python39\ and the Anaconda Python in C:/ProgramData/Anaconda3/. There is a conflict between them.
I recommend that you use one of them only - the Anaconda or the official Python, and uninstall another.

ImportError: No module named functools_lrc_cache (discord.py bot)

I'm trying to set up a Discord modmail bot and host it on my Raspberry Pi, however I seem to be getting a traceback error that ends with ImportError: No module named functools_lrc_cache. I'm using Python 3.7 and pipenv to run the bot.py file. What could I do to resolve it?
Here below is the full Traceback error and the steps I'm following for selfhosting the bot: https://taaku18.github.io/modmail/local-hosting/
Traceback (most recent call last):
File "/home/pi/.local/bin/pipenv", line 10, in <module>
sys.exit(cli())
File "/home/pi/.local/lib/python2.7/site-packages/pipenv/vendor/click/core.py", line 829, in __call__
return self.main(*args, **kwargs)
File "/home/pi/.local/lib/python2.7/site-packages/pipenv/vendor/click/core.py", line 782, in main
rv = self.invoke(ctx)
File "/home/pi/.local/lib/python2.7/site-packages/pipenv/vendor/click/core.py", line 1236, in invoke
return Command.invoke(self, ctx)
File "/home/pi/.local/lib/python2.7/site-packages/pipenv/vendor/click/core.py", line 1066, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/home/pi/.local/lib/python2.7/site-packages/pipenv/vendor/click/core.py", line 610, in invoke
return callback(*args, **kwargs)
File "/home/pi/.local/lib/python2.7/site-packages/pipenv/vendor/click/decorators.py", line 73, in new_func
return ctx.invoke(f, obj, *args, **kwargs)
File "/home/pi/.local/lib/python2.7/site-packages/pipenv/vendor/click/core.py", line 610, in invoke
return callback(*args, **kwargs)
File "/home/pi/.local/lib/python2.7/site-packages/pipenv/vendor/click/decorators.py", line 21, in new_func
return f(get_current_context(), *args, **kwargs)
File "/home/pi/.local/lib/python2.7/site-packages/pipenv/cli/command.py", line 204, in cli
clear=state.clear,
File "/home/pi/.local/lib/python2.7/site-packages/pipenv/core.py", line 580, in ensure_project
pypi_mirror=pypi_mirror,
File "/home/pi/.local/lib/python2.7/site-packages/pipenv/core.py", line 498, in ensure_virtualenv
python = ensure_python(three=three, python=python)
File "/home/pi/.local/lib/python2.7/site-packages/pipenv/core.py", line 388, in ensure_python
path_to_python = find_a_system_python(python)
File "/home/pi/.local/lib/python2.7/site-packages/pipenv/core.py", line 347, in find_a_system_python
from .vendor.pythonfinder import Finder
File "/home/pi/.local/lib/python2.7/site-packages/pipenv/vendor/pythonfinder/__init__.py", line 10, in <module>
from .models import SystemPath, WindowsFinder
File "/home/pi/.local/lib/python2.7/site-packages/pipenv/vendor/pythonfinder/models/__init__.py", line 11, in <module>
from ..utils import KNOWN_EXTS, unnest
File "/home/pi/.local/lib/python2.7/site-packages/pipenv/vendor/pythonfinder/utils.py", line 17, in <module>
from .compat import Path, lru_cache, TimeoutError # noqa
File "/home/pi/.local/lib/python2.7/site-packages/pipenv/vendor/pythonfinder/compat.py", line 15, in <module>
from backports.functools_lru_cache import lru_cache # type: ignore # noqa
ImportError: No module named functools_lru_cache

Issue while trying to run $pipenv --python 3.7

I'm having issues while trying to run $pipenv --python 3.7, in this case I am running it while inside my virtual environment. As I see, this could be having trouble with another virtual environment called venvAmazon, thar I don't need or use anymore.
I noticed that, when I created my actual virtual environment, 1. it didn't created a pipfile, 2. It was created in python 2.7. (I do have 3.7 in my pc), 3. It also throws me an error if I try to run outside the venv
Traceback (most recent call last):
File "/home/daniel/.local/lib/python3.6/site-packages/pipenv/vendor/pythonfinder/models/python.py", line 112, in get_versions
version = PythonVersion.parse(p.name)
File "/home/daniel/.local/lib/python3.6/site-packages/pipenv/vendor/pythonfinder/models/python.py", line 359, in parse
version_dict = parse_python_version(str(version))
File "/home/daniel/.local/lib/python3.6/site-packages/pipenv/vendor/pythonfinder/utils.py", line 86, in parse_python_version
raise InvalidPythonVersion("%s is not a python version" % version_str)
pipenv.vendor.pythonfinder.exceptions.InvalidPythonVersion: venvAmazon is not a python version
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/daniel/.local/bin/pipenv", line 11, in <module>
sys.exit(cli())
File "/home/daniel/.local/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 764, in __call__
return self.main(*args, **kwargs)
File "/home/daniel/.local/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 717, in main
rv = self.invoke(ctx)
File "/home/daniel/.local/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 1114, in invoke
return Command.invoke(self, ctx)
File "/home/daniel/.local/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/home/daniel/.local/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 555, in invoke
return callback(*args, **kwargs)
File "/home/daniel/.local/lib/python3.6/site-packages/pipenv/vendor/click/decorators.py", line 64, in new_func
return ctx.invoke(f, obj, *args, **kwargs)
File "/home/daniel/.local/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 555, in invoke
return callback(*args, **kwargs)
File "/home/daniel/.local/lib/python3.6/site-packages/pipenv/vendor/click/decorators.py", line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File "/home/daniel/.local/lib/python3.6/site-packages/pipenv/cli/command.py", line 208, in cli
clear=state.clear,
File "/home/daniel/.local/lib/python3.6/site-packages/pipenv/core.py", line 574, in ensure_project
pypi_mirror=pypi_mirror,
File "/home/daniel/.local/lib/python3.6/site-packages/pipenv/core.py", line 516, in ensure_virtualenv
ensure_python(three=three, python=python)
File "/home/daniel/.local/lib/python3.6/site-packages/pipenv/core.py", line 397, in ensure_python
path_to_python = find_a_system_python(python)
File "/home/daniel/.local/lib/python3.6/site-packages/pipenv/core.py", line 360, in find_a_system_python
python_entry = finder.find_python_version(line)
File "/home/daniel/.local/lib/python3.6/site-packages/pipenv/vendor/pythonfinder/pythonfinder.py", line 113, in find_python_version
return self.system_path.find_python_version(
File "/home/daniel/.local/lib/python3.6/site-packages/pipenv/vendor/pythonfinder/pythonfinder.py", line 54, in system_path
ignore_unsupported=self.ignore_unsupported,
File "/home/daniel/.local/lib/python3.6/site-packages/pipenv/vendor/pythonfinder/models/path.py", line 451, in create
ignore_unsupported=ignore_unsupported,
File "<attrs generated init 75e45f144e3d5510d54dd5fca6730b98fa0220a9>", line 38, in __init__
File "/home/daniel/.local/lib/python3.6/site-packages/pipenv/vendor/pythonfinder/models/path.py", line 116, in __attrs_post_init__
self._setup_pyenv()
File "/home/daniel/.local/lib/python3.6/site-packages/pipenv/vendor/pythonfinder/models/path.py", line 196, in _setup_pyenv
version_glob_path="versions/*", ignore_unsupported=self.ignore_unsupported
File "/home/daniel/.local/lib/python3.6/site-packages/pipenv/vendor/pythonfinder/models/python.py", line 156, in create
sort_function=sort_function, version_glob_path=version_glob_path)
File "<attrs generated init 3d06d7bc6a0a13af152279598b774c410bafffe4>", line 17, in __init__
File "/home/daniel/.local/lib/python3.6/site-packages/pipenv/vendor/pythonfinder/models/python.py", line 114, in get_versions
entry = next(iter(version_path.find_all_python_versions()), None)
AttributeError: 'NoneType' object has no attribute 'find_all_python_versions'
After I tried pip install --upgrade --pre pipenv It gave me another error:
File "/home/daniel/.local/lib/python2.7/site-packages/pipenv/core.py", line 541, in ensure_virtualenv
pypi_mirror=pypi_mirror,
File "/home/daniel/.local/lib/python2.7/site-packages/pipenv/core.py", line 541, in ensure_virtualenv
pypi_mirror=pypi_mirror,
File "/home/daniel/.local/lib/python2.7/site-packages/pipenv/core.py", line 541, in ensure_virtualenv
pypi_mirror=pypi_mirror,
File "/home/daniel/.local/lib/python2.7/site-packages/pipenv/core.py", line 535, in ensure_virtualenv
cleanup_virtualenv(bare=True)
File "/home/daniel/.local/lib/python2.7/site-packages/pipenv/core.py", line 181, in cleanup_virtualenv
vistir.path.rmtree(project.virtualenv_location)
File "/home/daniel/.local/lib/python2.7/site-packages/pipenv/vendor/vistir/path.py", line 433, in rmtree
shutil.rmtree(directory, ignore_errors=ignore_errors, onerror=onerror)
File "/usr/lib/python2.7/shutil.py", line 270, in rmtree
rmtree(fullname, ignore_errors, onerror)
File "/usr/lib/python2.7/shutil.py", line 275, in rmtree
onerror(os.remove, fullname, sys.exc_info())
File "/home/daniel/.local/lib/python2.7/site-packages/pipenv/vendor/vistir/path.py", line 494, in handle_remove_readonly
if is_readonly_path(path):
File "/home/daniel/.local/lib/python2.7/site-packages/pipenv/vendor/vistir/path.py", line 263, in is_readonly_path
fn = fs_decode(fs_encode(fn))
File "/home/daniel/.local/lib/python2.7/site-packages/pipenv/vendor/vistir/compat.py", line 382, in fs_encode
path = _get_path(path)
File "/home/daniel/.local/lib/python2.7/site-packages/pipenv/vendor/vistir/compat.py", line 297, in _get_path
if isinstance(path, (six.string_types, bytes)):
RuntimeError: maximum recursion depth exceeded while calling a Python object
It seems this is a currently open issue with pipenv. It might worth trying what they suggest there:
pip install --upgrade --pre pipenv

AttributeError after running pipenv commands

There is an error occured during running pipenv command:
Traceback (most recent call last):
File "c:\python37\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "c:\python37\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Python37\Scripts\pipenv.exe\__main__.py", line 9, in <module>
File "c:\python37\lib\site-packages\pipenv\vendor\click\core.py", line 764, in __call__
return self.main(*args, **kwargs)
File "c:\python37\lib\site-packages\pipenv\vendor\click\core.py", line 717, in main
rv = self.invoke(ctx)
File "c:\python37\lib\site-packages\pipenv\vendor\click\core.py", line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "c:\python37\lib\site-packages\pipenv\vendor\click\core.py", line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "c:\python37\lib\site-packages\pipenv\vendor\click\core.py", line 555, in invoke
return callback(*args, **kwargs)
File "c:\python37\lib\site-packages\pipenv\vendor\click\decorators.py", line 64, in new_func
return ctx.invoke(f, obj, *args, **kwargs)
File "c:\python37\lib\site-packages\pipenv\vendor\click\core.py", line 555, in invoke
return callback(*args, **kwargs)
File "c:\python37\lib\site-packages\pipenv\cli\command.py", line 390, in shell
pypi_mirror=state.pypi_mirror,
File "c:\python37\lib\site-packages\pipenv\core.py", line 2156, in do_shell
three=three, python=python, validate=False, pypi_mirror=pypi_mirror,
File "c:\python37\lib\site-packages\pipenv\core.py", line 574, in ensure_project
pypi_mirror=pypi_mirror,
File "c:\python37\lib\site-packages\pipenv\core.py", line 494, in ensure_virtualenv
python = ensure_python(three=three, python=python)
File "c:\python37\lib\site-packages\pipenv\core.py", line 397, in ensure_python
path_to_python = find_a_system_python(python)
File "c:\python37\lib\site-packages\pipenv\core.py", line 360, in find_a_system_python
python_entry = finder.find_python_version(line)
File "c:\python37\lib\site-packages\pipenv\vendor\pythonfinder\pythonfinder.py", line 108, in find_python_version
match = self.windows_finder.find_python_version(
File "c:\python37\lib\site-packages\pipenv\vendor\pythonfinder\pythonfinder.py", line 63, in windows_finder
self._windows_finder = WindowsFinder()
File "<attrs generated init 4868f44fa19b631f0a86b928e7558f26948d224e>", line 13, in __init__
File "c:\python37\lib\site-packages\pipenv\vendor\pythonfinder\models\windows.py", line 92, in get_versions
py_version = PythonVersion.from_windows_launcher(version_object)
File "c:\python37\lib\site-packages\pipenv\vendor\pythonfinder\models\python.py", line 417, in from_windows_launcher
creation_dict = cls.parse(launcher_entry.info.version)
File "c:\python37\lib\site-packages\pipenv\vendor\pythonfinder\_vendor\pep514tools\_registry.py", line 75, in __getattr__
raise AttributeError(attr)
AttributeError: version
Pipenv version: 2018.11.26
Python version: 3.7.2
What should I do to fix it?

Jupyter Notebook won't run python 3 - import pygments error

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?

Categories

Resources