pip install Missing 'Version:' header and/or METADATA file error - pip

I installed python2 and python3 via homebrew.
While installing package from pip -> pip install redis, it throw errors.
Error checking for conflicts.
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2584, in version
return self._version
File "/usr/local/lib/python3.7/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2691, in __getattr__
raise AttributeError(attr)
AttributeError: _version
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/pip/_internal/commands/install.py", line 503, in _warn_about_conflicts
package_set, _dep_info = check_install_conflicts(to_install)
File "/usr/local/lib/python3.7/site-packages/pip/_internal/operations/check.py", line 108, in check_install_conflicts
package_set, _ = create_package_set_from_installed()
File "/usr/local/lib/python3.7/site-packages/pip/_internal/operations/check.py", line 47, in create_package_set_from_installed
package_set[name] = PackageDetails(dist.version, dist.requires())
File "/usr/local/lib/python3.7/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2589, in version
raise ValueError(tmpl % self.PKG_INFO, self)
ValueError: ("Missing 'Version:' header and/or METADATA file", Unknown [unknown version] (/usr/local/lib/python3.7/site-packages))
I tried re-install python3, it doesn't work.
Any solution here?

Related

How can I uninstall pip on Mac (Issue)?

I am trying to fix pip but I'm in a state where it's installed but also not installed?
When I type "pip" in terminal, I get that pip is not installed.
When I type "pip3" in the terminal, I get the following:
Traceback (most recent call last):
File "/Applications/Xcode.app/Contents/Developer/usr/bin/pip3", line 5, in <module>
from pip._internal.cli.main import main
ModuleNotFoundError: No module named 'pip'
How do I get rid of pip?
I also tried to run "python3 get-pip.py" again (download again), but I got the following error:
ERROR: Exception:
Traceback (most recent call last):
File "/var/folders/bh/gw4lmfss1w7gkzxnv7vdftbw0000gn/T/tmpgvtrdkgq/pip.zip/pip/_internal/cli/base_command.py", line 160, in exc_logging_wrapper
status = run_func(*args)
^^^^^^^^^^^^^^^
File "/var/folders/bh/gw4lmfss1w7gkzxnv7vdftbw0000gn/T/tmpgvtrdkgq/pip.zip/pip/_internal/cli/req_command.py", line 247, in wrapper
return func(self, options, args)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/var/folders/bh/gw4lmfss1w7gkzxnv7vdftbw0000gn/T/tmpgvtrdkgq/pip.zip/pip/_internal/commands/install.py", line 553, in run
self._handle_target_dir(
File "/var/folders/bh/gw4lmfss1w7gkzxnv7vdftbw0000gn/T/tmpgvtrdkgq/pip.zip/pip/_internal/commands/install.py", line 608, in _handle_target_dir
shutil.rmtree(target_item_dir)
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/shutil.py", line 732, in rmtree
_rmtree_safe_fd(fd, path, onerror)
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/shutil.py", line 660, in _rmtree_safe_fd
_rmtree_safe_fd(dirfd, fullname, onerror)
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/shutil.py", line 683, in _rmtree_safe_fd
onerror(os.unlink, fullname, sys.exc_info())
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/shutil.py", line 681, in _rmtree_safe_fd
os.unlink(entry.name, dir_fd=topfd)
PermissionError: [Errno 13] Permission denied: 'configuration.py'
Try this
python -m pip uninstall [options] <package>
python -m pip uninstall [options] -r <requirements file>
For Example
python -m pip uninstall simplejson
Reference

pypy3's pip can't install jupyter

When I use pypy3's pip to install jupyter, it doesn't work always.
pip install jupyter
The pypy version I use is pypy3.7-v7.3.3-win32.
When installing the jupyter, it always throws the AttributeError, like this:
Collecting nbclient<0.6.0,>=0.5.0
Using cached https://pypi.tuna.tsinghua.edu.cn/packages/fd/4f/5cbd9bdb30bfaad620f028711bf232b9cec8fdff1dcf68d9259254fcddeb/nbclient-0.5.1-py3-none-any.whl (65 kB)
ERROR: Exception:
Traceback (most recent call last):
File "d:\myapps\pypy37\site-packages\pip\_internal\cli\base_command.py", line 224, in _main
status = self.run(options, args)
File "d:\myapps\pypy37\site-packages\pip\_internal\cli\req_command.py", line 180, in wrapper
return func(self, options, args)
File "d:\myapps\pypy37\site-packages\pip\_internal\commands\install.py", line 321, in run
reqs, check_supported_wheels=not options.target_dir
File "d:\myapps\pypy37\site-packages\pip\_internal\resolution\resolvelib\resolver.py", line 122, in resolve
requirements, max_rounds=try_to_avoid_resolution_too_deep,
File "d:\myapps\pypy37\site-packages\pip\_vendor\resolvelib\resolvers.py", line 445, in resolve
state = resolution.resolve(requirements, max_rounds=max_rounds)
File "d:\myapps\pypy37\site-packages\pip\_vendor\resolvelib\resolvers.py", line 344, in resolve
success = self._backtrack()
File "d:\myapps\pypy37\site-packages\pip\_vendor\resolvelib\resolvers.py", line 287, in _backtrack
criterion = self.state.criteria[name].excluded_of([candidate])
AttributeError: 'NoneType' object has no attribute 'excluded_of'
How can I solve this problem?
You can get complete details here. It seems your commandline is not correct. Please follow any of the desired from link below. Jupyter notebook installation

Unable to PIP install Python ftfy package

When I try to install ftfy here package using command,
pip install ftfy I am getting following error in the terminal:
Collecting ftfy
Using cached https://files.pythonhosted.org/packages/d5/60/7b2d5d41ad6c6ebf48316b1c55ccf7c60d126e07f6306be9f254a139bfd1/ftfy-5.4.1.tar.gz
Complete output from command python setup.py egg_info:
Download error on https://pypi.org/simple/pytest-runner/: [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:645) -- Some packages may not be found!
Couldn't find index page for 'pytest-runner' (maybe misspelled?)
Download error on https://pypi.org/simple/: [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:645) -- Some packages may not be found!
No local packages or working download links found for pytest-runner
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/f4/sb0f69y118l8_xvhflgrgsjnrl5c1r/T/pip-install-uxw5kcal/ftfy/setup.py", line 62, in <module>
'Documentation': 'http://ftfy.readthedocs.io',
File "/Users/raja.charuvil/kattoor/ce-etl/venv/lib/python3.5/site-packages/setuptools/__init__.py", line 139, in setup
_install_setup_requires(attrs)
File "/Users/raja.charuvil/kattoor/ce-etl/venv/lib/python3.5/site-packages/setuptools/__init__.py", line 134, in _install_setup_requires
dist.fetch_build_eggs(dist.setup_requires)
File "/Users/raja.charuvil/kattoor/ce-etl/venv/lib/python3.5/site-packages/setuptools/dist.py", line 514, in fetch_build_eggs
replace_conflicting=True,
File "/Users/raja.charuvil/kattoor/ce-etl/venv/lib/python3.5/site-packages/pkg_resources/__init__.py", line 777, in resolve
replace_conflicting=replace_conflicting
File "/Users/raja.charuvil/kattoor/ce-etl/venv/lib/python3.5/site-packages/pkg_resources/__init__.py", line 1060, in best_match
return self.obtain(req, installer)
File "/Users/raja.charuvil/kattoor/ce-etl/venv/lib/python3.5/site-packages/pkg_resources/__init__.py", line 1072, in obtain
return installer(requirement)
File "/Users/raja.charuvil/kattoor/ce-etl/venv/lib/python3.5/site-packages/setuptools/dist.py", line 581, in fetch_build_egg
return cmd.easy_install(req)
File "/Users/raja.charuvil/kattoor/ce-etl/venv/lib/python3.5/site-packages/setuptools/command/easy_install.py", line 670, in easy_install
raise DistutilsError(msg)
distutils.errors.DistutilsError: Could not find suitable distribution for Requirement.parse('pytest-runner')
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/f4/sb0f69y118l8_xvhflgrgsjnrl5c1r/T/pip-install-uxw5kcal/ftfy/
I am using Mac os and Python 3.5
I tried using solution from link here but that could not solve my issue.
The problem got resolved after I update pytest-runner package.
pip3 install pytest-runner --upgrade
Then
pip3 install ftfy

Unable to install lxml on OSX using pip: 550 Failed to change directory

I'm trying to install lxml on OSX El Capitan using pip3; lots of googling turned up using STATIC_DEPS, but unfortunately I'm now getting an error that to me seems to imply a missing file in the package:
$ STATIC_DEPS=true pip3 install lxml
Collecting lxml
Using cached https://files.pythonhosted.org/packages/54/a6/43be8cf1cc23e3fa208cab04ba2f9c3b7af0233aab32af6b5089122b44cd/lxml-4.2.3.tar.gz
Complete output from command python setup.py egg_info:
Building lxml version 4.2.3.
Latest version of zlib is 1.2.11
Downloading zlib into libs/zlib-1.2.11.tar.gz from http://zlib.net/zlib-1.2.11.tar.gz
Unpacking zlib-1.2.11.tar.gz into build/tmp
Latest version of libiconv is 1.15
Downloading libiconv into libs/libiconv-1.15.tar.gz from ftp://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.15.tar.gz
Unpacking libiconv-1.15.tar.gz into build/tmp
Latest version of libxml2 is 2.9.8
Downloading libxml2 into libs/libxml2-2.9.8.tar.gz from ftp://xmlsoft.org/libxml2/libxml2-2.9.8.tar.gz
Unpacking libxml2-2.9.8.tar.gz into build/tmp
Latest version of libxslt is 1.1.33
Downloading libxslt into libs/libxslt-1.1.33.tar.gz from ftp://xmlsoft.org/libxml2/libxslt-1.1.33.tar.gz
Traceback (most recent call last):
File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 2417, in retrfile
self.ftp.cwd(file)
File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/ftplib.py", line 631, in cwd
return self.voidcmd(cmd)
File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/ftplib.py", line 278, in voidcmd
return self.voidresp()
File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/ftplib.py", line 251, in voidresp
resp = self.getresp()
File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/ftplib.py", line 246, in getresp
raise error_perm(resp)
ftplib.error_perm: 550 Failed to change directory.
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 1540, in ftp_open
fp, retrlen = fw.retrfile(file, type)
File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 2419, in retrfile
raise URLError('ftp error: %r' % reason) from reason
urllib.error.URLError: <urlopen error ftp error: error_perm('550 Failed to change directory.')>
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/hp/_4p52dfd7s9cf49p86sg1l_w0000gp/T/pip-install-yjxema7x/lxml/setup.py", line 241, in <module>
**setup_extra_options()
File "/private/var/folders/hp/_4p52dfd7s9cf49p86sg1l_w0000gp/T/pip-install-yjxema7x/lxml/setup.py", line 150, in setup_extra_options
STATIC_CFLAGS, STATIC_BINARIES)
File "/private/var/folders/hp/_4p52dfd7s9cf49p86sg1l_w0000gp/T/pip-install-yjxema7x/lxml/setupinfo.py", line 75, in ext_modules
multicore=OPTION_MULTICORE)
File "/private/var/folders/hp/_4p52dfd7s9cf49p86sg1l_w0000gp/T/pip-install-yjxema7x/lxml/buildlibxml.py", line 390, in build_libxml2xslt
libxslt_dir = unpack_tarball(download_libxslt(download_dir, libxslt_version), build_dir)
File "/private/var/folders/hp/_4p52dfd7s9cf49p86sg1l_w0000gp/T/pip-install-yjxema7x/lxml/buildlibxml.py", line 218, in download_libxslt
version_re, filename, version=version)
File "/private/var/folders/hp/_4p52dfd7s9cf49p86sg1l_w0000gp/T/pip-install-yjxema7x/lxml/buildlibxml.py", line 291, in download_library
urlretrieve(full_url, dest_filename)
File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 247, in urlretrieve
with contextlib.closing(urlopen(url, data)) as fp:
File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 222, in urlopen
return opener.open(url, data, timeout)
File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 525, in open
response = self._open(req, data)
File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 543, in _open
'_open', req)
File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 503, in _call_chain
result = func(*args)
File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 1551, in ftp_open
raise exc.with_traceback(sys.exc_info()[2])
File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 1540, in ftp_open
fp, retrlen = fw.retrfile(file, type)
File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 2419, in retrfile
raise URLError('ftp error: %r' % reason) from reason
urllib.error.URLError: <urlopen error ftp error: URLError("ftp error: error_perm('550 Failed to change directory.')")>
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/hp/_4p52dfd7s9cf49p86sg1l_w0000gp/T/pip-install-yjxema7x/lxml/
As the command failed on Downloading libxslt into libs/libxslt-1.1.33.tar.gz from ftp://xmlsoft.org/libxml2/libxslt-1.1.33.tar.gz
I browsed the ftp://xmlsoft.org/libxml2/ site which doesn't have ftp://xmlsoft.org/libxml2/libxslt-1.1.33.tar.gz, only ftp://xmlsoft.org/libxml2/libxslt-1.1.33-rc1.tar.gz.
Is this the problem, and if so is there a way to override it in the package? Or am I missing something?
You can bypass FTP errors while still having the STATIC_DEPS functionality by downloading libxml2 and libxslt manually and building from setup.py.
Pasted from the lxml website:
...If you want to use
specific versions, or want to prevent any online access, you can
download both tar.gz release files yourself, place them into a
subdirectory libs in the lxml distribution, and call setup.py with the
desired target versions like this:
python setup.py build --static-deps \
--libxml2-version=2.9.1 \
--libxslt-version=1.1.28 \
sudo python setup.py install

