Got CondaVerificationError when installing Tensorflow - python

I got a CondaVerificationError when installing Tensorflow on my 64-bit Win10.
CondaVerificationError: The package for tensorflow-estimator located at C:\Users\viviennejia.zhong\AppData\Local\Continuum\anaconda3\pkgs\tensorflow-estimator-1.13.0-py37h39e3cac_0
appears to be corrupted. The path 'Lib/site-packages/tensorflow_estimator/python/estimator/canned/linear_optimizer/python/utils/__pycache__/sharded_mutable_dense_hashtable.cpython-37.pyc'
specified in the package manifest cannot be found.
ClobberError: This transaction has incompatible packages due to a shared path.
packages: conda-forge::tensorboard-1.13.1-py37_0, conda-forge::tensorflow-base-1.13.1-py37_7
path: 'scripts/tensorboard-script.py'
ClobberError: This transaction has incompatible packages due to a shared path.
packages: conda-forge::tensorboard-1.13.1-py37_0, conda-forge::tensorflow-base-1.13.1-py37_7
path: 'scripts/tensorboard.exe'
In some posts I saw conda clean --all could help. Runing this, I got
FileNotFoundError: [WinError 3] 'C:\\Users\\xxxx\\AppData\\Local\\Continuum\\anaconda3\\pkgs\\tensorflow-base-2.0.0-mkl_py37hd1d5974_0\\Lib\\site-packages\\tensorflow-2.0.0.data\\purelib\\tensorflow_core\\include\\tensorflow_core\\core\\common_runtime\\isolate_placer_inspection_required_ops_pass.h'
I am new to conda and appreciate very much your help to solve this issue.

You may be running into the path length limitation in Windows.
Setting LongPathsEnabled fixed it for me.
See
https://learn.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation?tabs=cmd#enable-long-paths-in-windows-10-version-1607-and-later

Providing the solution here (Answer Section), even though it is present in the Comment Section, for the benefit of the community.
Installation of Tensorflow through pip has resolved issue
pip install tensorflow (install latest version)
or
pip install tensorflow==2.0 (for older version)
In addition to above method, there is a recommended way is to create a Virtual Environment in Anaconda and install the Tensorflow in that Virtual Environment, which works in most of the cases.
Using Virtual Environments has advantages like
We can maintain multiple versions of Tensorflow in multiple Virtual Environments with each Virtual Environment comprising each version like 1.14, 1.15, 2.0, 2.1, 2.2,etc..
We can use different Python Versions (2.x, 3.6, 3.7) in each Virtual Environment
If we want to modify the source code of any of the Tensorflow API, we can do it within our Virtual Environment, without impacting its functionality in other Virtual Environments.
Steps for Creating a New Virtual Environment and installing Tensorflow in Anaconda, for different Operating Systems, is shown below:
# Create a New Virtual Environment
conda create --name TF_2_VE
# When conda asks you to proceed, type y:
proceed ([y]/n)?
# Activate the Virtual Environment. Conda Version > 4.6
conda activate TF_2_VE
# Activating Virtual Environment, Conda Version < 4.6 and Windows OS
activate TF_2_VE
# Activating Virtual Environment, Conda Version < 4.6 and Linux and Mac OS
source activate TF_2_VE
# Install the TF Version you need
conda install tensorflow
The above command will install the Latest Version of Tensorflow (2.2 as of now). If you want an older version like 2.0, you can replace the last step of the above set of commands with
conda install tensorflow==2.0.

Related

Why does Anaconda Navigator (Windows) show a different version of Tensorflow than the command line?

I recently created a new Anaconda (Windows) environment in order to move from tensorflow 1.2 to tensorflow 2.0. My base environment is 1.2, and I created tensorflow-20 in order to install the new version. I did the install from the anaconda command line within the (tensorflow-20) environment. But now everything is messed up.
Now, in Anaconda Navigator, it still shows Tensorflow 1.2.1 as the installed version for base. But in the (base) environment from the Anaconda command line, it shows the version as 2.0.0. Furthermore, in Anaconda Navigator, tensorflow-20 shows no installed packages, including python even.
I feel like I'm fundamentally misunderstanding something here. Can anyone provide some guidance?
How did you install tensorflow 2.0 in the new conda env?
IF with pip, run 'where pip' see if you are using the pip installed
in the base env. You can run 'conda create -n tensorflow-20 pip' to get a pip installed in the new env. Then activate tensorflow-20 and install tensorflow 2.0 with pip.
IF with conda, run 'where conda' to check the same thing.
Preface:
If you install Anaconda on your local machine, it makes sense to install it as Admin. However, if this is not possible, e.g. on an enterprise-managed computer, you must carefully check to use only folders where your user has write permission.
Contribution:
After having experienced a cracked-up package management, I read deeper into that topic. Best Practise: Always try to install everything via conda / Anaconda and best possibly from their central repositories.
If you have a special package, which is e.g. built by local software developers and not published, you can install it from the .tar archive. At that point, I am referring to following documentation: https://docs.anaconda.com/anaconda/user-guide/tasks/install-packages/

