pip automatically downloading requirements - python

I use pip2 to install tensorflow-gpu(1.8.0), and the tensorflow-gpu requires the numpy>=1.13.0, so pip2 automatically download the newest version of numpy(which is 1.19.1), but the newest numpy does not support python2.7 so that I fail to install tensorflow-gpu. I want to know if I can cancel the automatically download and install the numpy by myself? Or is there other method to install tensorflow1.8.0 in python2.7? The log outputted by pip2 is as follow:
log to install tensorflow

You can specify multiple packages with version numbers:
pip2 install tensorflow-gpu==1.8.0 numpy==1.13.3
Note that tensorflow-gpu 1.8.0 has requirement numpy>=1.13.3.

Related

Install albumentations with custom opencv-python version using pip?

The albumentations package requires some version of opencv-python. From setup.py:
# If none of packages in first installed, install second package
CHOOSE_INSTALL_REQUIRES = [
(
("opencv-python>=4.1.1", "opencv-contrib-python>=4.1.1", "opencv-contrib-python-headless>=4.1.1"),
"opencv-python-headless>=4.1.1",
)
]
When I pip install, it seems to choose opencv-python-headless, which has a bug that prevents installation. (If you read the bug, it looks like I could install a different version of scikit-build, but that didn't seem to work.)
The workaround is to install a dev version of opencv-python, which I can with this line in requirements.txt:
git+https://github.com/opencv/opencv-python#5de8d66d454c8fd946ae17dcfcb285b16aa6049b
However, while installing albumentations, it decides to still install opencv-python-headless, presumably because the version number (installed from github) doesn't compare well.
How can I install albumentations and have it use my existing opencv-python install?
I installed pip-tools, and compiled the requirements for albumentation, and I've been messing with the file, but pip still follows dependencies for each package.
Can I use pip to install a package directly, without dependencies? Then I could do it one at a time, with the versions I want.
Hi I had a similar problem what have done is:
Install opencv-python using pip install opencv-python==4.5.5
Download albumentations from github
git checkout {albumentations_version} you want to install
Change in albumentations/setup.py opencv-python>=4.1.1 with opencv-python==4.5.5.64
Update pip. pip install pip --upgrade. My version is 22.1.2
pip install albumentations/
At the end i have albumentations 1.1.0 installed with opencv-python==4.5.5 and not the latest version of opencv.

Upgrading packages with pip is not working properly

I am using pip in Ubuntu 20.04 with Python 3.8. I am trying to upgrade some packages and it seems to work since it does not give any error message. However, if I do pip show for the desired package, the version remains unchanged.
For instance, in the case of pip itself I am doing the following:
python -m pip install --upgrade pip
And I am obtaining:
Collecting pip
Using cached pip-20.3.3-py2.py3-none-any.whl (1.5 MB)
Installing collected packages: pip
Successfully installed pip-20.3.3
Then, when I try to check the installed version with pip show pip, I get the following:
Name: pip
Version: 20.0.2
Summary: The PyPA recommended tool for installing Python packages.
Home-page: https://pip.pypa.io/
Author: The pip developers
Author-email: pypa-dev#groups.google.com
License: MIT
Location: /usr/lib/python3/dist-packages
Requires:
Required-by: pip-upgrade
I have observed this problem also for scipy. However, I have been able to upgrade virtualenv and seaborn following the same procedure described above.
On the other hand, if I do the same upgrade process using sudo it does work. However, I would like to have the new versions installed not only for superuser.
Thanks in advance.
You may have multiple installations of Python on your system.
First provide the full name for Python 3.8 when installing pip to make sure it is installing pip for 3.8.
python3.8 -m pip install --upgrade pip
You could also try to use the pip specifically for Python 3.8. It is usually called pip3.8.
It could also be the environment you are installing it in. It's better to use pip --version so that you know where it is pulling pip from, as well the version of Python being used.
pip3.8 --version
pip 20.3.3 from /home/eandersson/.local/lib/python3.8/site-packages/pip (python 3.8)
As you can see here depending on the user and env variables set it may be installed in a different location.
sudo pip3.8 --version
pip 20.2.3 from /usr/local/lib/python3.8/dist-packages/pip (python 3.8)
I would also recommend that you use a virtualenv if you need specific versions libraries installed for your project.
virtualenv venv
source venv/bin/activate
pip install pip --upgrade

What versions of python, anaconda and tensorflow work best to gether on windows 8.1?

taking different machine learning courses. i tried to install tensorflow after deleting my old anaconda/python (which took a while) and downloading 3.7, but then ran into version problems like this. downloading anaconda3 5.20 now.
so is there a preferred combination of recent python, anaconda, and tensorflow versions that play well together on windows 8.1.
edit: looks like anaconda can deal with different versions of python.
edit2: trying:
conda create -n tensorflow pip python=3.5
activate tensorflow
pip install --ignore-installed --upgrade tensorflow
gets tensorflow installed and working but issues a warning:
You are using pip version 10.0.1, however version 18.0 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
(tensorflow) C:\Users\ray>python -m pip install --upgrade pip
Collecting pip
Using cached https://files.pythonhosted.org/packages/5f/25/e52d3f31441505a5f3a
f41213346e5b6c221c9e086a166f3703d2ddaf940/pip-18.0-py2.py3-none-any.whl
tensorflow 1.10.0 has requirement setuptools<=39.1.0, but you'll have setuptools
40.0.0 which is incompatible.
Installing collected packages: pip
Found existing installation: pip 10.0.1
Uninstalling pip-10.0.1:
Successfully uninstalled pip-10.0.1
Successfully installed pip-18.0
so now i have a red warning.

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.

Categories