Jupyter notebook is not opening - linux

I have installed anaconda package and my pc has already one package installed "root(data analysis package)".
So after installing anaconda I wanted to open jupyter notebook so I type "jupyter-notebook" in the terminal but somehow I am getting following error.
Could you please provide me a solution for this? Thanks.
the error
Traceback (most recent call last):
File "/home/souvik/anaconda3/bin/jupyter-notebook", line 11, in <module>
sys.exit(main())
File "/home/souvik/anaconda3/lib/python3.9/site-packages/jupyter_core/application.py", line 264, in launch_instance
return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
File "/home/souvik/anaconda3/lib/python3.9/site-packages/traitlets/config/application.py", line 845, in launch_instance
app.initialize(argv)
File "/home/souvik/anaconda3/lib/python3.9/site-packages/traitlets/config/application.py", line 88, in inner
return method(app, *args, **kwargs)
File "/home/souvik/anaconda3/lib/python3.9/site-packages/notebook/notebookapp.py", line 2143, in initialize
super().initialize(argv)
File "/home/souvik/anaconda3/lib/python3.9/site-packages/traitlets/config/application.py", line 88, in inner
return method(app, *args, **kwargs)
File "/home/souvik/anaconda3/lib/python3.9/site-packages/jupyter_core/application.py", line 239, in initialize
self.migrate_config()
File "/home/souvik/anaconda3/lib/python3.9/site-packages/jupyter_core/application.py", line 165, in migrate_config
migrate()
File "/home/souvik/anaconda3/lib/python3.9/site-packages/jupyter_core/migrate.py", line 245, in migrate
with open(os.path.join(env['jupyter_config'], 'migrated'), 'w', encoding='utf-8') as f:
PermissionError: [Errno 13] Permission denied: '/opt/root/6.26.10-install/etc/notebook/migrated'*
I could not find any solution in google for this.

After a glimpse at the error Message,
You seem not to have access to /opt/root/6.26.10-install/etc/notebook/migrated
How did you install the anaconda? (globally or on root?)
since you are currently running as user "souvik"
Try running:
sudo jupyter-notebook --allow-root
Then post back the results.
In case the above command started jupypter-notebook successfully,
we can change the ownership of /opt/root/6.26.10-install/etc/notebook/from rootto you (souvik) using chown.

Related

Kernel error: ipykernel NotImplementedError

Error Message
Traceback (most recent call last):
File "G:\anaconda\envs\jup\lib\runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "G:\anaconda\envs\jup\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "C:\Users\sk_np\AppData\Roaming\Python\Python38\site-packages\ipykernel_launcher.py", line 16, in <module>
app.launch_new_instance()
File "G:\anaconda\envs\jup\lib\site-packages\traitlets\config\application.py", line 844, in launch_instance
app.initialize(argv)
File "G:\anaconda\envs\jup\lib\site-packages\traitlets\config\application.py", line 87, in inner
return method(app, *args, **kwargs)
File "C:\Users\sk_np\AppData\Roaming\Python\Python38\site-packages\ipykernel\kernelapp.py", line 448, in initialize self.init_sockets()
File "C:\Users\sk_np\AppData\Roaming\Python\Python38\site-packages\ipykernel\kernelapp.py", line 251, in init_sockets
self.init_iopub(context)
File "C:\Users\sk_np\AppData\Roaming\Python\Python38\site-packages\ipykernel\kernelapp.py", line 259, in init_iopub self.iopub_thread = IOPubThread(self.iopub_socket, pipe=True)
File "C:\Users\sk_np\AppData\Roaming\Python\Python38\site-packages\ipykernel\iostream.py", line 63, in __init__
self._setup_pipe_in()
File "C:\Users\sk_np\AppData\Roaming\Python\Python38\site-packages\ipykernel\iostream.py", line 126, in _setup_pipe_in
self._pipe_in = ZMQStream(pipe_in, self.io_loop)
File "G:\anaconda\envs\jup\lib\site-packages\zmq\eventloop\zmqstream.py", line 127, in __init__
self._init_io_state()
File "G:\anaconda\envs\jup\lib\site-packages\zmq\eventloop\zmqstream.py", line 552, in _init_io_state
self.io_loop.add_handler(self.socket, self._handle_events, self.io_loop.READ)
File "G:\anaconda\envs\jup\lib\site-packages\tornado\platform\asyncio.py", line 100, in add_handler
self.asyncio_loop.add_reader(fd, self._handle_events, fd, IOLoop.READ)
File "G:\anaconda\envs\jup\lib\asyncio\events.py", line 501, in add_reader
raise NotImplementedError
NotImplementedError
Conda Environment Info:
jupyter-client:7.1.2
jupyter_client:5.3.1
python:3.8.0
I tried This Github Issue and followed the steps of This stackoverflow post.
Reproduction steps:
Install anaconda3
create conda env with conda create -n env python=3.8
conda install -c anaconda jupyter
jupyter notebook
You have apparently anaconda installed, but also a seperate python installation, see how both C:\Users\sk_np\AppData\Roaming\Python\Python38 and G:\anaconda show up in your traceback. This is probably causing the issue due to inconsistencies in the packages. The simplest step, and the one that will save you a lot of headache in the future, would be to uninstall the python that you have at
C:\Users\sk_np\AppData\Roaming\Python\Python38
Additionally, run in your anaconda prompt (from which you tried to start jupyter)
jupyter kernelspec list
and then remove the kernel that is at C:\Users\sk_np\AppData\Roaming\Python\Python38 with
jupyter kernelspec remove <kernelName>