Conda does not use package installed but using package from outside

I got a problem when I using conda environment.
I create a environment simply by:
conda create -n NAME python==3.5
So there is a python 3.5 virtual environment.
Then I enter into the virtual environment and install tensorflow-gpu with:
conda install tensorflow-gpu
Now I can see the tensorflow-gpu package along with the cudatoolkit and cudnn.
But when I run a simple program it just failed to use gpu.I don't think it is a nvidia driver problem or package from different resources because it work in the old conda environment but when I create a new it failed.
More interesting is it will using the package(tensorrt and uff) from outside of the enviroment.
When I create a new environment with python 3.6.It works as expected using tensorflow-gpu and cannot import package which isnt installed in the environment.
Does some one know how to fix the problem?
Ubuntu 16.04
Tensorflow 1.8.0
Python 3.5 and 3.6
TensorRT 5.0.0.10
Well I had fixed it.
This problem turn out to be the conda environment added a path from local and imported package from the local path instead of the environment.
If you run into the same problem.Try open python in your conda environment by:
python
and check the system path:
import sys
print(sys.path)
if there is a lib from outside just remove it using:
rm -r ~/PATH
This problem might origin from adding path unintentionally in some program.
Hope that helps.
This also happens if you use jupyter notebook. For example,
if you have jupyter notebook installed and THEN create your environment, the jupyter notebook is OUTSIDE the environment and IGNORES all the packages you installed in your environment. I needed to install jupyter notebook into every environment I created to keep these errors from happening.

Anaconda offline - can't import installed package

I am working with an install of Anaconda on an offline server and want to install some third party packages.
1) Download the conda PACKAGE.tar.bz2 file to local desktop machine
2) SCP it into my home directory on the server
3) On the server, activate a Conda environment, using my Anaconda binary
4) On the server, run conda install PACKAGE.tar.bz2
Even though this runs without error, Anaconda cannot find PACKAGE when I try to import it. I think the problem is due to the channel being "unknown".
For example, I tried to install Pyproj in my local environment.
(testenv) [user#server ~]$ conda list
# packages in environment at /home/user/anaconda2/envs/testenv:
#
# Name Version Build Channel
anaconda 5.2.0 py27_3
pyproj 1.9.5.1 py27_0 <unknown>
Anaconda sees that it has been installed in testenv but cannot import it.
Is there some flags I need to use when installing the package? Is there a way to define the channel for Pyproj? Other solutions?
Thanks.
UPDATE: Install works if I am in the base environment. But it does not work if I try to install a package directly into one my user-defined environments.

Installing Tensorflow - not supported wheel

I have installed Python version 3.5 and 3.6 and anaconda.
The following error occures when trying to install tensorflow following the steps here
https://www.tensorflow.org/install/install_windows
unsing anaconda
(tensorflow) C:> pip install --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/windows/cpu/tensorflow-1.0.1-cp35-cp35m-win_amd64.whl
tensorflow-1.0.1-cp35-cp35m-win_amd64.whl is not a supported wheel on this platform.
As I am new to Python, I do not know how to circumvent this probelm.
I am using Win10 with 64bit.
Thanks a lot and best,
Martin
I ran into the same difficulties with the same error. It seems to be that Python 3.6 isn't immediately supported and found a sort of workaround here (note that this involves installing Python 3.5 which I did not already have installed, I don't know if this should be done a different way if its already installed):
If you are using anaconda distribution, you can do the following to use python 3.5 on the new environment "tensorflow":
conda create --name tensorflow python=3.5
activate tensorflow
conda install jupyter
conda install scipy
pip install tensorflow
\# or
\# pip install tensorflow-gpu
It is important to add python=3.5 at the end of the first line, because it will install Python 3.5.
If you've already created the tensorflow environment (the conda create step), you'll have to delete it and start over. Otherwise, you'll run into an error "CondaValueError: Value error: prefix already exists: C:\[your environment location]" (If you run into the unsupported wheel error, then you probably created the environment already.)
To delete your previous environment, according to the Conda Cheat Sheet, you first deactivate from (tensor flow) if needed by calling deactivate, then call conda remove --prefix ~/bioenvcopy --all. For ~/bioenvcopy I believe you use the tensorflow environment path. The location can be found by calling conda info --envs (citing the cheat sheet once again). Mine, for example, was conda remove --prefix ~/Anaconda3/envs/tensorflow
I successfully used this work around on Windows 10.
This solution probably be obsolete when 3.6 is supported.
Creating the tensorflow env without the correct python version did not work for me. So I had to do the following, which worked...
>deactivate tensorflow # start by deactivating the existing tensorflow env
>conda env remove -n tensorflow # remove the env
>conda create -n tensorflow python=3.5
>activate tensorflow
i had the same problem in windows 10 and python 3.6
so i navigated to anaconda navigator ( just search anaconda navigator in start search).
in the Environment tab you can create/delete your environments.
just create an environment, name it tensorflow and choose python 3.5 as python version.
then you can activate tensorflow in your command line:
activate tensorflow
and install tensorflow with :
pip install tensorflow #or tensowrlow-gpu
I had the same problem after hours of searching, I found that to save yourself from installing error problem in tensorflow. The convenient way for installing tensorflow is by creating a virtual environment in Conda with python 3.5.2 and using Conda-forge. This is done by running this commands:
conda create -n tensorflow python=3.5.2
activate tensorflow
conda config --add channels conda-forge
conda install tensorflow
Try installing the 64-bit version of Python 3.6.8:
https://www.python.org/ftp/python/3.6.8/python-3.6.8-amd64.exe
I was getting the same error with the same OS and that's what fixed it. Apparently Tensorflow doesn't work on 32-bit Python even if your OS is 64-bit.
Try uninstalling everything (python, etc.) and try again using the cmd only, not git bash or PowerShell.
https://github.com/tensorflow/tensorflow/issues/9264
In Anaconda prompt, follow the instruction on Installing with Anaconda,
conda create -n tensorflow
activate tensorflow
Then the third step is a little different, try:
pip install tensorflow
This should work, good luck! If anything wrong happens, please let me know.

