Failed to start the kernel on jupyter notebook - python

I have python versions 3.6.5_1 and 3.7.0installed via Homebrew.
jupyter needs python3.6 for launching. It wouldn't start if I switch to python3.7.
After launching, it fails to start the kernel. Giving this error:
Traceback (most recent call last):
File "/usr/local/Cellar/jupyter/1.0.0_4/libexec/vendor/lib/python3.6/site-packages/tornado/web.py", line 1543, in _execute
result = yield result
File "/usr/local/Cellar/jupyter/1.0.0_4/libexec/vendor/lib/python3.6/site-packages/tornado/gen.py", line 1099, in run
value = future.result()
File "/usr/local/Cellar/jupyter/1.0.0_4/libexec/vendor/lib/python3.6/site-packages/tornado/gen.py", line 1107, in run
yielded = self.gen.throw(*exc_info)
File "/usr/local/Cellar/jupyter/1.0.0_4/libexec/lib/python3.6/site-packages/notebook/services/sessions/handlers.py", line 73, in post
type=mtype))
File "/usr/local/Cellar/jupyter/1.0.0_4/libexec/vendor/lib/python3.6/site-packages/tornado/gen.py", line 1099, in run
value = future.result()
File "/usr/local/Cellar/jupyter/1.0.0_4/libexec/vendor/lib/python3.6/site-packages/tornado/gen.py", line 1107, in run
yielded = self.gen.throw(*exc_info)
File "/usr/local/Cellar/jupyter/1.0.0_4/libexec/lib/python3.6/site-packages/notebook/services/sessions/sessionmanager.py", line 79, in create_session
kernel_id = yield self.start_kernel_for_session(session_id, path, name, type, kernel_name)
File "/usr/local/Cellar/jupyter/1.0.0_4/libexec/vendor/lib/python3.6/site-packages/tornado/gen.py", line 1099, in run
value = future.result()
File "/usr/local/Cellar/jupyter/1.0.0_4/libexec/vendor/lib/python3.6/site-packages/tornado/gen.py", line 1107, in run
yielded = self.gen.throw(*exc_info)
File "/usr/local/Cellar/jupyter/1.0.0_4/libexec/lib/python3.6/site-packages/notebook/services/sessions/sessionmanager.py", line 92, in start_kernel_for_session
self.kernel_manager.start_kernel(path=kernel_path, kernel_name=kernel_name)
File "/usr/local/Cellar/jupyter/1.0.0_4/libexec/vendor/lib/python3.6/site-packages/tornado/gen.py", line 1099, in run
value = future.result()
File "/usr/local/Cellar/jupyter/1.0.0_4/libexec/vendor/lib/python3.6/site-packages/tornado/gen.py", line 315, in wrapper
yielded = next(result)
File "/usr/local/Cellar/jupyter/1.0.0_4/libexec/lib/python3.6/site-packages/notebook/services/kernels/kernelmanager.py", line 148, in start_kernel
super(MappingKernelManager, self).start_kernel(**kwargs)
File "/usr/local/Cellar/jupyter/1.0.0_4/libexec/lib/python3.6/site-packages/jupyter_client/multikernelmanager.py", line 110, in start_kernel
km.start_kernel(**kwargs)
File "/usr/local/Cellar/jupyter/1.0.0_4/libexec/lib/python3.6/site-packages/jupyter_client/manager.py", line 259, in start_kernel
**kw)
File "/usr/local/Cellar/jupyter/1.0.0_4/libexec/lib/python3.6/site-packages/jupyter_client/manager.py", line 204, in _launch_kernel
return launch_kernel(kernel_cmd, **kw)
File "/usr/local/Cellar/jupyter/1.0.0_4/libexec/lib/python3.6/site-packages/jupyter_client/launcher.py", line 128, in launch_kernel
proc = Popen(cmd, **kwargs)
File "/usr/local/Cellar/python/3.6.5_1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/subprocess.py", line 709, in __init__
restore_signals, start_new_session)
File "/usr/local/Cellar/python/3.6.5_1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/subprocess.py", line 1344, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: '/usr/local/opt/python/bin/python3.7': '/usr/local/opt/python/bin/python3.7'
From what I understand, the kernel is looking for python3.7. My kernel list has just python3
$jupyter kernelspec list
Available kernels:
python3 /usr/local/etc/jupyter/kernels/python3
I looked at this link on github, but it wasn't helpful. How do I make jupyter and the kernel running on the same python version?

