"sudo pip install" is showing an error code - macos

I am getting an error when I try to pip install:
Found existing installation: numpy 1.8.0rc1
DEPRECATION: Uninstalling a distutils installed project (numpy) has been deprecated and will be removed in a future version. This is due to the fact that uninstalling a distutils project will only partially uninstall the project.
Uninstalling numpy-1.8.0rc1:
Exception:
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/commands/install.py", line 342, in run
prefix=options.prefix_path,
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_set.py", line 778, in install
requirement.uninstall(auto_confirm=True)
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_install.py", line 754, in uninstall
paths_to_remove.remove(auto_confirm)
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_uninstall.py", line 115, in remove
renames(path, new_path)
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/utils/__init__.py", line 267, in renames
shutil.move(old, new)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 302, in move
copy2(src, real_dst)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 131, in copy2
copystat(src, dst)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 103, in copystat
os.chflags(dst, st.st_flags)
OSError: [Errno 1] Operation not permitted: '/tmp/pip-u1pNrS-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy-1.8.0rc1-py2.7.egg-info'

Related

The 'pip==9.0.3' distribution was not found and is required by the application

I have the latest version of pip in my laptop.I always get this error when I install any modules using pip.
Traceback (most recent call last):
File "/usr/local/bin/pip", line 6, in <module>
from pkg_resources import load_entry_point
File "/usr/local/lib/python2.7/site-
packages/pkg_resources/__init__.py", line 3195, in <module>
#_call_aside
File "/usr/local/lib/python2.7/site-
packages/pkg_resources/__init__.py", line 3179, in _call_aside
(*args, **kwargs)
File "/usr/local/lib/python2.7/site-p
packages/pkg_resources/__init__.py", line 3208, in _
initialize_master_working_set
working_set = WorkingSet._build_master()
File "/usr/local/lib/python2.7/site-
packages/pkg_resources/__init__.py", line 681, in _build_master
ws.require(__requires__)
File "/usr/local/lib/python2.7/site-
packages/pkg_resources/__init__.py", line 999, in require
needed = self.resolve(parse_requirements(requirements))
File "/usr/local/lib/python2.7/site-
packages/pkg_resources/__init__.py", line 885, in resolve
raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'pip==9.0.3' distribution was not found and is required by the application
How do I resolve this issue
Verify that you have /usr/bin/pip and it works.
/usr/bin/pip --version
/usr/bin/pip install …
Then remove /usr/local/bin/pip and make bash to rehash the $PATH: hash -r.

pip install apache-airflow then airflow initdb on a fresh virtual environment: SyntaxError

$ virtualenv --version
16.3.0
$ pip --version
pip 19.0.1
I created a fresh environment. And run the
pip install apache-airflow
It is successful installed
apache-airflow 1.10.2
But then I run the
airflow initdb
I got the error
ERROR [airflow.models.DagBag] Failed to import: /Users/admin/workshops/apache/airflow/lib/python3.7/site-packages/airflow/example_dags/example_http_operator.py
Traceback (most recent call last):
File "/Users/admin/workshops/apache/airflow/lib/python3.7/site-packages/airflow/models.py", line 374, in process_file
m = imp.load_source(mod_name, filepath)
File "/Users/admin/workshops/apache/airflow/lib/python3.7/imp.py", line 171, in load_source
module = _load(spec)
File "<frozen importlib._bootstrap>", line 696, in _load
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/Users/admin/workshops/apache/airflow/lib/python3.7/site-packages/airflow/example_dags/example_http_operator.py", line 27, in <module>
from airflow.operators.http_operator import SimpleHttpOperator
File "/Users/admin/workshops/apache/airflow/lib/python3.7/site-packages/airflow/operators/http_operator.py", line 21, in <module>
from airflow.hooks.http_hook import HttpHook
File "/Users/admin/workshops/apache/airflow/lib/python3.7/site-packages/airflow/hooks/http_hook.py", line 23, in <module>
import tenacity
File "/Users/admin/workshops/apache/airflow/lib/python3.7/site-packages/tenacity/__init__.py", line 352
from tenacity.async import AsyncRetrying
^
SyntaxError: invalid syntax
It is a fresh virtual environment. I did not install anything else.
As can be found here, async has become a keyword since Python 3.7. You could create a virtual environment with Python < 3.7 and install Airflow. And perhaps you could also try and upgrade tenacity to >=4.10.0 as the issue in tenacity is resolved in that version.

Can not install the openstacksdk

