pip install tries to install already installed package in anaconda3 - python

So, Iere is what I encountered:
I try to install pip install lxml under windows, python3.5 (anaconda3), and I have the error saying that
running build_ext
building 'lxml.etree' extension
error: Unable to find vcvarsall.bat
so of course I downloaded lxml for http://www.lfd.uci.edu/~gohlke/pythonlibs, and installed without a problem using the .whl file, and then I try to install a package that depends on lxml, pip is trying to build lxml again and does not aware it already has been installed....
Second problem, I upgraded pip to 8.1.2, and when I do pip --version i have 8.1.2. however, when I try to pip install something, I still get the message:
You are using pip version 8.0.0, however version 8.1.2 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
anyone had the same problem? so strange, before I never had such issues.
Update
I think i found the answer, i have ignore-installed=true in my pip.ini, dont know how this was set, when i delete the line, everything worked

Related

Not able to install "pip"

So I am trying to download pip for gRPC as given on grpc.io website. And I read many questions related to that but I am still not able to download pip. I am using mac with python (version 2.7.10).
when I write pip on console. It gives below error :-
bash: pip: command not found
I checked few questions and they were recommending easy_install pip but didn't work either.
One of my colleague recommended to use brew install pip as we have installed almost everything using brew.Got below error when I did that.
Error: No available formula with the name "pip"
Homebrew provides pip via:brew install python. However you will then
have two Pythons installed on your Mac, so alternatively you can install
pip via the instructions at:
https://pip.readthedocs.io/en/stable/installing/
I went on this link and it says to run curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py and after that, run this python get-pip.py.
I did this but it gives below thing :
Collecting pip
Using cached https://files.pythonhosted.org/packages/c2/d7/90f34cb0d83a6c5631cf71dfe64cc1054598c843a92b400e55675cc2ac37/pip-18.1-py2.py3-none-any.whl
Installing collected packages: pip
Found existing installation: pip 18.1
Uninstalling pip-18.1:
Successfully uninstalled pip-18.1
Rolling back uninstall of pip
Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/pip'
Consider using the `--user` option or check the permissions.
Could you all suggest a way to download and use pip?
UPDATE
Earlier I was trying to install using sudo easy_install pip, it was giving an error. Now I tried doing it, it got installed. Thanks all for the help.
follow the following steps:
go to pypi website pip offcial account .
Download the source file. pip-18.1.tar.gz
Extract the file.
in command prompt run command :
python setup.py install
pip is installed now.

Cannot uninstall 'pandas' (distutils installed project)

I have created a conda environment where I am installing all the stuff I need.
I already had installed the pandas library, but I need to upgrade it to the latest version.
However, when I try pip3 install --upgrade pandas I get the following error:
Found existing installation: pandas 0.15.2
Cannot uninstall 'pandas'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.
I have tried sudo apt-get remove pandas, but this get me a message saying that the pandas package cannot be found.
In case is relevant, I am in Ubuntu 16.04 and using python 3.6.3
Though I'm unable to reproduce the error, you can try:
1) Reduce version
pip install --upgrade --force-reinstall pip==18.0
Try to re-install package
pip install xxx --disable-pip-version-check
At last, recover the latest version for pip
pip install --upgrade pip
2) pip install -I==18.0 -r requirements.txt
3) Try removing manually from 'site-packages'
These solutions were found here

pip refuses to upgrade

I currently have installed pip 8.1.2.
So I want to upgrade it to the latest version (9.0.1) and I execute:
sudo pip install --upgrade pip
Collecting pip
Downloading pip-9.0.1-py2.py3-none-any.whl (1.3MB)
100% |████████████████████████████████| 1.3MB 846kB/s
Installing collected packages: pip
Found existing installation: pip 8.1.2
Not uninstalling pip at /usr/lib/python2.7/dist-packages, outside environment /usr
Successfully installed pip-8.1.2
You are using pip version 8.1.2, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
It seems that it correctly downloads 9.0.1 but then it refuses to uninstall the existing installation (8.1.2)
And then at the end it suggests me to upgrade using the same exact instruction I already provided!
Am I doing anything wrong?
The Ubuntu pip version has been patched to prevent self-upgrades (all installation into system-managed files are prevented, the patch is named hands-off-system-packages.patch). You are supposed to use the Ubuntu packaging system to upgrade instead. The feedback provided could be improved certainly.
As there is no Ubunutu package of pip 9.0.1 available yet for your Ubuntu version, you can't actually upgrade to a newer version this way (there is a version for Zesty however).
A (ugly) work-around is to use easy_install instead:
sudo easy_install -U pip
This works because easy_install has not been booby-trapped to prevent the upgrade. However, this'll replace system managed files with the newer pip version. If your package manager were to re-install the python-pip package, it'll happily overwrite those files and you could in theory end up with a broken installation. Also, easy_install adds more files than the package would, and those extra files could cause issues later down the line, especially when you upgrade python-pip later when a new version is packaged.
If you were to use a virtualenv, you are free to upgrade pip inside that, which works just fine.
If above are not working, please try this it works(I had similar situations and this works):
download get-pip.py:
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
Run the downloaded file: python get-pip.py
Above uninstalls the old version and install the latest ones.
Reference Link: https://pip.pypa.io/en/stable/installing/#installing-with-get-pip-py
Had a similar issue with pip not wishing to upgrade, though I'm not keen on replacing the package manager's version and as I'm always adding the --user option on installations via pip I figured "what's the harm?" in doing the same with pip on itself.
pip install --user --upgrade pip
It'll only work for one user but for some use cases that is just peachy.

