Tensorflow install failed inside Anaconda in Windows Machine - python

Well, I am so tired of trying to install Tensorflow in Anaconda, I have installed anaconda successfully, but when I am going to install form this link, Anaconda installation on Step 4, I am seeing some exception.
I have executed this line of command
pip install --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/windows/cpu/tensorflow-1.0.0-cp35-cp35m-win_x86_64.whl
However it's terminating showing a red single line exception.
Later I have searched for some solution on here and there. I have found some solution too. In this solution is done for only MAC OX and Linux only, not for Windows. Later I found somewhere to use the python version 2.7 so I have downgraded the Python in lower version, however it was same. But this time I can able to to execute the MAC OX command successfully and in my prompt it shows that install successful. But when I had gone to import Tensorflow then again an error is threading, like this
I have also found the some other solutions link1 link2, however none of them are done in which process I'm approaching. I am in a quiet confusion what kind of error or exception it is? And how do I overcome it?
Update:
Tensorflow has been installed successfully from this link, Now a different problem is being facing. When I am going to import tensorflow in my workspace it providing this error.

It looks like it cannot find the required CUDA libraries. Did you install the CUDA Toolkit 8.0 and cuDNN 5.1?
You will have to install the CUDA Toolkit 8.0 e.g. from here and the cuDNN package from e.g. here and then put the cuDNN-installation-path/win10/bin on your path (depending on your windows version of course)
Also the following two posts might help you out:
On Windows, running "import tensorflow" generates No module named "_pywrap_tensorflow" error
TensorFlow on Windows: "Couldn't open CUDA library cudnn64_5.dll"

Related

Error occurred when installing package ‘Cartopy’

I have installed all libraries we need on this project except ‘’ Cartopy library ‘’ in Pycharm. After some research I thought it might be due to the python version so I tried dowloading the Cartopy Library in about 5 different Python versions and again the Cartopy Library is not installed.
After some more research, I thought of changing the version of Pycharm. I dowload version of 2020 and 2021 of Pycharm. Unfortunately i still got the same error :
“Error occurred when installing package ‘Cartopy”.
enter image description here
I have encountered a similar issue with another package and the problem wasn't in the IDE but the OS which in my case was mac. I had to install an ubuntu in parallel and migrate the whole project there and it ran perfectly.
I suggest you use conda instead of pip and if the issue didn't go away check the compatibility with your OS and if this is the issue you can simply install a virtual machine.

After install and uninstall a package, python3 crashes with error "Segmentation fault (core dumped)"

The steps leading to the problem is as follows:
I installed a package using pip. The package is here and its install doc is here. The command I used is
pip install --upgrade tensorflow-graphics-gpu
Because I don't have super user privilege, the package was installed in my user space. pip prompted me for that.
I uninstalled the package using
pip uninstall tensorflow-graphics-gpu
I started python3 and type
import tensorflow as tf
This statement worked fine before. But this time, python quits with an error:
Segmentation fault (core dumped)
This is a screenshot: enter image description here.
The environment is as follows:
A remote Linux. Core version 5.8.0. I am not not a super user.
Python 3.8.6
CUDA 11.1
CPU: Core i9-10900K
nVidia RTX GPU
The same error crashes python if I tried to import PyTorch. The sys admin is very disagreeable so I can get no help from him, not to mention upgrading drivers or reinstalling python. I tried to clear cashes in my user space that I know of, but I didn't have luck. I searched internet for a solution but of no avail.
Can someone please tell me how to fix this issue? Thanks a lot.
I tried to clear cashes in my user space that I know of, but I didn't have luck.
It seems pretty clear that something in your $HOME directory is still being used, and is causing the system python to crash.
To discover what that something is, you can look at which files are being opened using this command:
strace -e file python -c 'import tensorflow'
Once you know which files are being opened, remove/reinstall corresponding packages, and you should be back in business.

Tensorflow GPU / CUDA installation on Ubuntu

