Tensorflow and Cuda for Unity ML-Agents WITHOUT a GPU - python

I am trying to use tensorflow for use with unity ml-agents. I followed the setup instructions which can be found here as far as "creating the conda environment". I managed to run the conda create command succesfully, activate tensorflow, install tensorflow and finally to launch python.
But when I run this command "import tensorflow as tf" I get an error as a result of my machine having no GPU present. I am working on the assumption that using the CUDA_VISIBLE_DEVICES environment variable will solve this problem and force the use of the CPU but I'm not exactly sure how to input the variable.
Can anyone tell me exactly how this should appear in the environment variables interface? Or does anyone have any other idea about how to set this up properly?
Thanks In advance

Uninstall tensorflow
Pip uninstall tensorflow
or
pip uninstall tensorflow-gpu
depends upon what you have installed
then
pip install tensorflow
or if you want to install a specific version
pip install tensoflow==[version]

Related

Having trouble installing Pytorch on Windows

I have tried install pytorch with pip but there is no package fit for my environment. I use Python 3.11.2. Then I downloaded anaconda and installed pytorch successfully. However, when I imported torch in python, it said there is no such module.
I followed many tutorials by restart my laptop, created conda enviroment and install pytorch there. Nothing worked.
Anyone having similar problems?
That's not clear for your problem. I think you may show the process of how you installed pytorch by conda.
You can use conda list pip list to show your package installed.
The problem in anaconda may be you install pytorch in your specific env, but when you open your ide (i.e. vscode, pycharm) you choose the base env. You may try run your code in your terminal by conda activate xxxx then python3 then import torch.

Tensorflow path-performance installation

