Conflict of protobuf versions between tensorflow 2.3.1 and cirq - python

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

Related

pip does not find the version of the package to install

I want to install pytorch3d version 0.3.0 or above, but pip sees only 0.0.1 version for installing. I runned next commands:
pip install pytorch3d==0.3.0
And got the next error:
ERROR: Could not find a version that satisfies the requirement pytorch3d==0.3.0 (from versions: 0.0.1)
ERROR: No matching distribution found for pytorch3d==0.3.0
If I run the install command without a specific version, pip will install the package with version 0.0.1.
My environment:
Windows 10 x64
Python 3.9.7
pip 21.2.4
Note:
direct internet connection, no proxy used
I haven't others versions python on pc
same errors when installing next packages: torchvision==0.7.0, torch==1.6.0
I tried with the virtualenv and without them
I installed Python from the windows store.
From their installation guide and your requirements use:
pip install pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/py38_cu102_pyt190/download.html
Specified package cannot be installed via pip, because not supported on my os(Windows 10). This can be seen on the page with the version and available files for download of the required package.

Even after importing Numpy not recognised

My code:
import numpy as np
import tensorflow
Output:
NameError Traceback (most recent call last)
< ipython-input-1-87dbf2ff9b36 > in < module >
----> 1 x = np.random.randint(0,100)
NameError: name 'np' is not defined
What I don't understand is that even though I have already imported the library it is not getting detected and gives me a NameError, Same is the case with a lot of libraries.
I am currently using Jupyter Lab through Anaconda.
=================================>
Got the solution for all the Issues while installing TensorFlow on M1 Macbook
Follow the below link:
https://naturale0.github.io/machine%20learning/setting-up-m1-mac-for-both-tensorflow-and-pytorch#:~:text=Macs%20with%20ARM64%2Dbased%20M1,both%20from%20consumers%20and%20developers.
Thank you #Akella Niranjan for the reference. For the benefit of community providing solution here as written by #Sihyung Park.
Install TensorFlow-macOS for Apple Silicon M1
It is easy to install it with the system python since the installation script is given by Apple. However, my goal was to install it with other python so that I can install additional packages for data science without difficulty.
I mainly followed instructions from here to install tensorflow-macos, and then created ipykernel of it so that I can run this environment any time by switching the kernel inside jupyter notebook.
First install miniforge, which natively supports M1. The installation defaults to directory ~/miniforge3/.
Create virtual environment named tf_macos with conda and install Python 3.8.
conda create -n tf_macos
conda activate tf_macos
conda install -y python=3.8
I specified the version 3.8 so that it matches requirement of tensorflow-macos.
Download and install tensorflow-macos from Apple Github.
git clone https://github.com/apple/tensorflow_macos.git
cd tensorflow_macos/arm64
pip install --force pip==20.2.4 wheel setuptools cached-property six
pip install --upgrade --no-dependencies --force numpy-1.18.5-cp38-cp38-macosx_11_0_arm64.whl grpcio-1.33.2-cp38-cp38-macosx_11_0_arm64.whl h5py-2.10.0-cp38-cp38-macosx_11_0_arm64.whl tensorflow_addons-0.11.2+mlcompute-cp38-cp38-macosx_11_0_arm64.whl
pip install absl-py astunparse flatbuffers gast google_pasta keras_preprocessing opt_einsum protobuf tensorflow_estimator termcolor typing_extensions wrapt wheel tensorboard typeguard
pip install --upgrade --force --no-dependencies tensorflow_macos-0.1a1-cp38-cp38-macosx_11_0_arm64.whl
Add the environment as jupyter kernel.
pip install jupyter
python -m ipykernel install --name=tf_macos
Then merely switching the ipython kernel to tf_macos allows us to use mlcompute-backend TensorFlow without a hassle
Install additional packages (optional)
conda install scipy pandas matplotlib
For more information you can refer here

cannot install pip install torchvision

I am using python 3.8.3 version, I tried to install torchvision and torch module and faced this error, none of them are installed. The error comes as ERROR:could not find a version that satisfies the requirement torch==1.4.0(from versions:0.1.2,0.1.2,post1,0.1.2.post2)
Error:No matching distribution found for torch==1.4.0
According to PyTorch's website, you must specify if you are using cpu or the version of CUDA when installing from pip.
For instance, if I wanted to install on a Linux system without CUDA, version 1.5.1 of PyTorch, I would run:
pip install torch==1.5.1+cpu torchvision==0.6.1+cpu -f https://download.pytorch.org/whl/torch_stable.html
You can use the link I provided above to get the syntax for your specific environment.

How to install older version of Tensorflow?

I follow this tutorial. He uses Tensorflow 1.10.0. I should use that version too. Because tutorial is not compatible with newer versions of Tensorflow.
So,when I open Anaconda Prompt and write
pip3 install --upgrade https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.10.0-py3-none-any.whl
to base and I see this long error message. How can install Tensorflow 1.10.0?
I also tried:
conda create --name="tfold" python=3.7
conda activate tfold
pip install tensorflow==1.10.0
and I see this error message:
ERROR: Could not find a version that satisfies the requirement tensorflow==1.10.0 (from versions: none)
ERROR: No matching distribution found for tensorflow==1.10.0
EDIT: The oldest version compatible with Python 3.7 is 1.13. I installed Python 3.6. Then, I installed it using conda create -n test_env tensorflow=1.10.0
I think the problem is because you are using python3.7
Try using pip and not pip3
Set python=2.7 and use pip install tensorflow==1.10, it worked fine for me.

Issue while installing Tensorflow in Windows 10 (python 3.6.2)

While I am executing the following command it errors out:
<><><><><><><><><><><><><><><><><><><><><>
(tensorflow36) C:\Users\usr1>conda install tensorflow
Fetching package metadata .................
PackageNotFoundError: Packages missing in current channels:
- tensorflow
We have searched for the packages in the following channels:
http://conda.anaconda.org/gurobi/win-32
http://conda.anaconda.org/gurobi/noarch
https://conda.anaconda.org/anaconda-fusion/win-32
https://conda.anaconda.org/anaconda-fusion/noarch
https://repo.continuum.io/pkgs/main/win-32
https://repo.continuum.io/pkgs/main/noarch
https://repo.continuum.io/pkgs/r/noarch
https://repo.continuum.io/pkgs/pro/win-32
What am I missing??
As mentioned in the docs (https://www.tensorflow.org/install/install_windows):
within Anaconda, we recommend installing TensorFlow with the pip
install command, not with the conda install command.
CPU-only version:
pip install --upgrade https://storage.googleapis.com/tensorflow/windows/cpu/tensorflow-0.12.1-cp35-cp35m-win_amd64.whl
GPU version:
pip install --upgrade https://storage.googleapis.com/tensorflow/windows/gpu/tensorflow_gpu-0.12.1-cp35-cp35m-win_amd64.whl
The --upgrade option of pip will make sure the newest available version of tensorflow gets installed. For more info go to Pip installation on Windows in https://www.tensorflow.org/versions/r0.12/get_started/os_setup

Categories