I have set up a Ubuntu 18.04 and tried to make Tensorflow 2.2 GPU work (I have an Nvidia/CUDA graphic card) with Python.
Even after reading the documentation https://www.tensorflow.org/install/gpu#linux_setup, it failed (see below for details about how it failed).
Question: would you have a canonical "todo" list (starting point: freshly installed Ubuntu server) on how to install tensorflow-gpu and make it work, with a few steps?
Notes:
I have read many similar forum posts, and I think that having a canonical "todo" (from a fresh Ubuntu install to having tensorflow-gpu working) would be interesting, with a few steps/bash commands
the documentation I used involved
export LD_LIBRARY_PATH...
# Add NVIDIA package repository
sudo apt-key adv --fetch-keys http://developer.download...
...
# Install CUDA and tools. Include optional NCCL 2.x
sudo apt install cuda9.0 cuda...
Even after a lot of trial and errors (I don't copy/paste all the different errors here, would be too long), then at the end:
import tensorflow
always failed. Some reasons included `ImportError: libcublas.so.9.0: cannot open shared object file: No such file or directory. I have already read the relevant question here, or this very long (!) Github issue.
After some trial and error, import tensorflow works, but it doesn't use the GPU (see also Tensorflow not running on GPU).
Well, I was facing the same problem. The first thing to do is to look up, which Tensorflow version is required. In your case Tensorflow 2.2. requires CUDA 10.1. The correct cuDNN version is also important. In your case it would be cuDNN 7.4. An additional point is the installed python version. I would recommend Python 3.5-3.8. If one those mismatch, a fully compatibility is almost impossible.
So if you want a check list, here you go:
Install CUDA 10.1 by installing nvidia-cuda-toolkit.
Install the cuDNN version compatible with CUDA 10.1.
Export CUDA environment variables.
If Bazel is not installed, you will be asked on that.
Install TensorFlow 2.2 using pip. I would highly recommend the usage of a virtual environment.
You can find the compatibility check list of Tensorflow and CUDA here
You can find the CUDA Toolkit here
Finally get cuDNN in the correct version here
That's all.
I faced the problem as well when using the Google Cloud Platform for two projects involving deep learning. They provide servers with nothing but a freshly installed Ubuntu OS. Regarding my experience, I recommend doing the following steps:
Look up the cuda and cuDNN version supported by the current Tensorflow release on the Tensorflow page.
Install the targeted cuda version from the deb package retrieved from Nvidias cuda page and be careful that more recent cuda versions might not work! This will automatically install the corresponding Nvidia drivers.
Install the targeted cuDNN version from this page and again be careful that a more recent cuDNN version might not work.
Install tensorflow-gpu using pip.
This should work. Your problem is probably that you are using a more recent cuda version than targeted by the current Tensorflow release.
To install tensorflow-gpu, the guidelines which are provided on official website are very tedious for beginers, instead we can do these simple steps:
Note : NVIDIA driver must be installed before this(you can verify this using command nvidia-smi).
Install Anaconda https://www.anaconda.com/distribution/?
Create an virtual environment using command "conda create -n envname"
Then activate env using command "conda activate envname"
Finally install tensorflow using command "conda install tensorflow-gpu"
With the given code
import tensorflow as tf
if tf.test.gpu_device_name():
print('Default GPU Device{}'.format(tf.test.gpu_device_name()))
else:
print("not using gpu")
You can find the tutorial on link given below
https://www.pugetsystems.com/labs/hpc/Install-TensorFlow-with-GPU-Support-the-Easy-Way-on-Ubuntu-18-04-without-installing-CUDA-1170/?
I would suggest to first check the availability of GPU using nvidia-smi command.
I had faced the same issue, i was able to resolve it by using docker container, you can install docker using Install Docker Engine on Ubuntu or use the Digital Ocean guide (i used this one) How To Install and Use Docker on Ubuntu 18.04
After that it is simple just run the following command based on the requirements
NV_GPU='0' nvidia-docker run --runtime=nvidia -it -v /path/to/folder:/path/to/folder/for/docker/container nvcr.io/nvidia/tensorflow:17.11
NV_GPU='0' nvidia-docker run --runtime=nvidia -it -v /storage/research/:/storage/research/ nvcr.io/nvidia/tensorflow:20.12-tf2-py3
Here '0' represents the GPU number, if you want to use more than one GPU just use '0,1,2' and so on ....
Hope this solves the issue.

Tensorflow installation with anaconda installation and run issue

I have been trying to install Tensorflow for a really long time now, but I never seem to make it work. I have tried to install Tensorflow via pip, virtual environment and anaconda so far. The installation process seem to run smoothly with all three methods. But as soon as I try to validate the installation by running "import tensorflow" I get the following error. I know it looks kind of chaotic, I wasn't sure how to pose the question.
By now, all help is appreciated
Thanks
As mentioned, you have to install python 3.5.X first
Secondly, I strongly recommend you to use anaconda. You should install anaconda 4.4.0 for python 3.6 version and 64-bit installer.
Then, you should run the following command
conda create -n tensorflow python=3.5
By the way, would you watch the tensorflow installation tutorial ?
TensorFlow versions 1.2 and later are compatible with Python 3.6. The error message points to the actual problem:
ImportError: libcudnn.so.5: cannot open shared object file: No such file or directory
This implies two things:
You have installed the tensorflow-gpu package, which requires a CUDA-capable GPU and a working installation of CUDA and cuDNN.
TensorFlow cannot find cuDNN.
This answer explains how to fix your cuDNN installation.
Update:
I get a similar error but the message in the bottom is now:
"ImportError libnvidia-fatbinaryloader.so.384.47: cannot open shared object file: No such file or directory"
Also when I enter "which nvcc" it returns /usr/bin/nvcc

unable to find vcvarsall,bat error while installing simplecv on windows 10?

During the installation phase, I get this, "Unable to find vcvarsall.bat" error. The installation process did complete, though. However, I was unable to see the shell on my desktop (I am using windows) and neither was I able to open it manually. I scoured the internet for the error but was unable to find any solution for this case.
The installation process is through a superpack that downloads Python 2.7
SimpleCV is not receiving much love in the past few years, and most of it's code don't got upgrade like the libraries it depends on.
The problem you got is the Superpack trying to compile an older version of OpenCV.
When running the Superpack, you should have seen and redtext error, and if you try to run a code it should show you something like this:
File "C:\Python27\lib\site-packages\SimpleCV\base.py", line 59, in <module>
raise ImportError("Cannot load OpenCV library which is required by SimpleCV")
ImportError: Cannot load OpenCV library which is required by SimpleCV
There are a few paths you can try from there:
1. You can try to install Microsoft Visual C++ Compiler for Python 2.7
Uninstall everything SuperPack installed in your PC or it may not work
It may fixes some other uses when using pip.
Now you have to install SimpleCV again.
2. Try to install OpenCV(2.3) on your own:
You can use pip for it, just remember to chose 32bits to keep compatibility with (Super Pack)
Just run on CMD
pip install OpenCV or python -m pip install OpenCV
3. Give up on SuperPack and install everything on your own.
You can try this guide
https://github.com/sightmachine/SimpleCV#windows-7vista
Or use pip for all dependencies
numpy (Numpy+MKL make sure to install this one first)
scipy
PIL
ipython
svgwrite
pygame==1.9.1release
OpenCV
You can find a useful list of wheels here
http://www.lfd.uci.edu/~gohlke/pythonlibs/#opencv
Sources:
https://blogs.msdn.microsoft.com/pythonengineering/2016/04/11/unable-to-find-vcvarsall-bat/
http://www.lfd.uci.edu/~gohlke/pythonlibs/#opencv
https://github.com/sightmachine/SimpleCV#windows-7vista

Categories