Can't upgrade or remove pip package "altgraph" on MacOs(Mojave) - python

I want to install PyInstaller package through pip, So I typed "pip install pyinstaller", but it occur errors
and I was trying to upgrade the alt graph to latest version.. but it occur same errors
how can I install the PyInstaller or how can I upgrade the package altgraph ?
Therefore, even I can't delete altgraph using
rm -rf /System/Library/Frameworks/Python.framework/.../altgraph
What I did in terminal
pip install pyinstall - not working
pip install --upgrade altgraph - not working
pip uninstall altgraph - not working

I found a solution from
http://marcelog.github.io/articles/mac_osx_python_pip_install_operation_not_permitted.html
install package under a user
pip install <package> --user

Related

pip install --upgrade pip isnt upgrading pip

I'm trying to upgrade pip on Centos 7. I pip 8.1.2 from /usr/lib/python2.7/site-packages (python 2.7) installed.
When I run pip install --upgrade pip --user I get the following output:
Collecting pip
Using cached https://files.pythonhosted.org/packages/00/b6/9cfa56b4081ad13874b0c6f96af8ce16cfbc1cb06bedf8e9164ce5551ec1/pip-19.3.1-py2.py3-none-any.whl
Installing collected packages: pip
Successfully installed pip-8.1.2
You are using pip version 8.1.2, however version 19.3.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
What I've tried
I've tried the following, which have all resulted in the same output and result as above:
pip install --upgrade pip --user
pip install -U pip --user --ignore-installed
pip install -U pip --user --ignore-installed --no-cache-dir
sudo yum update pip which returns
No Match for argument: pip
No package pip available.
No packages marked for update
sudo yum update python-pip which returns No packages marked for update
Observations
python -m pip --version outputs:
pip 19.3.1 from /home/deploy/.local/lib/python2.7/site-packages/pip (python 2.7)
pip --version outputs:
pip 8.1.2 from /usr/lib/python2.7/site-packages (python 2.7)
You need to update your PATH to include /home/deploy/.local/lib/python2.7/bin before /usr/lib/python2.7/bin if you want pip to resolve to the same location as python. Otherwise, python -m pip is the more proper usage pattern
Otherwise, you're looking at two completely separate python installations and pip is indeed upgraded in one of them
Note: Python2 is end of life, so probably best to remove the one in your home folder, anyway, and switch to using something like Pipenv or pyenv

how to remove these packages from pip?

I decided to start a fresh environment for Python and pip. I ran the command:
pip uninstall -y -r <(pip freeze)
Some packages were giving me permissions errors, so I sudo pip uninstall those, one of those being certifi
Now, when I run pip list:
Package Version
---------- ---------
- rtifi
-ailer 0.8.1
-ertifi 2019.3.9
-rtifi 2018.4.16
pip 19.0.3
setuptools 40.9.0
which is very weird.
I have tried to:
pip install --upgrade --force-reinstall pip
pip install --upgrade --force-reinstall setuptools
but am still resulting in the same list.
How do I complete clean out my installed pip packages?

Python pip package installation

What's the difference between
pip install pkg_name and
pip install -U pkg_name?
Does it automatically install the dependencies too or something?
If we do pip install -h we see:
-U, --upgrade Upgrade all specified packages to the newest
available version.
So it upgrades the packages you specify (they can be already installed)

pip install --upgrade pip installs the same version

Somehow pip --upgrade doesn't upgrade any packages.
I'm on OSX El Capitan (10.11.3) and installed python using brew install python
Python: /usr/local/bin/python# -> ../Cellar/python/2.7.11/bin/python
Pip: /usr/local/bin/pip# -> ../Cellar/python/2.7.11/bin/pip
After successful install I run pip install --upgrade pip.
Full output:
$ pip install --upgrade pip
Collecting pip
Using cached pip-8.1.0-py2.py3-none-any.whl
Installing collected packages: pip
Successfully installed pip-8.0.2
You are using pip version 8.0.2, however version 8.1.0 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Why doesn't pip install the new version?
Update
I think it has something to do with my ~/.pydistutils.cfg file which fixes the DistutilsOptionError: must supply either home or prefix/exec-prefix -- not both error when running pip. I followed these instructions
Related SO question
$ sudo pip install -U pip
Collecting pip
Downloading pip-9.0.3-py2.py3-none-any.whl (1.4MB)
100% |████████████████████████████████| 1.4MB 335kB/s
Installing collected packages: pip
Found existing installation: pip 9.0.1
Uninstalling pip-9.0.1:
Successfully uninstalled pip-9.0.1
Successfully installed pip-9.0.3
Getting annoyed by things not working I created a new OSX profile. In the new profile everything was working fine so after investigating further I found a file ~/Library/Application\ Support/pip/pip.conf in my main profile containing:
[global]
target=/usr/local/lib/python2.7/site-packages
I don't know how it got there but removing it resolved the issue.
This also resolved the need for the ~/.pydistutils.cfg file.

Pip doesn't show my installed packages

pip won't show my installed packages.
I did
brew install python
sudo -E pip install virtualenv
pip list
pip (1.5.6)
setuptools (5.4.2)
wsgiref (0.1.2)
Why isn't pip showing virtualenv?
This pip is the version installed by brew.
When I installed python, it says:
They will install into the site-package directory
/usr/local/lib/python2.7/site-packages
Looking in this directory, virtualenv is not there.
Doing an updatedb; locate virtualenv, I find it installed here:
/lib/python2.7/site-packages/
What gives? Pip installs to above location, but isn't aware of it when I do pip list!
EDIT: In response to #jordanm's comment,
sudo -E pip install virtualenv
Password:
Downloading/unpacking virtualenv
Downloading virtualenv-1.11.6-py2.py3-none-any.whl (1.6MB): 1.6MB downloaded
Installing collected packages: virtualenv
Successfully installed virtualenv
Cleaning up...
sudo -E pip install virtualenv most likely installs virtualenv to OSX provided system-wide Python installation, not Homebrew installed Python.
Try:
brew install pyenv-virtualenv
instead.

Categories