Tensorflow breaks pip on anaconda, windows os - python-3.x

Last version of anaconda, windows 10, python 3.6.
Installing tensorflow seems to break pip.
>conda create -n py6 python=3.6
>activate py6
>conda install tensorflow
>pip install tweepy
Collecting tweepy
Exception:
Traceback (most recent call last):
File "C:\Programs\Anaconda3\envs\py6\lib\site-packages\pip\basecommand.py", line 215, in main
status = self.run(options, args)
File "C:\Programs\Anaconda3\envs\py6\lib\site-packages\pip\commands\install.py", line 335, in run
wb.build(autobuilding=True)
File "C:\Programs\Anaconda3\envs\py6\lib\site-packages\pip\wheel.py", line 749, in build
self.requirement_set.prepare_files(self.finder)
File "C:\Programs\Anaconda3\envs\py6\lib\site-packages\pip\req\req_set.py", line 380, in prepare_files
ignore_dependencies=self.ignore_dependencies))
File "C:\Programs\Anaconda3\envs\py6\lib\site-packages\pip\req\req_set.py", line 554, in _prepare_file
require_hashes
File "C:\Programs\Anaconda3\envs\py6\lib\site-packages\pip\req\req_install.py", line 278, in populate_link
self.link = finder.find_requirement(self, upgrade)
File "C:\Programs\Anaconda3\envs\py6\lib\site-packages\pip\index.py", line 465, in find_requirement
all_candidates = self.find_all_candidates(req.name)
File "C:\Programs\Anaconda3\envs\py6\lib\site-packages\pip\index.py", line 423, in find_all_candidates
for page in self._get_pages(url_locations, project_name):
File "C:\Programs\Anaconda3\envs\py6\lib\site-packages\pip\index.py", line 568, in _get_pages
page = self._get_page(location)
File "C:\Programs\Anaconda3\envs\py6\lib\site-packages\pip\index.py", line 683, in _get_page
return HTMLPage.get_page(link, session=self.session)
File "C:\Programs\Anaconda3\envs\py6\lib\site-packages\pip\index.py", line 811, in get_page
inst = cls(resp.content, resp.url, resp.headers)
File "C:\Programs\Anaconda3\envs\py6\lib\site-packages\pip\index.py", line 731, in __init__
namespaceHTMLElements=False,
TypeError: parse() got an unexpected keyword argument 'transport_encoding'
Use of tweepy is just an example, pip cannot install any package.
The same happens when installing tensorflow using pip, and when using a python 3.5 virtual environment.
Probably this is due to some package update gone wrong, and it will be fixed in the next update.
Meanwhile, any fix or any careful selection of working version numbers is welcome.

This issues is reported in the following ticket : https://github.com/tensorflow/tensorboard/issues/588
To solve this, you need to repair html5lib.
Or alternatively,
you can make use of anaconda to re-install
conda install -c anaconda html5lib

Related

aws git-remote-codecommit operation error (GRC)

I hit this error when using git with a remote codecommit repo using GRC protocol.
git fetch
Traceback (most recent call last):
File "/home/meh/.local/bin/git-remote-codecommit", line 6, in <module>
from pkg_resources import load_entry_point
File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 3095, in <module>
#_call_aside
File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 3079, in _call_aside
f(*args, **kwargs)
File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 3108, in _initialize_master_working_set
working_set = WorkingSet._build_master()
File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 570, in _build_master
ws.require(__requires__)
File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 888, in require
needed = self.resolve(parse_requirements(requirements))
File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 774, in resolve
raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'jmespath<2.0.0,>=0.7.1' distribution was not found and is required by botocore
Answering my own question in case other hit this issue.
I'm using oracle linux 8 install atm, and installed python3 and and awscli + boto from an rpm.
for me the fix was to install jmespath from yum. It's not obvious at first but this is part of the python package family. to fix the issue you need to install the additional python3-jmespath package.
Example:
sudo yum install python3-jmespath.noarch

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>

Kernel error in spyder and jupyter notebook