How do I solve kernel error in the console in spyder 3.7

I recently tried to run my code in Spyder 3.7 and my Ipython console showed the following error, this is the case for all my codes:
An error ocurred while starting the kernel
The error is:
Traceback (most recent call last):
File "C:\Users\20191881\AppData\Local\Continuum\anaconda3\lib\site‑packages\spyder\plugins\ipythonconsole.py", line 1572, in create_kernel_manager_and_kernel_client
kernel_manager.start_kernel(stderr=stderr_handle)
File "C:\Users\20191881\AppData\Local\Continuum\anaconda3\lib\site‑packages\jupyter_client\manager.py", line 240, in start_kernel
self.write_connection_file()
File "C:\Users\20191881\AppData\Local\Continuum\anaconda3\lib\site‑packages\jupyter_client\connect.py", line 547, in write_connection_file
kernel_name=self.kernel_name
File "C:\Users\20191881\AppData\Local\Continuum\anaconda3\lib\site‑packages\jupyter_client\connect.py", line 212, in write_connection_file
with secure_write(fname) as f:
File "C:\Users\20191881\AppData\Local\Continuum\anaconda3\lib\contextlib.py", line 112, in __enter__
return next(self.gen)
File "C:\Users\20191881\AppData\Local\Continuum\anaconda3\lib\site‑packages\jupyter_client\connect.py", line 102, in secure_write
with os.fdopen(os.open(fname, open_flag, 0o600), mode) as f:
PermissionError: [Errno 13] Permission denied: 'C:\\Users\\20191881\\AppData\\Roaming\\jupyter\\runtime\\kernel�caf3ec3.json'
I am very new to spyder and I have absolutely no idea how to solve this.
I have already tried to uninstall anaconda and install it again but the same error keeps appearing...
Does anyone have any idea how I could solve this?

Spyder :Error ocurred while starting the kernel

An error occurred while starting the kernel in Spyder
The error is:
Traceback (most recent call last):
File "G:\Anaconda\lib\site‑packages\spyder\plugins\ipythonconsole.py", line 1572, in create_kernel_manager_and_kernel_client
kernel_manager.start_kernel(stderr=stderr_handle)
File "G:\Anaconda\lib\site‑packages\jupyter_client\manager.py", line 240, in start_kernel
self.write_connection_file()
File "G:\Anaconda\lib\site‑packages\jupyter_client\connect.py", line 547, in write_connection_file
kernel_name=self.kernel_name
File "G:\Anaconda\lib\site‑packages\jupyter_client\connect.py", line 212, in write_connection_file
with secure_write(fname) as f:
File "G:\Anaconda\lib\contextlib.py", line 112, in __enter__
return next(self.gen)
File "G:\Anaconda\lib\site‑packages\jupyter_client\connect.py", line 102, in secure_write
with os.fdopen(os.open(fname, open_flag, 0o600), mode) as f:
PermissionError: [Errno 13] Permission denied: 'C:\\Users\\user\\AppData\\Roaming\\jupyter\\runtime\\kernel‑bd9c021b8392.json'
(Spyder maintainer here) To fix this problem please open the Anaconda Prompt and run there
conda update --all
Turn of fire wall and Run spyder as an administrator.