python selenium windows chrome webdriver giving error

I am getting the following errors while trying all the solutions I could find on my own with no success like copying the whole selenium folder to main python folder, changing the path, using the absolute path etc, I would really appreciate the help as a newbie who just got started with python and selenium.
C:\Users\WorkStation\Desktop\chromedriver.exe
Error : -
C:\Users\WorkStation\AppData\Local\Programs\Python\Python36-32\python.exe
C:/Users/WorkStation/PycharmProjects/test/scraptest/scrap.py File
"C:/Users/WorkStation/PycharmProjects/test/scraptest/scrap.py", line 3
driver = webdriver.Chrome("C:\Users\WorkStation\Desktop\chromedriver.exe")
^ SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated
\UXXXXXXXX escape
Process finished with exit code 1
Then I tried this and now more errors:
driver = webdriver.Chrome("C:\\Users\\WorkStation\\Desktop\\chromedriver.exe")
Error : -
C:\Users\WorkStation\AppData\Local\Programs\Python\Python36-32\python.exe
C:/Users/WorkStation/PycharmProjects/test/scraptest/scrap.py Traceback
(most recent call last): File
"C:\Users\WorkStation\AppData\Local\Programs\Python\Python36-32\lib\site-packages\selenium\webdriver\common\service.py",
line 74, in start
stdout=self.log_file, stderr=self.log_file) File "C:\Users\WorkStation\AppData\Local\Programs\Python\Python36-32\lib\subprocess.py",
line 665, in init
errread, errwrite) = self._get_handles(stdin, stdout, stderr) File
"C:\Users\WorkStation\AppData\Local\Programs\Python\Python36-32\lib\subprocess.py",
line 910, in _get_handles
c2pwrite = msvcrt.get_osfhandle(self._get_devnull()) File "C:\Users\WorkStation\AppData\Local\Programs\Python\Python36-32\lib\subprocess.py",
line 770, in _get_devnull
self._devnull = os.open(os.devnull, os.O_RDWR) FileNotFoundError: [Errno 2] No such file or directory: 'nul'
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File
"C:/Users/WorkStation/PycharmProjects/test/scraptest/scrap.py", line
3, in
driver = webdriver.Chrome("C:\Users\WorkStation\Desktop\chromedriver.exe")
File
"C:\Users\WorkStation\AppData\Local\Programs\Python\Python36-32\lib\site-packages\selenium\webdriver\chrome\webdriver.py",
line 62, in init
self.service.start() File "C:\Users\WorkStation\AppData\Local\Programs\Python\Python36-32\lib\site-packages\selenium\webdriver\common\service.py",
line 81, in start
os.path.basename(self.path), self.start_error_message) selenium.common.exceptions.WebDriverException: Message:
'chromedriver.exe' executable needs to be in PATH.
Exception ignored in: >
Traceback (most recent call last): File
"C:\Users\WorkStation\AppData\Local\Programs\Python\Python36-32\lib\site-packages\selenium\webdriver\common\service.py",
line 173, in del
self.stop() File "C:\Users\WorkStation\AppData\Local\Programs\Python\Python36-32\lib\site-packages\selenium\webdriver\common\service.py",
line 145, in stop
if self.process is None: AttributeError: 'Service' object has no attribute 'process'
Process finished with exit code 1
Even after copying the selenium files from the site-packages folder to the main python folder and adding the absolute path is not working
After doing the above step here is the error
C:\Users\WorkStation\AppData\Local\Programs\Python\Python36-32\python.exe
C:/Users/WorkStation/PycharmProjects/test/scraptest/scrap.py Traceback
(most recent call last): File
"C:\Users\WorkStation\AppData\Local\Programs\Python\Python36-32\selenium\webdriver\common\service.py",
line 74, in start
stdout=self.log_file, stderr=self.log_file) File "C:\Users\WorkStation\AppData\Local\Programs\Python\Python36-32\lib\subprocess.py",
line 665, in init
errread, errwrite) = self._get_handles(stdin, stdout, stderr) File
"C:\Users\WorkStation\AppData\Local\Programs\Python\Python36-32\lib\subprocess.py",
line 910, in _get_handles
c2pwrite = msvcrt.get_osfhandle(self._get_devnull()) File "C:\Users\WorkStation\AppData\Local\Programs\Python\Python36-32\lib\subprocess.py",
line 770, in _get_devnull
self._devnull = os.open(os.devnull, os.O_RDWR) FileNotFoundError: [Errno 2] No such file or directory: 'nul'
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File
"C:/Users/WorkStation/PycharmProjects/test/scraptest/scrap.py", line
3, in
driver = webdriver.Chrome("C:\Users\WorkStation\AppData\Local\Programs\Python\Python36-32\selenium\webdriver\chrome\chromedriver.exe")
File
"C:\Users\WorkStation\AppData\Local\Programs\Python\Python36-32\selenium\webdriver\chrome\webdriver.py",
line 62, in init
self.service.start() File "C:\Users\WorkStation\AppData\Local\Programs\Python\Python36-32\selenium\webdriver\common\service.py",
line 81, in start
os.path.basename(self.path), self.start_error_message) selenium.common.exceptions.WebDriverException: Message:
'chromedriver.exe' executable needs to be in PATH.
Exception ignored in: >
Traceback (most recent call last): File
"C:\Users\WorkStation\AppData\Local\Programs\Python\Python36-32\selenium\webdriver\common\service.py",
line 173, in del
self.stop() File "C:\Users\WorkStation\AppData\Local\Programs\Python\Python36-32\selenium\webdriver\common\service.py",
line 145, in stop
if self.process is None: AttributeError: 'Service' object has no attribute 'process'
Process finished with exit code 1
Here is the screenshot of the issue in PyCharm
System Config:
windows 32-bit
PyDispatcher 2.0.5 2.0.5
attrs 16.3.0 16.3.0
beautifulsoup4 4.5.3 4.5.3
cffi 1.9.1 1.9.1
constantly 15.1.0 15.1.0
cryptography 1.7.1 1.7.1
cssselect 1.0.0 1.0.0
idna 2.2 2.2
incremental 16.10.1 16.10.1
mechanize 0.2.5 0.2.5
pip 9.0.1 9.0.1
pyOpenSSL 16.2.0 16.2.0
pyasn1 0.1.9 0.1.9
pyasn1-modules 0.0.8 0.0.8
pycparser 2.17 2.17
requests 2.12.4 2.12.4
selenium 3.0.2 3.0.2
service-identity 16.0.0
setuptools 32.3.1 32.3.1
six 1.10.0 1.10.0
urllib3 1.19.1 1.19.1
wheel 0.29.0 0.30.0a0
zope.interface 4.3.3 4.3.3
Chrome webdriver Latest Version 2.27
Chrome browser Version Version 55.0.2883.87 m (Up to date)
This SO Q&A might answer your question
I had this problem and I changed the backslash (\\) to forward slash (/).
try this:
driver = webdriver.Chrome('C:/Users/WorkStation/Desktop/chromedriver.exe')

Resources