I tried to use the Anaconda Navigator, but I'm getting this kernel error.
I had previously installed python 3.8 without Anaconda and had installed jupyter in it using pip, then I uninstalled it and installed Anaconda again.
Since then this error arises whenever I try to compile a file and even in the jupyter notebook.
I tried :
1.) Reinstalling Anaconda
2.) Updating the setup tools
None of these worked.
Traceback (most recent call last):
File "C:\Users\DELLL\Anaconda3\lib\site-packages\tornado\web.py", line 1699, in _execute
result = await result
File "C:\Users\DELLL\Anaconda3\lib\site-packages\tornado\gen.py", line 742, in run
yielded = self.gen.throw(*exc_info) # type: ignore
File "C:\Users\DELLL\Anaconda3\lib\site-packages\notebook\services\sessions\handlers.py", line 72, in post
type=mtype))
File "C:\Users\DELLL\Anaconda3\lib\site-packages\tornado\gen.py", line 735, in run
value = future.result()
File "C:\Users\DELLL\Anaconda3\lib\site-packages\tornado\gen.py", line 742, in run
yielded = self.gen.throw(*exc_info) # type: ignore
File "C:\Users\DELLL\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\DELLL\Anaconda3\lib\site-packages\tornado\gen.py", line 735, in run
value = future.result()
File "C:\Users\DELLL\Anaconda3\lib\site-packages\tornado\gen.py", line 742, in run
yielded = self.gen.throw(*exc_info) # type: ignore
File "C:\Users\DELLL\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\DELLL\Anaconda3\lib\site-packages\tornado\gen.py", line 735, in run
value = future.result()
File "C:\Users\DELLL\Anaconda3\lib\site-packages\tornado\gen.py", line 209, in wrapper
yielded = next(result)
File "C:\Users\DELLL\Anaconda3\lib\site-packages\notebook\services\kernels\kernelmanager.py", line 168, in start_kernel
super(MappingKernelManager, self).start_kernel(**kwargs)
File "C:\Users\DELLL\Anaconda3\lib\site-packages\jupyter_client\multikernelmanager.py", line 110, in start_kernel
km.start_kernel(**kwargs)
File "C:\Users\DELLL\Anaconda3\lib\site-packages\jupyter_client\manager.py", line 240, in start_kernel
self.write_connection_file()
File "C:\Users\DELLL\Anaconda3\lib\site-packages\jupyter_client\connect.py", line 547, in write_connection_file
kernel_name=self.kernel_name
File "C:\Users\DELLL\Anaconda3\lib\site-packages\jupyter_client\connect.py", line 212, in write_connection_file
with secure_write(fname) as f:
File "C:\Users\DELLL\Anaconda3\lib\contextlib.py", line 112, in __enter__
return next(self.gen)
File "C:\Users\DELLL\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\\DELLL\\AppData\\Roaming\\jupyter\\runtime\\kernel-4058ed7c-98d6-40c9-8b3b-2cbb069740d8.json'
Issue resolved.
The problem:
I had previously installed jupyter using pip install, when I was working on python 3.8.
Now, I uninstalled python 3.8 and installed Anaconda instead. This again reinstalled jupyter, thus was the cause of the problem.
To resolve this, I uninstalled jupyter from AnacondaPrompt using conda uninstall jupyter , and then reinstalled it, this time from conda install jupyter.
This resolved the kernel error.
This is permission issue for that particular folder
Set the environment path variables C:\Users\DELL\AppData\Roaming\jupyter\runtime
give the permission and it will work

Kernel error: jupyter_client/connect.py AssertionError

Error message
Traceback (most recent call last):
File "/home/djan/anaconda3/lib/python3.7/site-packages/tornado/web.py", line 1699, in _execute
result = await result
File "/home/djan/anaconda3/lib/python3.7/site-packages/tornado/gen.py", line 742, in run
yielded = self.gen.throw(*exc_info) # type: ignore
File "/home/djan/anaconda3/lib/python3.7/site-packages/notebook/services/sessions/handlers.py", line 72, in post
type=mtype))
File "/home/djan/anaconda3/lib/python3.7/site-packages/tornado/gen.py", line 735, in run
value = future.result()
File "/home/djan/anaconda3/lib/python3.7/site-packages/tornado/gen.py", line 742, in run
yielded = self.gen.throw(*exc_info) # type: ignore
File "/home/djan/anaconda3/lib/python3.7/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 "/home/djan/anaconda3/lib/python3.7/site-packages/tornado/gen.py", line 735, in run
value = future.result()
File "/home/djan/anaconda3/lib/python3.7/site-packages/tornado/gen.py", line 742, in run
yielded = self.gen.throw(*exc_info) # type: ignore
File "/home/djan/anaconda3/lib/python3.7/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 "/home/djan/anaconda3/lib/python3.7/site-packages/tornado/gen.py", line 735, in run
value = future.result()
File "/home/djan/anaconda3/lib/python3.7/site-packages/tornado/gen.py", line 209, in wrapper
yielded = next(result)
File "/home/djan/anaconda3/lib/python3.7/site-packages/notebook/services/kernels/kernelmanager.py", line 168, in start_kernel
super(MappingKernelManager, self).start_kernel(**kwargs)
File "/home/djan/anaconda3/lib/python3.7/site-packages/jupyter_client/multikernelmanager.py", line 110, in start_kernel
km.start_kernel(**kwargs)
File "/home/djan/anaconda3/lib/python3.7/site-packages/jupyter_client/manager.py", line 240, in start_kernel
self.write_connection_file()
File "/home/djan/anaconda3/lib/python3.7/site-packages/jupyter_client/connect.py", line 547, in write_connection_file
kernel_name=self.kernel_name
File "/home/djan/anaconda3/lib/python3.7/site-packages/jupyter_client/connect.py", line 212, in write_connection_file
with secure_write(fname) as f:
File "/home/djan/anaconda3/lib/python3.7/contextlib.py", line 112, in __enter__
return next(self.gen)
File "/home/djan/anaconda3/lib/python3.7/site-packages/jupyter_client/connect.py", line 105, in secure_write
assert '0600' == oct(stat.S_IMODE(os.stat(fname).st_mode)).replace('0o', '0')
AssertionError
System information
Running Jupyter (v. 1.0.0) on a Linux server, with anaconda3 (v. 2019.07) 64-bit.
Available Kernels
Available kernels:
python3 /home/djan/.local/share/jupyter/kernels/python3
nn /home/djan/.local/share/jupyter/kernels/nn
Reproducing the issue
Install the newest anaconda3 version.
Run Jupyter notebook in the base version --> Kernel runs fine
Create a new environment with python: conda create -n test python=3.7
After activating the environment, Jupyter notebook is not available, thus I must install it via Conda: conda install -c anaconda jupyter
Run Jupyter notebook in the test environment --> Kernel breaks down as explained above
What I tried so far
There seems to be an issue with file permissions when running Jupyter on a server inside a Conda environment. I tried to give all files inside my anaconda3 folder the requested permissions (0600), but this did not help.
Update
It turns out that the newest version of jupyter_client, available under anaconda as version 5.3.3, breaks the Jupyter environment on a server.
Installing the previous version of jupyter_client via following command fixes this issue:
conda install -c anaconda jupyter_client=5.3.1
nice
Update
It turns out that the newest version of jupyter_client, available under anaconda as version 5.3.3, breaks the Jupyter environment on a server.
Installing the previous version of jupyter_client via following command fixes this issue:
conda install -c anaconda jupyter_client=5.3.1

