Install the AWS CLI Using the Bundled Installer (Linux, OS X, or Unix) - macos

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.

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

Airflow on WSL2 Ubuntu: ValueError: Unable to configure handler 'processor'

I am aware that very similar questions have been asked previously but I have found these have tended to include Docker, which I am not using at this time, nor do I have installed. I am led to believe that WSL2 should be an alternative to Docker regarding running Airflow on Windows.
I am using WSL2 on my Windows 11 laptop and have installed Apache-Airflow from a tutorial from the following link:
https://coding-stream-of-consciousness.com/2018/11/06/apache-airflow-windows-10-install-ubuntu/
On WSL2 I have:
Python version 3.8.10
Pip version 20.0.2
Apache-Airflow 2.4.1 (I believe)
I have run the following commands (as per the tutorial) with no issue:
sudo apt-get install software-properties-common
sudo apt-add-repository universe
sudo apt-get update
sudo apt-get install python-pip
sudo pip install apache-airflow #I had path issues without 'sudo' command
But when I attempt to use the 'airflow' command in the WSL2 Ubuntu terminal, I am greeted with the following error:
$ airflow
Unable to load the config, contains a configuration error.
Traceback (most recent call last):
File "/usr/lib/python3.8/logging/config.py", line 563, in configure
handler = self.configure_handler(handlers[name])
File "/usr/lib/python3.8/logging/config.py", line 744, in configure_handler
result = factory(**kwargs)
File "/usr/local/lib/python3.8/dist-packages/airflow/utils/log/file_processor_handler.py", line 45, in __init__
self.filename_template, self.filename_jinja_template = parse_template_string(filename_template)
File "/usr/local/lib/python3.8/dist-packages/airflow/utils/helpers.py", line 165, in parse_template_string
import jinja2
File "/usr/lib/python3/dist-packages/jinja2/__init__.py", line 33, in <module>
from jinja2.environment import Environment, Template
File "/usr/lib/python3/dist-packages/jinja2/environment.py", line 15, in <module>
from jinja2 import nodes
File "/usr/lib/python3/dist-packages/jinja2/nodes.py", line 23, in <module>
from jinja2.utils import Markup
File "/usr/lib/python3/dist-packages/jinja2/utils.py", line 656, in <module>
from markupsafe import Markup, escape, soft_unicode
ImportError: cannot import name 'soft_unicode' from 'markupsafe' (/usr/local/lib/python3.8/dist-packages/markupsafe/__init__.py)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/local/bin/airflow", line 5, in <module>
from airflow.__main__ import main
File "/usr/local/lib/python3.8/dist-packages/airflow/__init__.py", line 46, in <module>
settings.initialize()
File "/usr/local/lib/python3.8/dist-packages/airflow/settings.py", line 564, in initialize
LOGGING_CLASS_PATH = configure_logging()
File "/usr/local/lib/python3.8/dist-packages/airflow/logging_config.py", line 74, in configure_logging
raise e
File "/usr/local/lib/python3.8/dist-packages/airflow/logging_config.py", line 69, in configure_logging
dictConfig(logging_config)
File "/usr/lib/python3.8/logging/config.py", line 808, in dictConfig
dictConfigClass(config).configure()
File "/usr/lib/python3.8/logging/config.py", line 570, in configure
raise ValueError('Unable to configure handler '
ValueError: Unable to configure handler 'processor'
I have googled the ValueError extensively and can't find any clear solutions that don't involve Docker.
Any insight into the error would be much appreciated!
You should install airflow using constraints.
https://airflow.apache.org/docs/apache-airflow/stable/installation/installing-from-pypi.html#installation-tools
This is the only way installation of airflow is guaranteed to work.

ubuntu16.04 pip3 broken after upgrading

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.

catch_config_error while trying to run ipython3

I'm getting the following error trying to run ipython3.
catch_config_error() missing 1 required positional argument: 'app'
I first got it on my Mac (python36). As my system has all sorts of customizations, I tried it again on a Linux system (Centos 7.4). I install ipython using pip3 and everything seemed to install cleanly. (On the same system, if i do this with python2, it seems to work.
Complete error log:
[scott] ipython3
Traceback (most recent call last):
File "/usr/bin/ipython3", line 7, in <module>
from IPython import start_ipython
File "/usr/lib/python3.4/site-packages/IPython/__init__.py", line 54, in <module>
from .core.application import Application
File "/usr/lib/python3.4/site-packages/IPython/core/application.py", line 23, in <module>
from traitlets.config.application import Application, catch_config_error
File "/usr/lib/python3.4/site-packages/traitlets/config/__init__.py", line 6, in <module>
from .application import *
File "/usr/lib/python3.4/site-packages/traitlets/config/application.py", line 120, in <module>
class Application(SingletonConfigurable):
File "/usr/lib/python3.4/site-packages/traitlets/config/application.py", line 291, in Application
def initialize(self, argv=None):
TypeError: catch_config_error() missing 1 required positional argument: 'app'
This is happening because traitlets relies on a package called 'decorator' that was just updated from 4.1.2 to 4.2.0 and broken its backward compatibility.
If you're using a requirements file or pip, install decorator==4.1.2 before installing IPython.
I tried in Ubuntu 16.04.
I also had the same problem (Python 3.6)
I tried again today.
$ sudo -H pip3 install --upgrade ipython
Then, decorator 4.2.1 is newly installed and the problem is solved.

Error uninstall editable packages with pip (installed with -e)

I have almost same problem as in How to uninstall editable packages with pip (installed with -e)
On my osx machine, I have a github branch installed (not on virtualenv). Below is the details:
$ pip freeze
...
-e git+git#github.com:cgl/CWA-Normalizer.git#de...02#egg=CWA-TwPipe-Naacl
$ pip --version
pip 7.1.2 from /usr/local/lib/python2.7/site-packages (python 2.7)
$ ll /usr/local/bin/python
/usr/local/bin/python# -> ../Cellar/python/2.7.10_2/bin/python
Trying to uninstall or upgrading did not work:
$ pip uninstall CWA-TwPipe-Naacl git+git#github.com:cgl/CWA-Normalizer.git#de4e8dae415b1b35d38eed14244127c8401ea902#egg=CWA-TwPipe-Naacl
Exception:
Traceback (most recent call last):
File "/usr/local/lib/python2.7/site-packages/pip/basecommand.py", line 211, in main
status = self.run(options, args)
File "/usr/local/lib/python2.7/site-packages/pip/commands/uninstall.py", line 61, in run
wheel_cache=wheel_cache
File "/usr/local/lib/python2.7/site-packages/pip/req/req_install.py", line 213, in from_line
wheel_cache=wheel_cache, constraint=constraint)
File "/usr/local/lib/python2.7/site-packages/pip/req/req_install.py", line 67, in __init__
req = pkg_resources.Requirement.parse(req)
File "/usr/local/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2980, in parse
reqs = list(parse_requirements(s))
File "/usr/local/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2924, in parse_requirements
"version spec")
File "/usr/local/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2889, in scan_list
raise RequirementParseError(msg, line, "at", line[p:])
RequirementParseError: Expected version spec in git+git#github.com:cgl/CWA-Normalizer.git#de4e8dae415b1b35d38eed14244127c8401ea902#egg=CWA-TwPipe-Naacl at +git#github.com:cgl/CWA-Normalizer.git#de4e8dae415b1b35d38eed14244127c8401ea902#egg=CWA-TwPipe-Naacl
I checked /Library/Python/2.7/site-packages/easy-install.pth and /usr/local/lib/python2.7/site-packages/easy-install.pth , both files don't have it listed.
How can I uninstall it? Where may it be listed?

Resources