Check the kernel specifications:
$jupyter kernelspec list
This will show you the available kernels. In this case:
python3 /usr/local/etc/jupyter/kernels/python3
Open the kernel.json file in this directory and specify the path of python you want the kernel to use in the argv key.

Updating the jupyter notebook resolved the issue for me.
But remember, update it using command line. Not Anaconda Navigator
pip install -U jupyter

In case anyone anyone reading this who runs Jupyter Notebook from within Anaconda and gets the same error:
I found a workaround by installing Jupyter using pip in the command prompt (not anaconda prompt):
$pip install jupyter
and then start Jupyter using the known way
$cd 'DirectoryofyourNotebook'
$jupyter notebook

step 2 command:
conda activate <location of your env folder>
step 3 command:
python -m ipykernel install --user
works!

I had same issue - tried all the above without success.
Context: using Windows on that machine, for a few years. I have used this machine as a "code on the go when I need to" laptop and have not been very careful nor consistent when installing/upgrading python versions or libraries or environments.
The fix for me - somehow a folder that contained f2py.exe (Numpy - on top of which Pandas is built) was not in the path and was in a hidden folder that ended with "\Scripts". Python itself was fine in the environment variables. They were in very different folders - while normally they should be in close branches in the folder tree. Adding the full path of the folder ending with "\Scripts" that have f2py.exe in the environment variables solved the kernel issue for me.

Related

jupyter-notebook fails to recognize any kernel, especially the kernel selected just for its virtual environment [duplicate]