PermissionError: [Errno 13] Permission denied Jupyter notebook on Windows 10 with proxy

I am trying to use jupyter notebook with Python 3.7 on Windows10 for work and am running behind my office network proxy. I was able to run the notebook all fine till a few days ago. Now it keeps showing that the kernel is dead whenever I open the notebook. I get this error to be specific:
File "C:\Users\shreeya.mody\AppData\Local\Continuum\anaconda3\lib\site-packages\tornado\web.py", line 1699, in _execute
result = await result
File "C:\Users\shreeya.mody\AppData\Local\Continuum\anaconda3\lib\site-packages\tornado\gen.py", line 742, in run
yielded = self.gen.throw(*exc_info) # type: ignore
File "C:\Users\shreeya.mody\AppData\Local\Continuum\anaconda3\lib\site-packages\notebook\services\sessions\handlers.py", line 72, in post
type=mtype))
File "C:\Users\shreeya.mody\AppData\Local\Continuum\anaconda3\lib\site-packages\tornado\gen.py", line 735, in run
value = future.result()
File "C:\Users\shreeya.mody\AppData\Local\Continuum\anaconda3\lib\site-packages\tornado\gen.py", line 742, in run
yielded = self.gen.throw(*exc_info) # type: ignore
File "C:\Users\shreeya.mody\AppData\Local\Continuum\anaconda3\lib\site-packages\notebook\services\sessions\sessionmanager.py", line 88, in create_session
kernel_id = yield self.start_kernel_for_session(session_id, path, name, type, kernel_name)
File "C:\Users\shreeya.mody\AppData\Local\Continuum\anaconda3\lib\site-packages\tornado\gen.py", line 735, in run
value = future.result()
File "C:\Users\shreeya.mody\AppData\Local\Continuum\anaconda3\lib\site-packages\tornado\gen.py", line 742, in run
yielded = self.gen.throw(*exc_info) # type: ignore
File "C:\Users\shreeya.mody\AppData\Local\Continuum\anaconda3\lib\site-packages\notebook\services\sessions\sessionmanager.py", line 101, in start_kernel_for_session
self.kernel_manager.start_kernel(path=kernel_path, kernel_name=kernel_name)
File "C:\Users\shreeya.mody\AppData\Local\Continuum\anaconda3\lib\site-packages\tornado\gen.py", line 735, in run
value = future.result()
File "C:\Users\shreeya.mody\AppData\Local\Continuum\anaconda3\lib\site-packages\tornado\gen.py", line 209, in wrapper
yielded = next(result)
File "C:\Users\shreeya.mody\AppData\Local\Continuum\anaconda3\lib\site-packages\notebook\services\kernels\kernelmanager.py", line 168, in start_kernel
super(MappingKernelManager, self).start_kernel(**kwargs)
File "C:\Users\shreeya.mody\AppData\Local\Continuum\anaconda3\lib\site-packages\jupyter_client\multikernelmanager.py", line 110, in start_kernel
km.start_kernel(**kwargs)
File "C:\Users\shreeya.mody\AppData\Local\Continuum\anaconda3\lib\site-packages\jupyter_client\manager.py", line 240, in start_kernel
self.write_connection_file()
File "C:\Users\shreeya.mody\AppData\Local\Continuum\anaconda3\lib\site-packages\jupyter_client\connect.py", line 547, in write_connection_file
kernel_name=self.kernel_name
File "C:\Users\shreeya.mody\AppData\Local\Continuum\anaconda3\lib\site-packages\jupyter_client\connect.py", line 212, in write_connection_file
with secure_write(fname) as f:
File "C:\Users\shreeya.mody\AppData\Local\Continuum\anaconda3\lib\contextlib.py", line 112, in __enter__
return next(self.gen)
File "C:\Users\shreeya.mody\AppData\Local\Continuum\anaconda3\lib\site-packages\jupyter_client\connect.py", line 102, in secure_write
with os.fdopen(os.open(fname, open_flag, 0o600), mode) as f:
PermissionError: [Errno 13] Permission denied: 'C:\\Users\\shreeya.mody\\AppData\\Roaming\\jupyter\\runtime\\kernel-0068da95-ca03-4be1-b2c0-4814f6f887f3.json'
What I have tried
I have exhausted all the solutions online but nothing so far has worked for me
Checked permission for files. Looks correct to me
Uninstalled and reinstalled Anaconda multiple times
Installed anaconda on a work VM to duplicate the error but it works fine there which makes me think that the error is connected to the kernel files somehow that I cannot point at.
Started notebook from Anaconda Prompt
I want to work on Jupyter notebook on my local machine but no solution I have come across works for me.
The command line commands from the comments help:
conda clean -tipsy
conda uninstall jupyter
conda install jupyter
But after the lines the conda environment is almost completely empty. In my case I needed to install numpy and pandas libraries.