Tensorflow and Anaconda on Ubuntu?

On my Ubuntu 14.04, I have installed tensorflow, using "pip", as specified in the Tensorflow Installation instructions and I made sure it was working by importing it in python and it did work.
Then, I installed Anaconda and it changed my .bashrc file by adding the following line to it:
export PATH="/home/sonny/anaconda2/bin:$PATH"
But because of this change, now it looks into the PATH above, which doesn't contain tensorflow. now I can't import tensorflow in my python code.
What is the proper way to extend the $PATH environment variable so that it stays using everything from anaconda2 but it becomes able to import "tensorflow"?
I solved the problem but in a different way!
I found a link where the tensorflow.whl files were converted to conda packages, so I went ahead and installed it using the command:
conda install -c https://conda.anaconda.org/jjhelmus tensorflow
and it worked, since the $PATH points to anaconda packages, I can import it now!
Source is here
Since v0.10.0, tensorflow is a community maintained conda package in the conda-forge channel. Hence, it can be installed directly with the following command:
conda install -c conda-forge tensorflow
The instructions on the TensorFlow documentation has also been updated.
To facilitate future updates, it is probably a good idea to add conda-forge channel into your conda config:
conda config --add channels conda-forge
In fact, tensorflow=0.10.0rc0 was recently added onto the Anaconda default channel and will be installed instead if the conda-forge channel is not specified:
conda install tensorflow
I had the same problem and decided it was easiest to start over, install Anaconda first and then TensorFlow after that.
I suspect that pip is giving you a TensorFlow installation in cpython, not anaconda.
How about a virtualenv?
# Create env
$ virtualenv --python=/path/to/anaconda /path/to/your/env
# Activate env
$ source /path/to/your/env/bin/activate
# Install Tensorflow
$ pip install https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.5.0-cp27-none-linux_x86_64.whl
Install tensorflow from the following command. Conda will take care of the installation process.
conda install -c conda-forge tensorflow
I solved the problem using this:
conda create --name=tensorenv python=3.4
source activate tensorenv
Actually, the TensorFlow Official website made every detail of installing.
The Operation System Windows, Mac OS, Ubuntu; the environment with GPU or just CPU, every single detail of problems you may come up with.
Check this out
Installing TensorFlow on Ubuntu with Anaconda
you will not regret.
Once you visit that you may also find like
Installing TensorFlow on Windows with Anaconda

Categories

Resources