I tried to download python libraries using pip install like pygame, pytube... but it just won't work and give me the following error message:
Traceback (most recent call last):
File "c:\program files\python39\lib\runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "c:\program files\python39\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "C:\Program Files\Python39\Scripts\pip.exe\__main__.py", line 4, in <module>
File "C:\Users\user\AppData\Roaming\Python\Python39\site-packages\pip\_internal\cli\main.py", line 9, in <module>
from pip._internal.cli.autocompletion import autocomplete
File "C:\Users\user\AppData\Roaming\Python\Python39\site-packages\pip\_internal\cli\autocompletion.py", line 10, in <module>
from pip._internal.cli.main_parser import create_main_parser
File "C:\Users\user\AppData\Roaming\Python\Python39\site-packages\pip\_internal\cli\main_parser.py", line 8, in <module>
from pip._internal.cli import cmdoptions
File "C:\Users\user\AppData\Roaming\Python\Python39\site-packages\pip\_internal\cli\cmdoptions.py", line 23, in <module>
from pip._internal.cli.parser import ConfigOptionParser
File "C:\Users\user\AppData\Roaming\Python\Python39\site-packages\pip\_internal\cli\parser.py", line 12, in <module>
from pip._internal.configuration import Configuration, ConfigurationError
File "C:\Users\user\AppData\Roaming\Python\Python39\site-packages\pip\_internal\configuration.py", line 20, in <module>
from pip._internal.exceptions import (
File "C:\Users\user\AppData\Roaming\Python\Python39\site-packages\pip\_internal\exceptions.py", line 13, in <module>
from pip._vendor.requests.models import Request, Response
File "C:\Users\user\AppData\Roaming\Python\Python39\site-packages\pip\_vendor\requests\__init__.py", line 43, in <module>
from pip._vendor import urllib3
ImportError: cannot import name 'urllib3' from 'pip._vendor' (C:\Users\user\AppData\Roaming\Python\Python39\site-packages\pip\_vendor\__init__.py)
I wrote the import statement in python: from pip._vendor import urllib3 and I got the same error, it the pc can't import it
how can I fix that, if I can't, can I just download libraries from the browser?
Try using:
python -m pip install pytube
Related
I just did a fresh install of python3 (3.6.5_1) on Mac OS (High Sierra) and pip3 does not work. I get the following error with pip3:
Traceback (most recent call last):
File "/usr/local/bin/pip3", line 11, in <module>
load_entry_point('pip==10.0.1', 'console_scripts', 'pip3')()
File "/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 476, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2700, in load_entry_point
return ep.load()
File "/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2318, in load
return self.resolve()
File "/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2324, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "/usr/local/lib/python3.6/site-packages/pip/_internal/__init__.py", line 42, in <module>
from pip._internal import cmdoptions
File "/usr/local/lib/python3.6/site-packages/pip/_internal/cmdoptions.py", line 16, in <module>
from pip._internal.index import (
File "/usr/local/lib/python3.6/site-packages/pip/_internal/index.py", line 39, in <module>
from pip._internal.wheel import Wheel, wheel_ext
File "/usr/local/lib/python3.6/site-packages/pip/_internal/wheel.py", line 7, in <module>
import compileall
File "/usr/local/Cellar/python/3.6.5_1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/compileall.py", line 20, in <module>
from concurrent.futures import ProcessPoolExecutor
File "/Library/Python/2.7/site-packages/concurrent/futures/__init__.py", line 8, in <module>
from concurrent.futures._base import (FIRST_COMPLETED,
File "/Library/Python/2.7/site-packages/concurrent/futures/_base.py", line 357
raise type(self._exception), self._exception, self._traceback
^
SyntaxError: invalid syntax
which pip3 returns /usr/local/bin/pip3
I have searched and can't find a solution.
"sudo easy_install pip" fails with the following error:
Traceback (most recent call last):
File "/usr/bin/easy_install-2.7", line 11, in <module>
load_entry_point('setuptools==18.5', 'console_scripts', 'easy_install')()
File "/Users/swastika.singhal/Library/Python/2.7/lib/python/site-packages/pkg_resources/__init__.py", line 572, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/Users/swastika.singhal/Library/Python/2.7/lib/python/site-packages/pkg_resources/__init__.py", line 2755, in load_entry_point
return ep.load()
File "/Users/swastika.singhal/Library/Python/2.7/lib/python/site-packages/pkg_resources/__init__.py", line 2408, in load
return self.resolve()
File "/Users/swastika.singhal/Library/Python/2.7/lib/python/site-packages/pkg_resources/__init__.py", line 2414, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/setuptools/command/easy_install.py", line 46, in <module>
from setuptools.archive_util import unpack_archive
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/setuptools/archive_util.py", line 15, in <module>
from pkg_resources import ensure_directory, ContextualZipFile
ImportError: cannot import name ContextualZipFile
The Google solutions did not work for me so far.
This GitHub issue helped me fix it: github.com/PyMySQL/mysqlclient-python/issues/169
Specifically:
There are lines in mysql_config like following:
# Create options
libs="-L$pkglibdir"
libs="$libs -l "
I edited them to:
# Create options
libs="-L$pkglibdir"
libs="$libs -lmysqlclient -lssl -lcrypto"
It always failed to pip install georasters in my macbook.
The following is the Exception:
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/Library/Python/2.7/site-packages/pip/commands/install.py", line 324, in run
requirement_set.prepare_files(finder)
File "/Library/Python/2.7/site-packages/pip/req/req_set.py", line 380, in prepare_files
ignore_dependencies=self.ignore_dependencies))
File "/Library/Python/2.7/site-packages/pip/req/req_set.py", line 634, in _prepare_file
abstract_dist.prep_for_dist()
File "/Library/Python/2.7/site-packages/pip/req/req_set.py", line 129, in prep_for_dist
self.req_to_install.run_egg_info()
File "/Library/Python/2.7/site-packages/pip/req/req_install.py", line 412, in run_egg_info
self.setup_py, self.name,
File "/Library/Python/2.7/site-packages/pip/req/req_install.py", line 387, in setup_py
import setuptools # noqa
File "build/bdist.macosx-10.12-intel/egg/setuptools/__init__.py", line 12, in <module>
File "build/bdist.macosx-10.12-intel/egg/setuptools/version.py", line 1, in <module>
File "build/bdist.macosx-10.12-intel/egg/pkg_resources/__init__.py", line 72, in <module>
File "build/bdist.macosx-10.12-intel/egg/packaging/requirements.py", line 59, in <module>
TypeError: __call__() takes exactly 2 arguments (1 given)
pip --version:
pip 9.0.1 from /Library/Python/2.7/site-packages (python 2.7)
After many times trying, I resolved the problem.
I used the command:pip install --no-deps georasters
https://pip.pypa.io/en/stable/reference/pip_install/#installation-order[enter image description here][1]
I'm trying to install pylint with pip install pylint
But i've got this at the end of installation:
Removing temporary dir c:\users\fixxxer\appdata\local\temp\pip_build_Fixxxer...
Exception:
Traceback (most recent call last):
File "C:\Python27\lib\site-packages\pip\basecommand.py", line 122, in main
status = self.run(options, args)
File "C:\Python27\lib\site-packages\pip\commands\install.py", line 278, in run
requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
File "C:\Python27\lib\site-packages\pip\req.py", line 1229, in prepare_files
req_to_install.run_egg_info()
File "C:\Python27\lib\site-packages\pip\req.py", line 292, in run_egg_info
logger.notify('Running setup.py (path:%s) egg_info for package %s' % (self.setup_py, self.name))
File "C:\Python27\lib\site-packages\pip\req.py", line 265, in setup_py
import setuptools
File "C:\Python27\lib\site-packages\setuptools\__init__.py", line 12, in <module>
from setuptools.extension import Extension
File "C:\Python27\lib\site-packages\setuptools\extension.py", line 7, in <module>
from setuptools.dist import _get_unpatched
File "C:\Python27\lib\site-packages\setuptools\dist.py", line 16, in <module>
from setuptools.depends import Require
File "C:\Python27\lib\site-packages\setuptools\depends.py", line 6, in <module>
from setuptools import compat
File "C:\Python27\lib\site-packages\setuptools\compat.py", line 19, in <module>
from SimpleHTTPServer import SimpleHTTPRequestHandler
File "C:\Python27\lib\SimpleHTTPServer.py", line 27, in <module>
class SimpleHTTPRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):
File "C:\Python27\lib\SimpleHTTPServer.py", line 204, in SimpleHTTPRequestHandler
mimetypes.init() # try to read system mime.types
File "C:\Python27\lib\mimetypes.py", line 355, in init
db.read_windows_registry()
File "C:\Python27\lib\mimetypes.py", line 259, in read_windows_registry
for ctype in enum_types(mimedb):
File "C:\Python27\lib\mimetypes.py", line 249, in enum_types
ctype = ctype.encode(default_encoding) # omit in 3.x!
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe0 in position 0: ordinal not in range(128)
Any ideas how can i fix this or some workarounds?
How can i install it manually?
UPDATE.
replacing
default_encoding = sys.getdefaultencoding()
with
if sys.getdefaultencoding() != 'gbk':
reload(sys)
sys.setdefaultencoding('gbk')
default_encoding = sys.getdefaultencoding()
does this:
Cleaning up...
Removing temporary dir c:\users\fixxxer\appdata\local\temp\pip_build_Fixxxer...
Exception:
Traceback (most recent call last):
File "C:\Python27\lib\site-packages\pip\basecommand.py", line 122, in main
status = self.run(options, args)
File "C:\Python27\lib\site-packages\pip\commands\install.py", line 278, in run
requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
File "C:\Python27\lib\site-packages\pip\req.py", line 1229, in prepare_files
req_to_install.run_egg_info()
File "C:\Python27\lib\site-packages\pip\req.py", line 292, in run_egg_info
logger.notify('Running setup.py (path:%s) egg_info for package %s' % (self.setup_py, self.name))
File "C:\Python27\lib\site-packages\pip\req.py", line 265, in setup_py
import setuptools
File "C:\Python27\lib\site-packages\setuptools\__init__.py", line 12, in <module>
from setuptools.extension import Extension
File "C:\Python27\lib\site-packages\setuptools\extension.py", line 7, in <module>
from setuptools.dist import _get_unpatched
File "C:\Python27\lib\site-packages\setuptools\dist.py", line 16, in <module>
from setuptools.depends import Require
File "C:\Python27\lib\site-packages\setuptools\depends.py", line 6, in <module>
from setuptools import compat
File "C:\Python27\lib\site-packages\setuptools\compat.py", line 19, in <module>
from SimpleHTTPServer import SimpleHTTPRequestHandler
File "C:\Python27\lib\SimpleHTTPServer.py", line 27, in <module>
class SimpleHTTPRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):
File "C:\Python27\lib\SimpleHTTPServer.py", line 204, in SimpleHTTPRequestHandler
mimetypes.init() # try to read system mime.types
File "C:\Python27\lib\mimetypes.py", line 359, in init
db.read_windows_registry()
File "C:\Python27\lib\mimetypes.py", line 263, in read_windows_registry
for ctype in enum_types(mimedb):
File "C:\Python27\lib\mimetypes.py", line 249, in enum_types
ctype = ctype.encode(default_encoding) # omit in 3.x!
UnicodeDecodeError: 'gbk' codec can't decode bytes in position 4-5: illegal multibyte sequence
Found a problem.
There was a few MIME types with Cyrillic names in
HKEY_CLASSES_ROOT\MIME\Database\Content Type
Removed them and problem was solved.
I had the same error and this helped me https://stackoverflow.com/a/23278373/2571607
Basically, open C:\Python27\Lib\mimetypes.py
replace
‘default_encoding = sys.getdefaultencoding()’
with
if sys.getdefaultencoding() != 'gbk':
reload(sys)
sys.setdefaultencoding('gbk')
default_encoding = sys.getdefaultencoding()
Trying to get it going with Sphinx for the first time, with a clean Sphinx 1.1.3 installation, and shinx-quickstart fails. Should there be any dependencies installed? I tried to pip --force-reinstall sphinx but the result is the same.
myhost:doc anton$ sphinx-quickstart
Traceback (most recent call last):
File "/usr/local/bin/sphinx-quickstart", line 8, in <module>
load_entry_point('Sphinx==1.1.3', 'console_scripts', 'sphinx-quickstart')()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 318, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 2221, in load_entry_point
return ep.load()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 1954, in load
entry = __import__(self.module_name, globals(),globals(), ['__name__'])
File "/Library/Python/2.7/site-packages/Sphinx-1.1.3-py2.7.egg/sphinx/quickstart.py", line 19, in <module>
from sphinx.util.osutil import make_filename
File "/Library/Python/2.7/site-packages/Sphinx-1.1.3-py2.7.egg/sphinx/util/__init__.py", line 25, in <module>
from docutils.utils import relative_path
File "/Library/Python/2.7/site-packages/docutils-0.9-py2.7.egg/docutils/utils/__init__.py", line 19, in <module>
from docutils.io import FileOutput
File "/Library/Python/2.7/site-packages/docutils-0.9-py2.7.egg/docutils/io.py", line 18, in <module>
from docutils.error_reporting import locale_encoding, ErrorString, ErrorOutput
File "/Library/Python/2.7/site-packages/docutils-0.9-py2.7.egg/docutils/error_reporting.py", line 47, in <module>
locale_encoding = locale.getlocale()[1] or locale.getdefaultlocale()[1]
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/locale.py", line 496, in getdefaultlocale
return _parse_localename(localename)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/locale.py", line 428, in _parse_localename
raise ValueError, 'unknown locale: %s' % localename
ValueError: unknown locale: UTF-8
I was getting the same issue in Mac OS X Snow Leopard. It seems to be an issue with Terminal.app.
Please add the following to your $HOME/.bash_profile
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
Do
source $HOME/.bash_profile
and try. This will solve the issue.