I have installed Caffe on my Ubuntu15.10x64 Machine with protobuf 2.6.1. Also, as of today, I installed TensorFlow with virtualenv but TensorFlow needs protobuf 3.0. From what I have read, virtualenv supports using different libraries for python projects. Can I safely pip install --upgrade protobuf inside the (tensorflow) virtualenv without disrupting my Caffe install - thus having protobuf 2.6 as default, and protobuf 3.0 in my virtualenv used by TensorFlow?
Or is the only solution to install with Docker or Create a Clone in a Virtual Machine? Better than nothing, but I would like to use my GPU and full power.
Thanks for help and clarification.
Edit:
So, this is what happens when I try to update protobuf ->
(tensorflow)peter#UNIGMA:~$ pip install --upgrade protobuf
Requirement already up-to-date: protobuf in /usr/local/lib/python2.7/dist-packages
Requirement already up-to-date: setuptools in ./tensorflow/lib/python2.7/site-packages (from protobuf)
Cleaning up...
If i check the version this is what it returns ->
(tensorflow)peter#UNIGMA:~$ pip show protobuf
---
Name: protobuf
Version: 2.6.1
Location: /usr/local/lib/python2.7/dist-packages
Requires: setuptools
(tensorflow)peter#UNIGMA:~$ pip -V
pip 1.5.6 from /home/peter/tensorflow/local/lib/python2.7/site-packages (python 2.7)
Do I have to manually update protobuf? I presume that I would create a protobuf folder inside ./tensorflow/lib/python2.7/dist-packages with the version I need?
Note that your virtualenv doesn't see packages from outside, so you should not have protobuf visible in your virtualenv at all, even though you have it installed globally in the system (or in the Caffe's virtualenv, depending on your setup).
It should be safe for you to run pip install protobuf inside the TensorFlow's virtualenv, it will not disrupt your global setup or any other virtualenv you have.
Related
Currently started to learn TFQ and been trying to do this tutorial of tensorflow authors, but if I run the first line (!pip install -q tensorflow==2.3.1 --user) I get this error:
ERROR: pip's dependency resolver does not currently take into account
all the packages that are installed. This behaviour is the source of
the following dependency conflicts. cirq 0.8.0 requires
protobuf==3.8.0, but you have protobuf 3.15.7 which is incompatible.
And when I run the second line (!pip install -q tensorflow-quantum --user) I get this one:
ERROR: pip's dependency resolver does not currently take into account
all the packages that are installed. This behaviour is the source of
the following dependency conflicts. tensorflow 2.3.1 requires
protobuf>=3.9.2, but you have protobuf 3.8.0 which is incompatible.
Cirq 0.8.0 wants protobuf 3.8.0; tensorflow 2.3.1 wants protobuf>=3.9.2 and there is nothing in between and when I do "pip freeze", I only see protobuf==3.8.0, so my pip freeze doesn't see the protobuf 3.15.7 version that the error mentions of (when I do "pip show protobuf" i get the same result of version 3.8.0).
What should I do to prevent this conflict?
Note:
Python version = 3.7.9 (couldn't install tf and/or tfq with either 3.8 nor 3.9);
OS = Windows 10
Installing two different packages on same environment overrides most of the other. This is the way pip works.It is recommended to use virtual environment for each package.
python -m tf_nightly --system-site-packages .\venv
.\venv\Scripts\activate
pip install --upgrade pip
pip install tf-nightly
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
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.
Hello I have a personal pip repo where I have uploaded 3 version of a personal library. The versions are:
my-lib-0.1.0
my-lib-1.0.0
my-lib-1.0.1
I have another application which uses my-lib as a dependency, defined in the setup.py file like:
install_requires = [
"my-lib",
# more packages here
]
Now installing my app will install latest version of my-lib e.g
pip install --index-url "myprivate-pip-url-index" my-app will instal version 1.0.1 of my-lib. Verified by doing this:
pip freeze | grep my-lib
my-lib==1.0.1
But supposing I had already a previous version of my-lib installed manually with pip then installing my latest version of my app will not upgrade the version of my already installed lib.
pip install --index-url "myprivate-pip-url-index" my-lib==0.1.0
pip install --index-url "myprivate-pip-url-index" my-app
pip freeze | grep my-lib
my-lib==0.1.0
I was expecting the installation of my-app would see that it requires latest version of my-lib, and that my-lib is not in latest version and move on with updating it. Am I doing something wrong? Am I missing something with pip?
pip version: 20.0.2
python version 3.7
Operating system: MacOS
Default upgrade strategy is only-if-needed. To always upgrade use eager upgrade strategy:
pip install --upgrade --upgrade-strategy eager
You can configure pip to always use eager upgrade strategy using pip config:
pip config set install.upgrade-strategy eager
I needed to specify --upgrade-strategy eager for it to update my dependency to the latest version I thought that was the default behaviour for some kind of reason. Anyways thank you very much.
I am trying to install the OpenCV-python on my mac and i have used the following:
$pip install opencv-python
which gave me the following error:
$pip install opencv-python
Collecting opencv-python
Using cached opencv_python-3.4.0.12-cp27-cp27m macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl
Collecting numpy>=1.11.1 (from opencv-python)
Using cached numpy-1.14.2-cp27-cp27m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl
matplotlib 1.3.1 requires nose, which is not installed.
matplotlib 1.3.1 requires tornado, which is not installed.
Installing collected packages: numpy, opencv-python
Found existing installation: numpy 1.8.0rc1
Cannot uninstall 'numpy'. 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.
Then i did try the pip install --upgrade matplotlib which didnot change anything. It just show me:
matplotlib 2.2.2 requires backports.functools-lru-cache, which is not installed.
matplotlib 2.2.2 has requirement numpy>=1.7.1, but you'll have numpy 1.8.0rc1 which is incompatible.
As I found many ways to install the openCV-python in the internet like:
https://www.pyimagesearch.com/2015/06/15/install-opencv-3-0-and-python-2-7-on-osx/
and I installed on my other mac but i got import cv2 problem alot in my codes.
I will be more than happy if anyone have a good solution or recommendation to install the openCV-python.
Thanks
In summary, macOS comes with the Python preinstalled and you should not mess with the packages installed as some system utilities depend on them.
https://docs.python.org/3.7/using/mac.html
The Apple-provided build of Python is installed in /System/Library/Frameworks/Python.framework and /usr/bin/python, respectively. You should never modify or delete these, as they are Apple-controlled and are used by Apple- or third-party software. Remember that if you choose to install a newer Python version from python.org, you will have two different but functional Python installations on your computer, so it will be important that your paths and usages are consistent with what you want to do.
You should take a look on either venv or virtualenv.
You can read this answer: https://stackoverflow.com/a/41972262/4796844 that will get you through the basics.
In a nutshell, to solve your problem:
$ python3 -m venv ./project-name
$ . ./project-name/bin/activate
$ pip install opencv-python
And to leave the virtual environment, simply:
$ deactivate