I've noticed that upon running my tensorflow, I have a spike on first few runs on start-up
upon searching on the internet, I came into this blog
the replies and official documents got me even more confusing on which installation is best for performance.
Is it
Conda
pip
docker
some others that are not listed?
My current setup is windows 10 laptop with GTX965M, tensorflow installation accordingly to this guide
Another weird thing, my conda installation is only able to install tensorflow 1.8 for some reason. Upon running the code conda update tensorflow, it returns latest version has been installed. But I can install tensorflow 2 by stating conda install tensorflow=2. Is this normal? If not what could be the issue? (I have all the packages updated before 'updating/installing' tensorflow. Doesn't help.)
As per my knowledge creating a virtual environment in anaconda and install the Tensorflow in virtual environment has advantages.
Please refer to this SO Answer for the advantages and steps to create virtual environment.
Upon running the code conda update tensorflow, it returns latest
version has been installed. But I can install tensorflow 2 by stating
conda install tensorflow=2. Is this normal?
Yes, this is a normal behavior.
Google Colab is an easy way to learn and use TensorFlow. It's a Jupyter notebook environment that requires no setup to use and runs entirely in the cloud.

Why am I having errors while installing Tensorflow?

I had issues with my Tensorflow and had to re-install it. In order to ensure I do not make mistakes like I have done before, I followed Jeff Heaton tutorials (available here) for installing Tensorflow for CPU. However, on executing the command: conda env create -v -f tensorflow.yml, I get some massive error (please see details here!).
Kindly show me where I am getting it wrong.
I have tried both 2020 and 2019 versions of anaconda. Using Miniconda did not help either.
Thank you very much.
Follow the installation instructions on Anaconda's website for TensorFlow for CPU:
conda create -n tensorflow_env tensorflow
conda activate tensorflow_env
Pls, retry with anaconda
I hope it helps and to you
Download the latest version of anaconda, and start "Anaconda promt(anaconda)", then write this in Anaconda terminal
pip install tensorflow
And for test
python3
import tensorflow
If you haven't got errors, You succefully install library.

ImportError: No module named 'tensorflow' using anaconda + windows

Pip Installed tensor flow (CPU only... https://www.tensorflow.org/install/install_windows) in an anaconda environment, says it successfully installed but when I go to use tensor flow (with environment activated) it displays an error saying "ImportError: No module named 'tensorflow'".
However, After i installed pandas package, and it successfully runs. i ran an update to python=3.5 for the environment (because my anaconda is 2.7 version), and tried using this link https://github.com/tensorflow/tensorflow/issues/6136 for help also. Weird that other packages run but not tensor flow. Using a PC windows 10 with intel CPU and amd graphics. Any suggestions would be helpful.
First check which environment you are using right now.
If it helps open the anaconda navigator and see whether you have TensorFlow installed in the "installed" tab of that particular environment.
Check the following on jupyter noteook and see what python version you're using in that environment because the environment that you are using might have a different python version after all.
from platform import python_version
print(python_version())
If the versions are different, try removing the TensorFlow installation and reinstalling it according to your python version. environment and recreating the same environment pip install --ignore-installed --upgrade tensorflow=='version_for_your_requirement"
If the situation is still there, https://www.youtube.com/watch?v=tPq6NIboLSc see here the steps followed in the video. Though its a slightly different scenario, you will get the gist of it pretty quickly as to how we can make another environment for our work and about installing TensorFlow properly.
Tensorflow supports 64-bit Python version. Make sure you have installed 64-bit Python 3.5/3.6/3.8 version.
Install Tensorflow using following steps
#check current python version
python --version
#Create the virtual environment
conda create -n tf python=PYTHON_VERSION
#Activate the tf environment
conda activate tf
#Install Tensorflow
pip install tensorflow

Installing TensorFlow in python 3.5 Anaconda distro conda env

What I did to try and solve this issue:
Using Mac OS X
Using Anaconda distro currently in my computer as the path /Users/hongshuhong/anaconda/
Used conda instead of virtualenv because of my distribution of python. I referred to the guide here and tried to download the same with conda's package manager: https://www.tensorflow.org/versions/master/get_started/os_setup.html#download-and-setup
Tensorflow worked correctly when I created an anaconda env using the command conda create --name ML python=2.7 anaconda to state I'm using 2.7 python, then used this command conda install -c https://conda.anaconda.org/jjhelmus tensorflow
gathered from the Anaconda Cloud to attempt to download it. It worked when I said
$ python
>>> import tensorflow as tf
...
However, it doesn't really fix the issue:
However, I want to use the 3.5 distribution of python, simply to keep up with the times and not use outdated pythons.
I attempted to download it using the same way in python=3.5, but it raised this error when I tried to run the command conda install -c https://conda.anaconda.org/jjhelmus tensorflow :
Hint: the following packages conflict with each other:
- tensorflow
- python 3.5*
Use 'conda info tensorflow' etc. to see the dependencies for each package.
And I ran the conda info tensorflow to see what was going on and I got:
Fetching package metadata: ....
Error: No packages found in current osx-64 channels matching: tensorflow
This is really frustrating me and I'm not sure what to do. If there's no work around for this, I think I'll have to use Anaconda's python 2.7 distribution for TensorFlow experiments. If anyone has any idea how to solve this compatibility issue(or some other kind of issue), I'd be extremely grateful. Thanks.
EDIT: I'm pretty sure TensorFlow supports 3.5 because in their documentations they say they support 2.7 python and 3.3+. If there were no clues as to whether they support 3.5, I would have already given up and used 2.7 by now.
The version of TensorFlow packaged here is version 0.5.
Python 3.x support was introduced in TensorFlow 0.6, so you need to figure out how to install the newest version into Anaconda.
Usually you can install packages into anaconda using pip, but I haven't succeeded with TensorFlow.
EDIT: I just noticed that the documentation hasn't updated the url to the pip-wheel.
To install tensorflow in python 3.5 via pip, use the following command:
$ sudo easy_install --upgrade six
$ sudo pip install --upgrade https://storage.googleapis.com/tensorflow/mac/tensorflow-0.6.0-py3-none-any.whl
This links to ...tensorflow-0.5.0-py2-none-any.whl, which is an older version of tensorflow for python 2.x.
Tensorflow get started page link.

Categories