Does it harm if I use TensorFlow without an isolated python environment? - tensorflow

I have installed TensorFlow using Anaconda Installation.
During the installation, after sourcing into the 'tensorflow' environment (create by conda), I used pip in my anaconda(i.e. $HOME/anaconda/bin/pip3) instead of pip or pip3 in the tensorflow environment(i.e. $HOME/anaconda/envs/tensorflow/bin/pip) to install TensorFlow.
When I test my installation, I find that I can still import tensorflow even if I am not in the 'tensorflow' environment(after source deactivate). So I think I am actually using tensorflow without an isolated python environment. Does it harm?

If it works well for you, that's good, but in general this isn't an approach we test extensively or support, so your mileage may vary!

Related

Problem with importing tensorflow and testing NN

I'm currently working on a program to play a game similar to atari-games. I'm using keras (python 3). I finished writing the code and I want to test it, and I have few questions about the process:
first of all, I have trouble importing tesnorflow for some reason. I've installed it using pip. I've made sure to created new env. before the installation (which finished successfully), but when I try to run my program it says:
ModuleNotFoundError: No module named 'tensorflow'
I also, tried to install the package from within pycharm, but then I get this error:
Could not find a version that satisfies the requirement tensorflow (from versions: )
No matching distribution found for tensorflow
I've checked program requirements (such as pip, python, virtualenv and setuptools versions) and everything seems up to date. perhaps someone could point out what else might be the problem?
Is there any other way I can test the performance of my program?
Thank you very much for your time and attention.
Anaconda is a complete time-saver. I suggest create an enviornment using Anaconda and install the tensorflow by conda install tensorflow If you would like to use the gpu version, conda automatically installs the CUDA and cudnn for you too.

Failed to import 'tensorflow.contrib.tensorrt' in tensorflow r1.14

I have installed the Tensorflow r1.14 and want to use TF-TRT. However, the following error occurs:
"ModuleNotFoundError: No module named 'tensorflow.contrib.tensorrt'"
when running the sample code. The same error occurs with Tensorflow r1.13. So my question is do I need to install the tensorflow.contrib.tensorrt library separately? If yes, how?
Additionally, I can run the sample code of the TensorRT, e.g. sampleINT8, successfully. Click here to see my successful sample code run.
This leads me to believe that TensorRT is installed properly. However, the TF-TRT still doesn't work.
Any help would be greatly appreciated!
In TF 1.14, TF-TRT was moved to the core from contrib.
You need to import it like this: from tensorflow.python.compiler.tensorrt import > trt_convert as trt
https://github.com/tensorflow/tensorrt/blob/master/tftrt/examples/image-classification/image_classification.py#L22
This is the correct answer for Linux.
However, if you're using Windows: the TensorRT Python API (and therefore TF-TRT) is not supported for Windows at the moment, so the TensorFlow python packages aren't built with TensorRT.
In TF 1.14, TF-TRT was moved to the core from contrib.
You need to import it like this:
from tensorflow.python.compiler.tensorrt import trt_convert as trt
https://github.com/tensorflow/tensorrt/blob/master/tftrt/examples/image-classification/image_classification.py#L22
In order to be able to import tensorflow.contrib.tensorrt you need to have tensorflow-gpu version >= 1.7 installed on your system. Maybe you could try installing the tensorflow-gpu library with a:
pip install tensorflow-gpu
Check out the Windows section of the GPU documentation as well. Also, I would try updating your tensorflow version with a:
pip install --upgrade tensorflow
to ensure you're up to date there as well. Check out this section of the TensorFlow documentation for additional support.
Hopefully that helps!
2 possibilities
Have you installed tensorflow-gpu instead of tensorflow?
From your screenshot it looks like you're using Windows. I had the same problem. There seems no tensorrt module under contrib in TF windows distribution however linux has it (I tried 1.13.1).

Tensorflow Serving Developer environment

I can't seem to find any documentation that describes what parts of TF and TFS need to be installesd/built to create a servable, can anyone shed light on the subject?
I'm not sure if this documentation exists. The approach I would take is to create a new blank environment, on conda or whatever you prefer. Then install Tensorflow and Tensorflow serving into the environment, which will prompt you to install the dependencies into the environment as well.
Then just to pip list or conda list (or equivalent) and see what all libraries got installed. That should give you a list of the base libraries needed to use TF and TF Serving.

Needed help?? installing Tensorflow-GPU for Win 10 Pro 9-2-18

1.Create a new environment through conda create --name tftest. (You can replace tftest with e.g. the name of your current project.)
2.Activate that new environment through activate tftest.
3.Install TF into this environment through conda install tensorflow.
4.Ensure that you're in the right environment through where python (which should produce a path containing "tftest").
5.Run Python through python.
6.import tensorflow as tf in a shell in that environment.
Thanks to great community as I found this thanks to another post!!!
Starting with version 1.6.0, prebuild binaries need AVX instructions.
There are some bug reports by people who tried to use the precompiled binaries but whose doesn't support AVX instructions and got the same error as you posted here:
https://github.com/tensorflow/tensorflow/issues/17761
https://github.com/tensorflow/tensorflow/issues/17386
Maybe you have this problem? If yes, you may have to build tensorflow from sources or downgrade to tensorflow 1.5.1.

Tensorflow installation

Upon trying to install Tensorflow for conda environment, I encountered with the following error message, without any progress:
tensorflow-1.1.0-cp35-cp35mwin_amd64.whl is not a supported wheel on this platform
Have you tried uninstalling and re-installing TensorFlow using pip within your Conda environment? I.e.:
pip uninstall tensorflow
Followed by:
pip install tensorflow
If it doesn't work, the issue may be with your Python installation. TensorFlow only supports 64-bit Python 3.5+ on Windows (see more info here).
Perhaps you have Python's default installation, which comes in a 32-bit version. If that's the case, you can download the 64-bit Python 3.5 or later from here to run in your Conda environment and then you should be able to install/run TensorFlow without any issues.
Make sure that the Python version installed in the Environment is 3.5 not 3.6. Since 3.6 was released Conda automatically sets that version as default for python 3. However, it is still not supported by Tensorflow.
You can work using tensorflow library along with other essential libraries using the Dockerfile. Using Docker for environment are a good way to run experiments in reproducible manner as in this blog
You can also try using datmo in order setup environment and track machine learning projects for making it reproducible using datmo CLI tool.