This question already has answers here:
Conda environments not showing up in Jupyter Notebook
(24 answers)
Closed 1 year ago.
I have put several days into sorting out the problem of conda's python virtual environments not recognizing the kernels they were build around. The problem manifests as both Spyder and Jupyter-notebook failing to start with a valid kernel. Here is an example of a conda environment built for kernel 3.8.10 specifically to run pymc3 (per pymc3 environment requirements) and how it fails in the jupyter-notebook also selected and installed specifically in that environment.
The only thing I know for sure: the error message is totally misleading. The win3api dll seems to have nothing to do with the actual problem
Does anyone recognize this? Are there tweaks that will get me going? Or is this another case of Rip-out-and-reinstall-Anaconda3? Which is a familiar refrain.
##########################
Failed to start the kernel
Unhandled error
Traceback (most recent call last):
File "C:\Users\Peter\AppData\Roaming\Python\Python38\site-packages\tornado\web.py", line 1704, in _execute
result = await result
File "C:\Users\Peter\AppData\Roaming\Python\Python38\site-packages\tornado\gen.py", line 769, in run
yielded = self.gen.throw(*exc_info) # type: ignore
File "C:\Users\Peter\anaconda3\lib\site-packages\notebook\services\sessions\handlers.py", line 69, in post
model = yield maybe_future(
File "C:\Users\Peter\AppData\Roaming\Python\Python38\site-packages\tornado\gen.py", line 762, in run
value = future.result()
File "C:\Users\Peter\AppData\Roaming\Python\Python38\site-packages\tornado\gen.py", line 769, in run
yielded = self.gen.throw(*exc_info) # type: ignore
File "C:\Users\Peter\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\Peter\AppData\Roaming\Python\Python38\site-packages\tornado\gen.py", line 762, in run
value = future.result()
File "C:\Users\Peter\AppData\Roaming\Python\Python38\site-packages\tornado\gen.py", line 769, in run
yielded = self.gen.throw(*exc_info) # type: ignore
File "C:\Users\Peter\anaconda3\lib\site-packages\notebook\services\sessions\sessionmanager.py", line 100, in start_kernel_for_session
kernel_id = yield maybe_future(
File "C:\Users\Peter\AppData\Roaming\Python\Python38\site-packages\tornado\gen.py", line 762, in run
value = future.result()
File "C:\Users\Peter\anaconda3\lib\site-packages\notebook\services\kernels\kernelmanager.py", line 176, in start_kernel
kernel_id = await maybe_future(self.pinned_superclass.start_kernel(self, **kwargs))
File "C:\Users\Peter\AppData\Roaming\Python\Python38\site-packages\jupyter_client\multikernelmanager.py", line 186, in start_kernel
km.start_kernel(**kwargs)
File "C:\Users\Peter\AppData\Roaming\Python\Python38\site-packages\jupyter_client\manager.py", line 337, in start_kernel
kernel_cmd, kw = self.pre_start_kernel(**kw)
File "C:\Users\Peter\AppData\Roaming\Python\Python38\site-packages\jupyter_client\manager.py", line 286, in pre_start_kernel
self.write_connection_file()
File "C:\Users\Peter\AppData\Roaming\Python\Python38\site-packages\jupyter_client\connect.py", line 466, in write_connection_file
self.connection_file, cfg = write_connection_file(self.connection_file,
File "C:\Users\Peter\AppData\Roaming\Python\Python38\site-packages\jupyter_client\connect.py", line 136, in write_connection_file
with secure_write(fname) as f:
File "C:\Users\Peter\anaconda3\lib\contextlib.py", line 113, in __enter__
return next(self.gen)
File "C:\Users\Peter\AppData\Roaming\Python\Python38\site-packages\jupyter_core\paths.py", line 461, in secure_write
win32_restrict_file_to_user(fname)
File "C:\Users\Peter\AppData\Roaming\Python\Python38\site-packages\jupyter_core\paths.py", line 387, in win32_restrict_file_to_user
import win32api
ImportError: DLL load failed while importing win32api: The specified procedure could not be found.
​```
First, make sure your environment is activated with conda activate myenv
Next, install ipykernel which provides the IPython kernel for Jupyter:
pip install --user ipykernel
Next you can add your virtual environment to Jupyter by typing:
python -m ipykernel install --user --name=myenv
This should print the following:
Installed kernelspec myenv in /home/user/.local/share/jupyter/kernels/myenv
In this folder you will find a kernel.json file which should look the following way if you did everything correctly:
{
"argv": [
"/home/user/anaconda3/envs/myenv/bin/python",
"-m",
"ipykernel_launcher",
"-f",
"{connection_file}"
],
"display_name": "myenv",
"language": "python"
}
That's it!

Anaconda Jupyter Notebook Kernel error ImportError: DLL load failed while importing win32api: The specified procedure could not be found

I had python 3.8 and jupyter notebook running in visual studio code before. After I installed Anaconda, I cannot run jupyter notebook any longer and am getting a Kernel error.
Traceback (most recent call last):
File "C:\Users\*****\AppData\Roaming\Python\Python38\site-packages\tornado\web.py", line 1704, in _execute
result = await result
File "C:\Users\*****\AppData\Roaming\Python\Python38\site-packages\tornado\gen.py", line 769, in run
yielded = self.gen.throw(*exc_info) # type: ignore
File "C:\ProgramData\Anaconda3\lib\site-packages\notebook\services\sessions\handlers.py", line 69, in post
model = yield maybe_future(
File "C:\Users\*****\AppData\Roaming\Python\Python38\site-packages\tornado\gen.py", line 762, in run
value = future.result()
File "C:\Users\*****\AppData\Roaming\Python\Python38\site-packages\tornado\gen.py", line 769, in run
yielded = self.gen.throw(*exc_info) # type: ignore
File "C:\ProgramData\Anaconda3\lib\site-packages\notebook\services\sessions\sessionmanager.py", line 98, in create_session
kernel_id = yield self.start_kernel_for_session(session_id, path, name, type, kernel_name)
File "C:\Users\*****\AppData\Roaming\Python\Python38\site-packages\tornado\gen.py", line 762, in run
value = future.result()
File "C:\Users\*****\AppData\Roaming\Python\Python38\site-packages\tornado\gen.py", line 769, in run
yielded = self.gen.throw(*exc_info) # type: ignore
File "C:\ProgramData\Anaconda3\lib\site-packages\notebook\services\sessions\sessionmanager.py", line 110, in start_kernel_for_session
kernel_id = yield maybe_future(
File "C:\Users\*****\AppData\Roaming\Python\Python38\site-packages\tornado\gen.py", line 762, in run
value = future.result()
File "C:\ProgramData\Anaconda3\lib\site-packages\notebook\services\kernels\kernelmanager.py", line 176, in start_kernel
kernel_id = await maybe_future(self.pinned_superclass.start_kernel(self, **kwargs))
File "C:\Users\*****\AppData\Roaming\Python\Python38\site-packages\jupyter_client\multikernelmanager.py", line 186, in start_kernel
km.start_kernel(**kwargs)
File "C:\Users\*****\AppData\Roaming\Python\Python38\site-packages\jupyter_client\manager.py", line 337, in start_kernel
kernel_cmd, kw = self.pre_start_kernel(**kw)
File "C:\Users\*****\AppData\Roaming\Python\Python38\site-packages\jupyter_client\manager.py", line 286, in pre_start_kernel
self.write_connection_file()
File "C:\Users\*****\AppData\Roaming\Python\Python38\site-packages\jupyter_client\connect.py", line 466, in write_connection_file
self.connection_file, cfg = write_connection_file(self.connection_file,
File "C:\Users\*****\AppData\Roaming\Python\Python38\site-packages\jupyter_client\connect.py", line 136, in write_connection_file
with secure_write(fname) as f:
File "C:\ProgramData\Anaconda3\lib\contextlib.py", line 113, in __enter__
return next(self.gen)
File "C:\Users\*****\AppData\Roaming\Python\Python38\site-packages\jupyter_core\paths.py", line 461, in secure_write
win32_restrict_file_to_user(fname)
File "C:\Users\*****\AppData\Roaming\Python\Python38\site-packages\jupyter_core\paths.py", line 387, in win32_restrict_file_to_user
import win32api
ImportError: DLL load failed while importing win32api: The specified procedure could not be found.
I have tried conda install ipykernel --update-deps and conda install pywin32 but the issue persists. How can I fix this?
This suggestion worked for me: pip uninstall pywin32 and then conda install it again:
https://github.com/jupyter/notebook/issues/4980#issuecomment-663885620
how to use pip from conda:
Open Anaconda.
Select Environments in the left hand pane below home.
Just to the right of where you selected and below the "search environments" bar, you should see base(root). Click on it.
A triangle pointing right should appear, click on it an select "open terminal"
Use the regular pip install command here.
then how to install pywin32 using anaconda:
ran conda install from anaconda prompt as admin per this website, https://anaconda.org/anaconda/pywin32 :
conda install -c anaconda pywin32

ValueError when trying to use pipenv install

I am totally new to this. So I installed pipenv using 'pip install pipenv'. I have python version 3.8.2, pip version 20.1.1 and pipenv version 2020.6.2 .
But when I try to run 'pipenv install' it gives the following error.
C:\Users\rd463>pipenv install
Traceback (most recent call last):
File "D:\python382\Lib\site-packages\pipenv\vendor\pythonfinder\models\python.py", line 618, in parse_executable
result_version = get_python_version(path)
File "D:\python382\Lib\site-packages\pipenv\vendor\pythonfinder\utils.py", line 105, in get_python_version
c = subprocess.Popen(version_cmd, **subprocess_kwargs)
File "d:\python382\lib\subprocess.py", line 854, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "d:\python382\lib\subprocess.py", line 1307, 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 "d:\python382\lib\runpy.py", line 193, in _run_module_as_main
return _run_code(code, main_globals, None,
File "d:\python382\lib\runpy.py", line 86, in _run_code
exec(code, run_globals)
File "D:\python382\Scripts\pipenv.exe\__main__.py", line 7, in <module>
File "D:\python382\Lib\site-packages\pipenv\vendor\click\core.py", line 829, in __call__
return self.main(*args, **kwargs)
File "D:\python382\Lib\site-packages\pipenv\vendor\click\core.py", line 782, in main
rv = self.invoke(ctx)
File "D:\python382\Lib\site-packages\pipenv\vendor\click\core.py", line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "D:\python382\Lib\site-packages\pipenv\vendor\click\core.py", line 1066, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "D:\python382\Lib\site-packages\pipenv\vendor\click\core.py", line 610, in invoke
return callback(*args, **kwargs)
File "D:\python382\Lib\site-packages\pipenv\vendor\click\decorators.py", line 73, in new_func
return ctx.invoke(f, obj, *args, **kwargs)
File "D:\python382\Lib\site-packages\pipenv\vendor\click\core.py", line 610, in invoke
return callback(*args, **kwargs)
File "D:\python382\Lib\site-packages\pipenv\vendor\click\decorators.py", line 21, in new_func
return f(get_current_context(), *args, **kwargs)
File "d:\python382\lib\site-packages\pipenv\cli\command.py", line 232, in install
retcode = do_install(
File "d:\python382\lib\site-packages\pipenv\core.py", line 1921, in do_install
ensure_project(
File "d:\python382\lib\site-packages\pipenv\core.py", line 576, in ensure_project
ensure_virtualenv(
File "d:\python382\lib\site-packages\pipenv\core.py", line 498, in ensure_virtualenv
python = ensure_python(three=three, python=python)
File "d:\python382\lib\site-packages\pipenv\core.py", line 388, in ensure_python
path_to_python = find_a_system_python(python)
File "d:\python382\lib\site-packages\pipenv\core.py", line 350, in find_a_system_python
return next(iter(finder.find_all_python_versions()), None)
File "d:\python382\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 "d:\python382\lib\site-packages\pipenv\vendor\pythonfinder\pythonfinder.py", line 120, in system_path
self._system_path = self.create_system_path()
File "d:\python382\lib\site-packages\pipenv\vendor\pythonfinder\pythonfinder.py", line 82, in create_system_path
return pyfinder_path.SystemPath.create(
File "D:\python382\Lib\site-packages\pipenv\vendor\pythonfinder\models\path.py", line 682, in create
instance = instance._run_setup()
File "D:\python382\Lib\site-packages\pipenv\vendor\pythonfinder\models\path.py", line 233, in _run_setup
new_instance = new_instance._setup_windows()
File "D:\python382\Lib\site-packages\pipenv\vendor\pythonfinder\models\path.py", line 411, in _setup_windows
windows_finder = WindowsFinder.create()
File "D:\python382\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 "D:\python382\Lib\site-packages\pipenv\vendor\pythonfinder\models\windows.py", line 113, in get_versions
versions[py_version.version_tuple[:5]] = base_dir
File "D:\python382\Lib\site-packages\pipenv\vendor\pythonfinder\models\python.py", line 365, in __getattribute__
result = super(PythonVersion, self).__getattribute__(key)
File "D:\python382\Lib\site-packages\pipenv\vendor\pythonfinder\models\python.py", line 430, in version_tuple
self.patch,
File "D:\python382\Lib\site-packages\pipenv\vendor\pythonfinder\models\python.py", line 375, in __getattribute__
instance_dict = self.parse_executable(executable)
File "D:\python382\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: 'D:/program_files/Anaconda3/Scripts/python.exe'
Running 'python -m pipenv.help' gives -
C:\Users\rd463>python -m pipenv.help
$ pipenv --support
Pipenv version: '2020.6.2'
Pipenv location: 'D:\\python382\\lib\\site-packages\\pipenv'
Python location: 'D:\\python382\\python.exe'
Python installations found:
followed by the same error again.
I have python installed in 'D:/python382'
There is no such directory that the error mentions. I have checked my environment variables and everything is fine there too. Please help me with this error.
Thank you for your time.
I think the newer version of pipenv is causing the error, I use this command when having the same issue and it worked for me, just use
pip install pipenv==2018.10.13
I had the same problem when I uninstalled Anaconda. Mine got solved after I did the following steps
run regedit.exe
Go to
Computer\HKEY_CURRENT_USER\Software\Python\PythonCore
If there is/are folders having previous versions of python.Delete every version of python other than your current one(for eg.3.7, 3.8 etc. I also had to delete some folder containing something related to anaconda to solve the problem (other than the previous versions)
I was just struggling with a similar problem with pipenv that was giving me the same error messages.
WinError 2 has to do with corrupted files in one of your Python installs/uninstalls. I searched regedit for Anaconda3 to figure out which version of Python that I had previously installed or uninstalled was causing the problem.
For me, it was Python 3.6.5. I installed it in the same location as the path in the error message (in your case that would be D:/program_files/). Then, I just uninstalled it with the installation exe, and I stopped getting these error messages.
Have you tried the conda install command? To do this, go on your anaconda prompt, cd in the folder where you have installed your anaconda. Have a look at this.
conda install -c conda-forge pipenv
make sure you activate your environment before running the conda install command. To activate your environment run conda activate envname. I hope it helps!

When I open Jupyter Notebook there is a Kernel Error appears

I've been trying to work on a Python project about object detection with TensorFlow. Everything was okay until I run my Jupyter Notebook in my environment "tensorflow1". When Jupyter Notebook opens there is a red Kernel Error appearing at the top righthand side of my window. When I click it gives a message like
Traceback (most recent call last):
File
"C:\Users\Yasin\AppData\Roaming\Python\Python36\site-packages\tornado\web.py",
line 1699, in _execute
result = await result File "C:\Users\Yasin\AppData\Roaming\Python\Python36\site-packages\tornado\gen.py",
line 742, in run
yielded = self.gen.throw(*exc_info) # type: ignore File "C:\Users\Yasin\AppData\Roaming\Python\Python36\site-packages\notebook\services\sessions\handlers.py",
line 72, in post
type=mtype)) File "C:\Users\Yasin\AppData\Roaming\Python\Python36\site-packages\tornado\gen.py",
line 735, in run
value = future.result() File "C:\Users\Yasin\AppData\Roaming\Python\Python36\site-packages\tornado\gen.py",
line 742, in run
yielded = self.gen.throw(*exc_info) # type: ignore File "C:\Users\Yasin\AppData\Roaming\Python\Python36\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\Yasin\AppData\Roaming\Python\Python36\site-packages\tornado\gen.py",
line 735, in run
value = future.result() File "C:\Users\Yasin\AppData\Roaming\Python\Python36\site-packages\tornado\gen.py",
line 742, in run
yielded = self.gen.throw(*exc_info) # type: ignore File "C:\Users\Yasin\AppData\Roaming\Python\Python36\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\Yasin\AppData\Roaming\Python\Python36\site-packages\tornado\gen.py",
line 735, in run
value = future.result() File "C:\Users\Yasin\AppData\Roaming\Python\Python36\site-packages\tornado\gen.py",
line 209, in wrapper
yielded = next(result) File "C:\Users\Yasin\AppData\Roaming\Python\Python36\site-packages\notebook\services\kernels\kernelmanager.py",
line 168, in start_kernel
super(MappingKernelManager, self).start_kernel(**kwargs) File "C:\Users\Yasin\AppData\Roaming\Python\Python36\site-packages\jupyter_client\multikernelmanager.py",
line 110, in start_kernel
km.start_kernel(**kwargs) File "C:\Users\Yasin\AppData\Roaming\Python\Python36\site-packages\jupyter_client\manager.py",
line 240, in start_kernel
self.write_connection_file() File "C:\Users\Yasin\AppData\Roaming\Python\Python36\site-packages\jupyter_client\connect.py",
line 476, in write_connection_file
kernel_name=self.kernel_name File "C:\Users\Yasin\AppData\Roaming\Python\Python36\site-packages\jupyter_client\connect.py",
line 141, in write_connection_file
with secure_write(fname) as f: File "D:\Anaconda\envs\tensorflow1\lib\contextlib.py", line 81, in
enter
return next(self.gen) File "C:\Users\Yasin\AppData\Roaming\Python\Python36\site-packages\jupyter_core\paths.py",
line 424, in secure_write
win32_restrict_file_to_user(fname) File "C:\Users\Yasin\AppData\Roaming\Python\Python36\site-packages\jupyter_core\paths.py",
line 359, in win32_restrict_file_to_user
import win32api
ImportError: DLL load failed: The specified procedure could not be
found.
I tried to change the Kernel but I had only one Kernel called "Python3". I tried to remove it and created a new Kernel called "Python tensorflow1". I tried to run the codes with that Kernel and it still gives me that red error.
It also says Failed to start the Kernel.
Please activate the environment tensorflow1 and install ipykernel in that environment uing below commands:
conda activate tensorflow1
conda install ipykernel
ipython kernel install --name tensorflow1 --user
Then try to use access jupyter notebook using the below command:
jupyter notebook
If the above steps doesn't work please follow the below steps to create a new conda environment and access jupyter notebook from that environment:
conda create -n env_tf -c intel python=3.6
Once the conda environment is created successfully, you can list the environment using the below command:
conda env list
It should be listing :
D:\Anaconda\envs\env_tf
Activate the environment using the below command:
conda activate env_tf
Install ipykernel in the activated environment:
conda install ipykernel
ipython kernel install --name env_tf --user
Access jupyter notebook using below command:
jupyter notebook
Hope this helps.

Conda stopped working

I was installing pymc through conda, and it told me to update a few of the files so no problem. However, after updating, it gave an OSError, and now, I cannot access any conda build commands. Now, when I type any conda command, it gives me
-bash: conda: command not found
I checked the bash_profile, and .bashrc, and both have the appropriate PATH for conda, and most modules installed through conda still works. Running python and checking the version yields
Python 2.7.11 :: Anaconda custom (x86_64)
Looking at the ~/anaconda/bin, I see that the conda folder is not there. Is there anyway to fix this? Is the only solution to re-install anaconda?
Sorry, I do not have any of the terminal outputs since I closed all my windows. Also, I didn't realize I was running Jupyter notebook in the background, but this shouldn't have a problem. Jupyter no longer runs, and yields the error
[W 01:34:35.979 NotebookApp] Unrecognized JSON config file version, assuming version 1
Traceback (most recent call last):
File "/Users/kaichang/anaconda/bin/jupyter-notebook", line 6, in <module>
sys.exit(notebook.notebookapp.main())
File "/Users/kaichang/anaconda/lib/python2.7/site-packages/jupyter_core/application.py", line 267, in launch_instance
return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
File "/Users/kaichang/anaconda/lib/python2.7/site-packages/traitlets/config/application.py", line 595, in launch_instance
app.initialize(argv)
File "<decorator-gen-7>", line 2, in initialize
File "/Users/kaichang/anaconda/lib/python2.7/site-packages/traitlets/config/application.py", line 74, in catch_config_error
return method(app, *args, **kwargs)
File "/Users/kaichang/anaconda/lib/python2.7/site-packages/notebook/notebookapp.py", line 1069, in initialize
self.init_configurables()
File "/Users/kaichang/anaconda/lib/python2.7/site-packages/notebook/notebookapp.py", line 837, in init_configurables
parent=self,
File "/Users/kaichang/anaconda/lib/python2.7/site-packages/nb_conda_kernels/manager.py", line 19, in __init__
specs = self.find_kernel_specs() or {}
File "/Users/kaichang/anaconda/lib/python2.7/site-packages/nb_conda_kernels/manager.py", line 129, in find_kernel_specs
self.conda_info = self._conda_info()
File "/Users/kaichang/anaconda/lib/python2.7/site-packages/nb_conda_kernels/manager.py", line 29, in _conda_info
p = subprocess.check_output(["conda", "info", "--json"]
File "/Users/kaichang/anaconda/lib/python2.7/subprocess.py", line 566, in check_output
process = Popen(stdout=PIPE, *popenargs, **kwargs)
File "/Users/kaichang/anaconda/lib/python2.7/subprocess.py", line 710, in __init__
errread, errwrite)
File "/Users/kaichang/anaconda/lib/python2.7/subprocess.py", line 1335, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
Sorry, I'm just not entirely sure what is going on.
Looking at the ~/anaconda/bin, I see that the conda folder is not
there. Is there anyway to fix this?
In answer to this, you can try overwriting your conda installation:
bash /path/to/Miniconda2-latest-MacOSX-x86_64.sh -bfp /Users/kaichang/anaconda/

Categories