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.
Related
I was playing around with different flake8 plugins today and after uninstalling one of them and installing a new one, flake8 --version no longer works for me.
the flake8 packages I had at the time were
(python3) $ flake8 --version 3.8.4 (flake8-bugbear: 20.11.1, mccabe: 0.6.1, naming: 0.11.1, pycodestyle: 2.6.0, pyflakes: 2.2.0) CPython 3.8.2 on Darwin
after which I had ran
pip uninstalled flake8-bugbear
pip install flake8-docstrings
pip uninstall flake8-docstrings
pip install flake8-comprehensions
It now breaks with this error on flake8 --version
(python3) $ flake8 --version
Traceback (most recent call last):
File "/Users/dtan/code/python3/bin/flake8", line 8, in <module>
sys.exit(main())
File "/Users/dtan/code/python3/lib/python3.8/site-packages/flake8/main/cli.py", line 22, in main
app.run(argv)
File "/Users/dtan/code/python3/lib/python3.8/site-packages/flake8/main/application.py", line 363, in run
self._run(argv)
File "/Users/dtan/code/python3/lib/python3.8/site-packages/flake8/main/application.py", line 350, in _run
self.initialize(argv)
File "/Users/dtan/code/python3/lib/python3.8/site-packages/flake8/main/application.py", line 332, in initialize
self.parse_configuration_and_cli(
File "/Users/dtan/code/python3/lib/python3.8/site-packages/flake8/main/application.py", line 182, in parse_configuration_and_cli
self.options, self.args = aggregator.aggregate_options(
File "/Users/dtan/code/python3/lib/python3.8/site-packages/flake8/options/aggregator.py", line 45, in aggregate_options
parsed_config = config_parser.parse()
File "/Users/dtan/code/python3/lib/python3.8/site-packages/flake8/options/config.py", line 312, in parse
return self.merge_user_and_local_config()
File "/Users/dtan/code/python3/lib/python3.8/site-packages/flake8/options/config.py", line 277, in merge_user_and_local_config
config = self.parse_local_config()
File "/Users/dtan/code/python3/lib/python3.8/site-packages/flake8/options/config.py", line 240, in parse_local_config
return self._parse_config(config)
File "/Users/dtan/code/python3/lib/python3.8/site-packages/flake8/options/config.py", line 217, in _parse_config
value = method(self.program_name, option_name)
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/configparser.py", line 828, in getboolean
return self._get_conv(section, option, self._convert_to_boolean,
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/configparser.py", line 808, in _get_conv
return self._get(section, conv, option, raw=raw, vars=vars,
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/configparser.py", line 803, in _get
return conv(self.get(section, option, **kwargs))
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/configparser.py", line 1163, in _convert_to_boolean
raise ValueError('Not a boolean: %s' % value)
ValueError: Not a boolean: true # Print the source code generating the error/warning in question
I've already tried uninstalling & reinstalling flake8 with no luck. I assume that something is broken on the documentation stuff since doing flake8 --help will also throw this error
It seems one of the plugins had added a config parser and changed one of the configuration files. When uninstalled the parser was removed but it left the changes in config file(s).
You need to run through all flake8 config files and remove config sections for uninstalled plugins.
My jupyter notebook doesn't start due the dead kernel with following Kernel error:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tornado/web.py", line 1512, in _execute
result = yield result
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tornado/gen.py", line 1055, in run
value = future.result()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tornado/concurrent.py", line 238, in result
raise_exc_info(self._exc_info)
File "<string>", line 4, in raise_exc_info
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tornado/gen.py", line 1069, in run
yielded = self.gen.send(value)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/notebook/services/sessions/handlers.py", line 67, in post
model = yield gen.maybe_future(sm.get_session(path=path))
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/notebook/services/sessions/sessionmanager.py", line 170, in get_session
return self.row_to_model(row)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/notebook/services/sessions/sessionmanager.py", line 209, in row_to_model
raise KeyError
KeyError
In my case, the issue originated from having prompt-toolkit requirement conflict in jupyter-console and ipython.
You can use pip check to make sure whether you have the same problem. If the output is something similar to my output below, you have to fix the broken packages issue.
>>> pip check ipython
ipython 5.0.0 has requirement prompt-toolkit<2.0.0,>=1.0.3, but you'll have prompt-toolkit 2.0.9 which is incompatible.
>>> pip check jupyter-console
jupyter-console 6.0.0 has requirement prompt-toolkit<2.1.0,>=2.0.0, but you'll have prompt-toolkit 1.0.15 which is incompatible.
The quick fix is to try the solution originally mentioned here.
pip uninstall prompt-toolkit
pip install prompt-toolkit==1.0.15
pip uninstall jupyter-console
pip install jupyter-console==5.2.0
I am creating a face recognition system using Python and OpenCV on these versions:
Python 3.6.2 (64-bit)
OpenCV 3.3.0
When I try to train the face recognizer:
face_recognizer = cv2.face.createLBPHFaceRecognizer()
and also I tried
face_recognizer = cv2.createLBPHFaceRecognizer()
It gave me attribute error
AttributeError: module 'cv2.cv2' has no attribute 'createLBPHFaceRecognizer'
When I tried
pip install opencv-python
I got these errors
Exception:
Traceback (most recent call last):
File "c:\users\anushi maheshwari\appdata\local\programs\python\python36-32\lib\site-packages\pip\basecommand.py", line 215, in main
status = self.run(options, args)
File "c:\users\anushi maheshwari\appdata\local\programs\python\python36-32\lib\site-packages\pip\commands\install.py", line 342, in run
prefix=options.prefix_path,
File "c:\users\anushi maheshwari\appdata\local\programs\python\python36-32\lib\site-packages\pip\req\req_set.py", line 784, in install
**kwargs
File "c:\users\anushi maheshwari\appdata\local\programs\python\python36-32\lib\site-packages\pip\req\req_install.py", line 851, in install
self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
File "c:\users\anushi maheshwari\appdata\local\programs\python\python36-32\lib\site-packages\pip\req\req_install.py", line 1064, in move_wheel_files
isolated=self.isolated,
File "c:\users\anushi maheshwari\appdata\local\programs\python\python36-32\lib\site-packages\pip\wheel.py", line 345, in move_wheel_files
clobber(source, lib_dir, True)
File "c:\users\anushi maheshwari\appdata\local\programs\python\python36-32\lib\site-packages\pip\wheel.py", line 323, in clobber
shutil.copyfile(srcfile, destfile)
File "c:\users\anushi maheshwari\appdata\local\programs\python\python36-32\lib\shutil.py", line 121, in copyfile
with open(dst, 'wb') as fdst:
PermissionError: [Errno 13] Permission denied: 'c:\\users\\anushi maheshwari\\appdata\\local\\programs\\python\\python36-32\\Lib\\site-packages\\cv2\\cv2.cp36-win32.pyd'
I'd been facing the same issue recently. Here's a list of things that went wrong:
You need to uninstall opencv before installing opencv-contrib
Make sure no console is running that has imported cv2 while you execute your installing process
Run the cmd in Administration Mode (Go to the .exe of the cmd program, right click and select 'Run as Administrator')
This should work.
Hope this helps!
In case of windows, in cmd try to run pip install using python executable
python -m pip install opencv-python
if you're using linux, you just have to give it superuser permission:
sudo -s
pip install opencv-python
note: do not use "su" because it does not recognize the "pip" command
You can use the below command i.e add user to the command
pip install --user opencv-contrib-python
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
I try to make an easy Python gui, therefore I need to import tkinter. This package is available in Python 3, so I need that interpreter, but I can't get it started in Pycharm. It always asks to install packaging tools and then I get the same error everytime and I can't seem to fix it. I get the following:
Executed command:
/tmp/tmpu8m14jqspycharm-management/pip-9.0.1/setup.py install
Error occured:
AttributeError: module 'setuptools.dist' has no attribute 'check_specifier'
Command output:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2237, in resolve
return functools.reduce(getattr, self.attrs, module)
AttributeError: module 'setuptools.dist' has no attribute 'check_specifier'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/tmp/tmpu8m14jqspycharm-management/pip-9.0.1/setup.py", line 92, in <module>
cmdclass={'test': PyTest},
File "/usr/lib/python3.5/distutils/core.py", line 108, in setup
_setup_distribution = dist = klass(attrs)
File "/usr/lib/python3/dist-packages/setuptools/dist.py", line 272, in __init__
_Distribution.__init__(self,attrs)
File "/usr/lib/python3.5/distutils/dist.py", line 281, in __init__
self.finalize_options()
File "/usr/lib/python3/dist-packages/setuptools/dist.py", line 327, in finalize_options
ep.load()(self, ep.name, value)
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2229, in load
return self.resolve()
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2239, in resolve
raise ImportError(str(exc))
ImportError: module 'setuptools.dist' has no attribute 'check_specifier'
I already searched some fixes but none actually worked.
Python PIP might not be installed. In Debian based distribution:
sudo apt-get install python3-pip
should solve if you use Python 3.
For Python 2.7x
sudo apt-get install python-pip
Close PyCharm and re-open it.
In this case, it may be possible that python pip (package installer) is not installed. So try installing that first.:
sudo apt-get install python3-pip