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

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?

Related

Getting error when trying to install apache-airflow on Mac. How can I fix this?

Error output below:
ronakvora:dtc ronakvora$ pip install apache-airflow
Installing build dependencies ... done
Complete output from command python setup.py egg_info:
running egg_info
creating pip-egg-info/pendulum.egg-info
writing requirements to pip-egg-info/pendulum.egg-info/requires.txt
writing pip-egg-info/pendulum.egg-info/PKG-INFO
writing top-level names to pip-egg-info/pendulum.egg-info/top_level.txt
writing dependency_links to pip-egg-info/pendulum.egg-info/dependency_links.txt
writing manifest file 'pip-egg-info/pendulum.egg-info/SOURCES.txt'
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/6x/xsb52c7936l38mmb9f7s268m0000gn/T/pip-install-WFGcOd/pendulum/setup.py", line 50, in <module>
setup(**setup_kwargs)
File "/usr/local/Cellar/python#2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/core.py", line 151, in setup
dist.run_commands()
File "/usr/local/Cellar/python#2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 953, in run_commands
self.run_command(cmd)
File "/usr/local/Cellar/python#2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "/private/var/folders/6x/xsb52c7936l38mmb9f7s268m0000gn/T/pip-build-env-HZt1xp/lib/python2.7/site-packages/setuptools/command/egg_info.py", line 296, in run
self.find_sources()
File "/private/var/folders/6x/xsb52c7936l38mmb9f7s268m0000gn/T/pip-build-env-HZt1xp/lib/python2.7/site-packages/setuptools/command/egg_info.py", line 303, in find_sources
mm.run()
File "/private/var/folders/6x/xsb52c7936l38mmb9f7s268m0000gn/T/pip-build-env-HZt1xp/lib/python2.7/site-packages/setuptools/command/egg_info.py", line 534, in run
self.add_defaults()
File "/private/var/folders/6x/xsb52c7936l38mmb9f7s268m0000gn/T/pip-build-env-HZt1xp/lib/python2.7/site-packages/setuptools/command/egg_info.py", line 570, in add_defaults
sdist.add_defaults(self)
File "/private/var/folders/6x/xsb52c7936l38mmb9f7s268m0000gn/T/pip-build-env-HZt1xp/lib/python2.7/site-packages/setuptools/command/py36compat.py", line 36, in add_defaults
self._add_defaults_ext()
File "/private/var/folders/6x/xsb52c7936l38mmb9f7s268m0000gn/T/pip-build-env-HZt1xp/lib/python2.7/site-packages/setuptools/command/py36compat.py", line 119, in _add_defaults_ext
build_ext = self.get_finalized_command('build_ext')
File "/usr/local/Cellar/python#2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/cmd.py", line 312, in get_finalized_command
cmd_obj.ensure_finalized()
File "/usr/local/Cellar/python#2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/cmd.py", line 109, in ensure_finalized
self.finalize_options()
File "/usr/local/Cellar/python#2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/command/build_ext.py", line 159, in finalize_options
self.include_dirs.append(py_include)
AttributeError: 'unicode' object has no attribute 'append'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/6x/xsb52c7936l38mmb9f7s268m0000gn/T/pip-install-WFGcOd/pendulum/
You are using pip version 18.1, however version 19.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
I had recently encountered a similar error on Airflow 1.10.2 and in my case it was related to incorrect version of pendulum
Run pip show pendulum
Name: pendulum
Version: 1.4.4
Summary: Python datetimes made easy.
...
If your version of pendulum is different from v1.4.4 just do a force-reinstall (Airflow 1.10.2 requires pendulum===1.4.4)
pip install --force-reinstall pendulum===1.4.4
References
Find which version of package is installed with pip
Installing specific package versions with pip
I didn't exactly solve the issue above, but just decided to switch to python3 and used pip3 install apache-airflow.

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.

F5 integration on ansible

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

Can't create virtualenv using Python 3.2. Whodunnit? Pip or setuptools or Python 2.7?