Error while installing Selenium in pip3

I am attempting to install selenium, and yet there seems to be a problem:
I ran pip3 install -U selenium, and I get:
Exception:
Traceback (most recent call last):
File "/usr/local/lib/python3.5/site-packages/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/usr/local/lib/python3.5/site-packages/pip/commands/install.py", line 317, in run
prefix=options.prefix_path,
File "/usr/local/lib/python3.5/site-packages/pip/req/req_set.py", line 742, in install
**kwargs
File "/usr/local/lib/python3.5/site-packages/pip/req/req_install.py", line 831, in install
self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
File "/usr/local/lib/python3.5/site-packages/pip/req/req_install.py", line 1032, in move_wheel_files
isolated=self.isolated,
File "/usr/local/lib/python3.5/site-packages/pip/wheel.py", line 378, in move_wheel_files
clobber(source, dest, False, fixer=fixer, filter=filter)
File "/usr/local/lib/python3.5/site-packages/pip/wheel.py", line 317, in clobber
ensure_dir(destdir)
File "/usr/local/lib/python3.5/site-packages/pip/utils/__init__.py", line 83, in ensure_dir
os.makedirs(path)
File "/usr/local/Cellar/python3/3.5.2_2/Frameworks/Python.framework/Versions/3.5/lib/python3.5/os.py", line 231, in makedirs
makedirs(head, mode, exist_ok)
File "/usr/local/Cellar/python3/3.5.2_2/Frameworks/Python.framework/Versions/3.5/lib/python3.5/os.py", line 231, in makedirs
makedirs(head, mode, exist_ok)
File "/usr/local/Cellar/python3/3.5.2_2/Frameworks/Python.framework/Versions/3.5/lib/python3.5/os.py", line 231, in makedirs
makedirs(head, mode, exist_ok)
File "/usr/local/Cellar/python3/3.5.2_2/Frameworks/Python.framework/Versions/3.5/lib/python3.5/os.py", line 241, in makedirs
mkdir(name, mode)
PermissionError: [Errno 13] Permission denied: '/usr/local/selenium'
Despite this message, I can proceed and run selenium in python3, and a command like
from selenium import web driver
browser = webdriver.Firefox()
will return
Traceback (most recent call last):
File "/usr/local/lib/python3.5/site-packages/selenium/webdriver/common/service.py", line 64, in start
stdout=self.log_file, stderr=self.log_file)
File "/usr/local/Cellar/python3/3.5.2_2/Frameworks/Python.framework/Versions/3.5/lib/python3.5/subprocess.py", line 947, in __init__
restore_signals, start_new_session)
File "/usr/local/Cellar/python3/3.5.2_2/Frameworks/Python.framework/Versions/3.5/lib/python3.5/subprocess.py", line 1551, in _execute_child
raise child_exception_type(errno_num, err_msg)
FileNotFoundError: [Errno 2] No such file or directory: 'geckodriver'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.5/site-packages/selenium/webdriver/firefox/webdriver.py", line 135, in __init__
self.service.start()
File "/usr/local/lib/python3.5/site-packages/selenium/webdriver/common/service.py", line 71, in start
os.path.basename(self.path), self.start_error_message)
selenium.common.exceptions.WebDriverException: Message: 'geckodriver' executable needs to be in PATH.
What do I need to do?
It can also be done without executing pip as superuser (which you should, at least, try not to):
Create the directory:
sudo mkdir /usr/local/selenium
Give yourself ownership of the directory:
chown your_username /usr/local/selenium
Install Selenium:
pip3 install -U selenium
Did you try to run pip install as a super user? It's common to have PermissionError when you miss the sudo. If you didn't, try sudo pip3 install -U selenium.

Resources