Installing pip for an offline machine on Python 2.7, CentOS 6.3

I'm trying to install lxml for Centos6.3, due to this issue. It looks like I've got a conflicting version of pip. The standing solution seems to re-install pip for the correct version of python.
My main issue is that all the methods I've found for installing pip require an internet connection. Is it possible to download pip install files, and then run pip install -U pip and point it at the right files?
The PyPI page for pip only has pip6.11 as a .whl. I've tried running pip install -U pip-6.1.1-py2.py3-none-any.whl and it's not worked.
I'm stumped. How do I install it?
You could try to download pip and setuptools manually from: https://pypi.org/project/pip/#files and https://pypi.org/project/setuptools/#files
get the python pip script from: https://bootstrap.pypa.io/get-pip.py
after that unzip/untar packages and run:
python get-pip.py --no-index --find-links=/path/to/pip-and-setuptools
or alternatively trying:
python setup.py install when running in unpacked folders
More here: https://github.com/pypa/pip/issues/2351

brew install python - fails OSX

Im trying to install python through brew with:
brew install python
But get the following error:
Stevens-MacBook-Pro :: ~ ‹master*› » brew install python
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/python-2.7.
Already downloaded: /Library/Caches/Homebrew/python-2.7.8_2.mountain_lion.bottle.tar.gz
==> Pouring python-2.7.8_2.mountain_lion.bottle.tar.gz
==> Caveats
Setuptools and Pip have been installed. To update them
pip install --upgrade setuptools
pip install --upgrade pip
You can install Python packages with
pip install <package>
They will install into the site-package directory
/usr/local/lib/python2.7/site-packages
See: https://github.com/Homebrew/homebrew/wiki/Homebrew-and-Python
.app bundles were installed.
Run `brew linkapps` to symlink these to /Applications.
/usr/bin/install_name_tool: object: /usr/local/Cellar/python/2.7.8_2/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python malformed object (unknown load command 10)
Error: Failed to fix install names
The formula built, but you may encounter issues using it or linking other
formula against it.
==> /usr/local/Cellar/python/2.7.8_2/bin/python -ssetup.py --no-user-cfg instal
using one of the approaches described here:
Please make the appropriate changes for your system and try again.
Warning: The post-install step did not complete successfully
You can try again using `brew postinstall python`
==> Summary
🍺 /usr/local/Cellar/python/2.7.8_2: 4626 files, 73M
The error messages says the post install fails, and to try installing it again with:
brew postinstall python
but the error still persists. I also tried brew linkapps and it success fully links python but when I run pip from the console I get this error:
Stevens-MacBook-Pro :: ~ ‹master*› » pip
zsh: /usr/local/bin/pip: bad interpreter: ##HOMEBREW_PREFIX##/opt/python/bin/python2.7: no such file or directory
Any idea what might be going wrong?
Pyenv is a python version management tool, something like rbenv but for python.
You could easily install and change python version via pyenv easily.
The following shows how to install python with version 2.7.8 through pyenv:
ubuntu#ubuntu:~$ pyenv install 2.7.8
Downloading Python-2.7.8.tgz...
-> http://yyuu.github.io/pythons/74d70b914da4487aa1d97222b29e9554d042f825f26cb2b93abd20fdda56b557
Installing Python-2.7.8...
Installing setuptools from https://bootstrap.pypa.io/ez_setup.py...
Installing pip from https://bootstrap.pypa.io/get-pip.py...
Installed Python-2.7.8 to /home/ubuntu/.pyenv/versions/2.7.8
as you can see, its very simple.
The command pyenv install "version" help you to install a specific versions of python easily and even pip, setuptools are also automatically installed.
I suggest giving pyenv a try!!

Categories