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
Related
I am using Ubuntu 16.04 to work. There is a need from my work to upgrade pip.
I was using the command:
pip3 install --upgrade pip
After that, every time I call the command pip3 will get the same error:
File "/usr/bin/pip3", line 11, in <module>
sys.exit(main())
File "/home/my_user/.local/lib/python3.5/site-packages/pip/__init__.py", line 11, in main
from pip._internal.utils.entrypoints import _wrapper
File "/home/my_user/.local/lib/python3.5/site-packages/pip/_internal/utils/entrypoints.py", line 4, in <module>
from pip._internal.cli.main import main
File "/home/my_user/.local/lib/python3.5/site-packages/pip/_internal/cli/main.py", line 57
sys.stderr.write(f"ERROR: {exc}")
^
I've tried to search solution by myself and followed this to try to deal with the issue.
This is the command I tried:
curl -fsSL -o- https://bootstrap.pypa.io/pip/3.5/get-pip.py | python3
However, after I tried the command, I got another issue:
Traceback (most recent call last):
File "<stdin>", line 23974, in <module>
File "<stdin>", line 199, in main
File "<stdin>", line 121, in bootstrap
File "/home/my_user/.local/lib/python3.5/site-packages/setuptools/__init__.py", line 18, in <module>
from setuptools.dist import Distribution
File "/home/my_user/.local/lib/python3.5/site-packages/setuptools/dist.py", line 585
license_files: Optional[List[str]] = self.metadata.license_files
^
SyntaxError: invalid syntax
Is there any other way to fix this issue except remove and install python3.5 again? because the python3.5 is used in the Ubuntu 16.04 OS, if I remove it the system will break.
Thank you very much.
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
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
Until now, I used the core module of Ansible.
Now I would play also with Extra Module. Let's say that I want to use on my playbook: bigip_partition.
I've seen that it is in https://github.com/F5Networks/f5-ansible/tree/master/library
Could someone tell me how to install them?
I'm on Ubuntu 14LTS, Ansible 2.2
At the moment:
> sudo pip install bigsuds --upgrade pip
> sudo pip install f5-sdk
> sudo pip install git+https://github.com/F5Networks/f5-ansible.git -vvv
Collecting git+https://github.com/F5Networks/f5-ansible.git
Cloning https://github.com/F5Networks/f5-ansible.git to /tmp/pip-NjrWJw-build
Running command git clone -q https://github.com/F5Networks/f5-ansible.git /tmp/pip-NjrWJw-build
Running setup.py (path:/tmp/pip-NjrWJw-build/setup.py) egg_info for package from git+https://github.com/F5Networks/f5-ansible.git
Running command python setup.py egg_info
Traceback (most recent call last):
File "<string>", line 1, in <module>
IOError: [Errno 2] No such file or directory: '/tmp/pip-NjrWJw-build/setup.py'
Cleaning up...
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-NjrWJw-build/
Exception information:
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/usr/local/lib/python2.7/dist-packages/pip/commands/install.py", line 335, in run
wb.build(autobuilding=True)
File "/usr/local/lib/python2.7/dist-packages/pip/wheel.py", line 749, in build
self.requirement_set.prepare_files(self.finder)
File "/usr/local/lib/python2.7/dist-packages/pip/req/req_set.py", line 380, in prepare_files
ignore_dependencies=self.ignore_dependencies))
File "/usr/local/lib/python2.7/dist-packages/pip/req/req_set.py", line 634, in _prepare_file
abstract_dist.prep_for_dist()
File "/usr/local/lib/python2.7/dist-packages/pip/req/req_set.py", line 129, in prep_for_dist
self.req_to_install.run_egg_info()
File "/usr/local/lib/python2.7/dist-packages/pip/req/req_install.py", line 439, in run_egg_info
command_desc='python setup.py egg_info')
File "/usr/local/lib/python2.7/dist-packages/pip/utils/__init__.py", line 707, in call_subprocess
% (command_desc, proc.returncode, cwd))
InstallationError: Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-NjrWJw-build/
Thanks,
Riccardo
https://github.com/F5Networks/f5-ansible is not a python package, don't try to install it with pip.
To use those modules you just need to put py-files from library to your playbook-path/library.
You'll have a much better experience if you install the 'App Services 3.0' (AS3) declarative interface on you BIG-IP:
https://clouddocs.f5.com/products/extensions/f5-appsvcs-extension/3/
Then you just send 'declarations' of your desired state, instead of working with MANY imperative interfaces...
Here are some example declarations (which are easy to generate/manipulate in Ansible using Jinja2 templates):
https://clouddocs.f5.com/products/extensions/f5-appsvcs-extension/3/userguide/examples.html
When following the Install the AWS CLI Using the Bundled Installer (Linux, OS X, or Unix) directions I'm getting an error caused by what looks to be an incorrect file path file:///Users/jspooner/Downloads/awscli-bundle/packages awscli-1.7.24.tar.gz. I believe it should be packages/awscli. Is there python script broken or am I missing something?
➜ Downloads python --version
Python 2.7.7
➜ Downloads sudo ./awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws
Password:
Running cmd: /usr/local/opt/python/bin/python2.7 virtualenv.py --python /usr/local/opt/python/bin/python2.7 /usr/local/aws
Running cmd: /usr/local/aws/bin/pip install --no-index --find-links file:///Users/jspooner/Downloads/awscli-bundle/packages awscli-1.7.24.tar.gz
Traceback (most recent call last):
File "./awscli-bundle/install", line 138, in <module>
main()
File "./awscli-bundle/install", line 129, in main
pip_install_packages(opts.install_dir)
File "./awscli-bundle/install", line 98, in pip_install_packages
pip_script, PACKAGES_DIR, cli_tarball))
File "./awscli-bundle/install", line 44, in run
p.returncode, cmd, stdout + stderr))
__main__.BadRCError: Bad rc (1) for cmd '/usr/local/aws/bin/pip install --no-index --find-links file:///Users/jspooner/Downloads/awscli-bundle/packages awscli-1.7.24.tar.gz': Traceback (most recent call last):
File "/usr/local/aws/bin/pip", line 9, in <module>
load_entry_point('pip==1.4.1', 'console_scripts', 'pip')()
File "/usr/local/aws/lib/python2.7/site-packages/pkg_resources.py", line 378, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/usr/local/aws/lib/python2.7/site-packages/pkg_resources.py", line 2566, in load_entry_point
return ep.load()
File "/usr/local/aws/lib/python2.7/site-packages/pkg_resources.py", line 2260, in load
entry = __import__(self.module_name, globals(),globals(), ['__name__'])
File "/usr/local/aws/lib/python2.7/site-packages/pip/__init__.py", line 10, in <module>
from pip.util import get_installed_distributions, get_prog
File "/usr/local/aws/lib/python2.7/site-packages/pip/util.py", line 17, in <module>
from pip.vendor.distlib import version
File "/usr/local/aws/lib/python2.7/site-packages/pip/vendor/distlib/version.py", line 13, in <module>
from .compat import string_types
File "/usr/local/aws/lib/python2.7/site-packages/pip/vendor/distlib/compat.py", line 31, in <module>
from urllib2 import (Request, urlopen, URLError, HTTPError,
ImportError: cannot import name HTTPSHandler
Try navigating to the /tmp directory before running amazon's 3 installation commands, rather than running these commands from within your own user folder. I'm not sure why this extra step is required for some OS X installations.
cd /tmp
curl -o awscli.zip https://s3.amazonaws.com/aws-cli/awscli-bundle.zip
unzip awscli.zip
sudo ./awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws
Install PiP and use the following command
pip install awscli --upgrade --user
I would highly recommend installing awscli from Homebrew package manager if you are on OS X.