I can't properly install a Python 3.2 based virtual environment using virtualenvwrapper. I have hit a mystery wall and now I am looking for more options to solve my WHODUNNIT? predicament.
Some background
I first tried to install virtualenvwrapper using pip 1.5.6 from Python 2.7 (system's Python default). When I was trying to uninstall/upgrade my pip somehow I broke it. Now if I try:
$ pip
Traceback (most recent call last):
File "/usr/local/lib/python3.2/dist-packages/distribute-0.6.28-py3.2.egg/pkg_resources.py", line 2816, in <module>
working_set.require(__requires__)
File "/usr/local/lib/python3.2/dist-packages/distribute-0.6.28-py3.2.egg/pkg_resources.py", line 690, in require
needed = self.resolve(parse_requirements(requirements))
File "/usr/local/lib/python3.2/dist-packages/distribute-0.6.28-py3.2.egg/pkg_resources.py", line 592, in resolve
raise VersionConflict(dist,req) # XXX put more info here
pkg_resources.VersionConflict: (pip 7.1.2 (/usr/local/lib/python3.2/dist-packages), Requirement.parse('pip==1.5.6'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/bin/pip", line 5, in <module>
from pkg_resources import load_entry_point
File "/usr/local/lib/python3.2/dist-packages/distribute-0.6.28-py3.2.egg/pkg_resources.py", line 2820, in <module>
parse_requirements(__requires__), Environment()
File "/usr/local/lib/python3.2/dist-packages/distribute-0.6.28-py3.2.egg/pkg_resources.py", line 588, in resolve
raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: pip==1.5.6
However, I managed to install PIP3.2.
$ pip3.2 --version
pip 7.1.2 from /usr/local/lib/python3.2/dist-packages (python 3.2)
So I proceeded to install virtualenvwrapper with no problem:
$ sudo pip3.2 install virtualenvwrapper
This is where Python 3.2 resides
$ whereis python3.2.3
whereis python3.2.3
python3.2: /usr/bin/python3.2 /etc/python3.2 /usr/lib/python3.2 /usr/bin/X11/python3.2 /usr/local/lib/python3.2 /usr/include/python3.2 /opt/Python-3.2/bin/python3.2 /usr/share/man/man1/python3.2.1.gz
This is my virtualenv version:
$ virtualenv --version
14.0.6
Error
Before making a virtualenv I modified my .bashrc
export WORKON_HOME=$HOME/.virtualenvs
export PROJECT_HOME=$HOME/admin/workspace
export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3
export VIRTUALENVWRAPPER_VIRTUALENV=/usr/local/bin/virtualenv
source /usr/local/bin/virtualenvwrapper.sh
After sourcing it (i.e. source ~/.bashrc) I just can't manage to start a virtualenv.
$ mkvirtualenv --python=/usr/bin/python3.2 venv
Running virtualenv with interpreter /usr/bin/python3.2
New python executable in /home/admin/.virtualenvs/venv/bin/python3.2
Also creating executable in /home/admin/.virtualenvs/venv/bin/python
/usr/local/lib/python3.2/dist-packages/virtualenv-14.0.6-py3.2.egg/virtualenv_support/pip-8.0.2-py2.py3-none-any.whl/pip/_vendor/pkg_resources/__init__.py:87: UserWarning: Support for Python 3.0-3.2 has been dropped. Future versions will fail here.
Traceback (most recent call last):
File "/usr/local/lib/python3.2/dist-packages/virtualenv-14.0.6-py3.2.egg/virtualenv.py", line 2304, in <module>
main()
File "/usr/local/lib/python3.2/dist-packages/virtualenv-14.0.6-py3.2.egg/virtualenv.py", line 705, in main
symlink=options.symlink)
File "/usr/local/lib/python3.2/dist-packages/virtualenv-14.0.6-py3.2.egg/virtualenv.py", line 924, in create_environment
download=download,
File "/usr/local/lib/python3.2/dist-packages/virtualenv-14.0.6-py3.2.egg/virtualenv.py", line 843, in install_wheel
cert_data = pkgutil.get_data("pip._vendor.requests", "cacert.pem")
File "/usr/lib/python3.2/pkgutil.py", line 573, in get_data
loader = get_loader(package)
File "/usr/lib/python3.2/pkgutil.py", line 461, in get_loader
return find_loader(fullname)
File "/usr/lib/python3.2/pkgutil.py", line 471, in find_loader
for importer in iter_importers(fullname):
File "/usr/lib/python3.2/pkgutil.py", line 427, in iter_importers
__import__(pkg)
File "/usr/local/lib/python3.2/dist-packages/virtualenv-14.0.6-py3.2.egg/virtualenv_support/pip-8.0.2-py2.py3-none-any.whl/pip/__init__.py", line 15, in <module>
After the error if I type...
$ workon
$
Funny thing is the venv is created in .virtualenvs
Possible causes
Reading elsewhere in the web (I found just one person having a similar problem) it could be solved using a previous version of virtualenv (I tried that to no success), or maybe I'm using an incorrect combination of pip and/or virtualenv and/or virtualenvwrapper. Or perhaps it's my Python2.7 messing around in the background.
UPDATE: Setuptools
Or what about setuptools? Apparently it has to do. I was getting this error when trying with PIP 1.5.6
UserWarning: Support for Python 3.0-3.2 has been dropped. Future versions will fail here.
warnings.warn(msg)
ANOTHER UPDATE: Fixed the original pip
I managed to fix original pip using:
$ wget https://bootstrap.pypa.io/get-pip.py
$ sudo python get-pip.py
$ pip --version
pip 8.0.3 from /usr/local/lib/python2.7/dist-packages (python 2.7)
UPDATE: Virtualwrapper isn't!
In my own 'Whodunnit' saga I'd say virtualwrapper has nothing to do. Here:
$ virtualenv -p /usr/bin/python3.2 ~/.virtualenvs/venv32
Running virtualenv with interpreter /usr/bin/python3.2
New python executable in /home/admin/.virtualenvs/venv32/bin/python3.2
Also creating executable in /home/admin/.virtualenvs/venv32/bin/python
/usr/local/lib/python2.7/dist-packages/virtualenv_support/pip-8.0.2-py2.py3-none-any.whl/pip/_vendor/pkg_resources/__init__.py:87: UserWarning: Support for Python 3.0-3.2 has been dropped. Future versions will fail here.
But problem still persists. What else could I try?
Thanks in advance!
You must use pip < 8 and virtualenv < 14 if you want to use Python 3.2. See also https://virtualenv.pypa.io/en/latest/changes.html#id7
Why do you need to use ancient Python 3.2? The best thing you can do would be to install and use the far superior Python >= 3.4 instead.

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

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.

Resources