transport_encoding error during installing with pip

I'm getting unexpected arg: keyword encoding in parse() while trying to install any python package through pip.
I'm getting this problem since i installed tensorflow for python 3.6, which probably led to some issue with html5lib and setuptools. Have reinstalled html5lib1.0b10 using tar.gz file (admin install) but the issue still remains.
Please help!!
pip install spacy
Collecting spacy
Exception:
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\lib\site-packages\pip\basecommand.py", line 215, in main
status = self.run(options, args)
File "C:\ProgramData\Anaconda3\lib\site-packages\pip\commands\install.py", line 335, in run
wb.build(autobuilding=True)
File "C:\ProgramData\Anaconda3\lib\site-packages\pip\wheel.py", line 749, in build
self.requirement_set.prepare_files(self.finder)
File "C:\ProgramData\Anaconda3\lib\site-packages\pip\req\req_set.py", line 380, in prepare_files
ignore_dependencies=self.ignore_dependencies))
File "C:\ProgramData\Anaconda3\lib\site-packages\pip\req\req_set.py", line 554, in _prepare_file
require_hashes
File "C:\ProgramData\Anaconda3\lib\site-packages\pip\req\req_install.py", line 278, in populate_link
self.link = finder.find_requirement(self, upgrade)
File "C:\ProgramData\Anaconda3\lib\site-packages\pip\index.py", line 465, in find_requirement
all_candidates = self.find_all_candidates(req.name)
File "C:\ProgramData\Anaconda3\lib\site-packages\pip\index.py", line 423, in find_all_candidates
for page in self._get_pages(url_locations, project_name):
File "C:\ProgramData\Anaconda3\lib\site-packages\pip\index.py", line 568, in _get_pages
page = self._get_page(location)
File "C:\ProgramData\Anaconda3\lib\site-packages\pip\index.py", line 683, in _get_page
return HTMLPage.get_page(link, session=self.session)
File "C:\ProgramData\Anaconda3\lib\site-packages\pip\index.py", line 811, in get_page
inst = cls(resp.content, resp.url, resp.headers)
File "C:\ProgramData\Anaconda3\lib\site-packages\pip\index.py", line 731, in __init__
namespaceHTMLElements=False,
TypeError: parse() got an unexpected keyword argument 'transport_encoding'
Issue was indeed with html5lib and setuptools, I re-installed html5lib using
conda install -c anaconda html5lib
Although package versions were same, it said 'The following packages will be SUPERSEDED by a higher-priority channel', and installed conda, conda-env, html5lib. I'm unsure about higher-priority channel part.
But this answered my problem!!
Problem appears after installing tensorflow 1.3.0.
Reinstall html5lib.
conda uninstall html5lib --force
conda install html5lib
Solves the problem temporarily until next pip install --upgrade tensorflow.
Had the same problem with pip install --upgrade tensorflow-gpu as well.

Resources