When I install the openstack sdk in my mac:
pip install openstacksdk
I get the below error:
....
Found existing installation: six 1.4.1
DEPRECATION: Uninstalling a distutils installed project (six) has been deprecated and will be removed in a future version. This is due to the fact that uninstalling a distutils project will only partially uninstall the project.
Uninstalling six-1.4.1:
Exception:
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/commands/install.py", line 342, in run
prefix=options.prefix_path,
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_set.py", line 778, in install
requirement.uninstall(auto_confirm=True)
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_install.py", line 754, in uninstall
paths_to_remove.remove(auto_confirm)
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_uninstall.py", line 115, in remove
renames(path, new_path)
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/utils/__init__.py", line 267, in renames
shutil.move(old, new)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 302, in move
copy2(src, real_dst)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 131, in copy2
copystat(src, dst)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 103, in copystat
os.chflags(dst, st.st_flags)
OSError: [Errno 1] Operation not permitted: '/var/folders/qp/h96_smbd55ggtzwvml8wpl9h0000gn/T/pip-FA4Y1Y-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/six-1.4.1-py2.7.egg-info'
Why I can not install the openstacksdk ? I have tried many times.
EDIT
I use the sudo to install, still get the below error:
Found existing installation: six 1.4.1
DEPRECATION: Uninstalling a distutils installed project (six) has been deprecated and will be removed in a future version. This is due to the fact that uninstalling a distutils project will only partially uninstall the project.
Uninstalling six-1.4.1:
Exception:
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/commands/install.py", line 342, in run
prefix=options.prefix_path,
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_set.py", line 778, in install
requirement.uninstall(auto_confirm=True)
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_install.py", line 754, in uninstall
paths_to_remove.remove(auto_confirm)
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_uninstall.py", line 115, in remove
renames(path, new_path)
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/utils/__init__.py", line 267, in renames
shutil.move(old, new)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 302, in move
copy2(src, real_dst)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 131, in copy2
copystat(src, dst)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 103, in copystat
os.chflags(dst, st.st_flags)
OSError: [Errno 1] Operation not permitted: '/tmp/pip-ipaUQQ-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/six-1.4.1-py2.7.egg-info'
You see there is the Operation not permitted error, but is under the /tmp directory.
You do not have the permission to operate the last file, you can use sudo:
sudo pip install openstacksdk

Trouble Getting VirtualEnvWrapper working on Cygwin

I'm running Windows 10, Python 3.4 and just installed Cygwin. I installed virtualenv and virtualenvwrapper using pip. I updated my ~/.bashrc to have the following:
export WORKON_HOME=~/.virtualenvs
export VIRTUALENVWRAPPER_VIRTUALENV=c:/python35/scripts/virtualenv
source c:/python35/scripts/virtualenvwrapper.sh
But unfortunately, I keep getting an error message very time I open Cygwin. The following error comes up:
path = C:\Cygwin64\tmp/virtualenvwrapper-initialize-hook-XXXXXXXXXX
lpPathBuffer = C:\Cygwin64\tmp\
szTempName = C:\Cygwin64\tmp\tmp66C6.tmp
path = C:\Cygwin64\tmp\tmp66C6.tmp
fd = 3
virtualenvwrapper.user_scripts creating C:\home\ccordero\.virtualenvs\initialize
virtualenvwrapper.user_scripts creating C:\home\ccordero\.virtualenvs\premkproject
Traceback (most recent call last):
File "C:\Python35\lib\runpy.py", line 184, in _run_module_as_main
"__main__", mod_spec)
File "C:\Python35\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Python35\lib\site-packages\virtualenvwrapper\hook_loader.py", line 223, in <module>
main()
File "C:\Python35\lib\site-packages\virtualenvwrapper\hook_loader.py", line 138, in main
output = open(options.script_filename, "w")
OSError: [Errno 22] Invalid argument: 'C:\\Cygwin64\\tmp/virtualenvwrapper-initialize-hook-XXXXXXXXXX\r'
virtualenvwrapper.sh: There was a problem running the initialization hooks.
Please help!

Error installing graphlab

I tried installing graphlab using the pip command where we enter the email address and product key in the command. I tried upgrading it. I am using the sudo pip command and I am working on a Mac. I am getting this exception every time and it fails. I can install the dmg but that is easy. I want to know how to fix this exception. The exception is as follows:
Exception:
Traceback (most recent call last):
File "/Users/karthik/Library/Python/2.7/lib/python/site-packages/pip/basecommand.py", line 209, in main
status = self.run(options, args)
File "/Users/karthik/Library/Python/2.7/lib/python/site-packages/pip/commands/install.py", line 317, in run
prefix=options.prefix_path,
File "/Users/karthik/Library/Python/2.7/lib/python/site-packages/pip/req/req_set.py", line 725, in install
requirement.uninstall(auto_confirm=True)
File "/Users/karthik/Library/Python/2.7/lib/python/site-packages/pip/req/req_install.py", line 756, in uninstall
paths_to_remove.remove(auto_confirm)
File "/Users/karthik/Library/Python/2.7/lib/python/site-packages/pip/req/req_uninstall.py", line 115, in remove
renames(path, new_path)
File "/Users/karthik/Library/Python/2.7/lib/python/site-packages/pip/utils/__init__.py", line 266, in renames
shutil.move(old, new)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 302, in move
copy2(src, real_dst)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 131, in copy2
copystat(src, dst)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 103, in copystat
os.chflags(dst, st.st_flags)
OSError: [Errno 1] Operation not permitted: '/tmp/pip-zVJZnq-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/six-1.4.1-py2.7.egg-info'
if you are on ipython notebook, try :
!pip install

Resources