installing tensorflow without internet connection - python

I have to install TensorFlow + Keras on my computer, but I have not internet connection on it, so I have to download this package on another computer and then pass it on mine.
My question is: where can I saefty downolad TensorFlow + Keras and then, how can I install it using Anaconda?
Thanks a lot for helping!

I will just assume you are using a Linux machine
For tensorflow, you can follow the guide provided by florian.
Step 1
For Keras you just need to git clone or download the repository in https://github.com/keras-team/keras
Once you cloned or downloaded the repository on your machine connected to the internet, pass it to the one you want to use it one.
Step 2
Open a terminal and navigate to the passed keras folder with cd. run the setup.py by tipping ./setup.py into the console and you are done.
Step 3
To verify the installation you can run one of the examples. Navigate to the examples folder inside the keras folder and type ./mnist_cnn.pyinto the console. If everything was installed right you should see the network training and output. Otherwise, an error message will be displayed in the console.
Here is the windows version for keras and anaconda
Step 1
Copy the downloaded folder of keras to %USERPROFILE%\Anaconda3\Lib\site-packages. Then use cd %USERPROFILE%\Anaconda3\Lib\site-packages\keras to get to the keras folder.
Step 2
in the same terminal type python setup.py develop to install keras on windows.
Step 3
To check keras navigate into the examples folder and run the same example is in the Linux step 3.
My windows skills are very rusty, so I won't be able to help you troubleshoot problems here. I recommend you to install Linux on a second partition if you want to dive into deep learning since it is a lot easier to set up a system for DL on Linux than on Windows, also if you want to use AWS later it is chaper on Linux than windows.

Related

Create virtual environment identical to main Python installation (incl. CUDA dependencies)

I currently work on a server of my university, where I am using Python with Tensorflow and Cuda. I built some machine learning models on my local machine and copied them onto the server, where they run fine with the basic Python installation.
However, I want to install a few additional packages and I also want to make sure that I do not have to be worried about updates of the software installed on the server that could cause problems with my code.
I do not have and cannot get admin permissions to install any programs or modules outside my personal directory, since I am only a regular user and a student above that.
Now I wondered if there is an easy way to just clone the main Python installation to a virtual environment in my home folder. I could basically create a new virtual environment and install Tensorflow etc, but I found it very frustrating when I tried to set it up with Cuda on my private computer. Moreover, I find it rather complicated to access the server (log-in credentials, vpn, 2-factor-authorisation), so I want to minimize the trial-and-error time that I often need when I try custom installation of modules.
Approach 1:
use "pip freeze > requirement.txt" to generate the requirements file and install all requirements using requirements file using "pip install -r requirement.txt" command.
Approach 2:
use a virtualenv-clone package to make clone of the existing environment.
https://pypi.org/project/virtualenv-clone/

Tensorflow installation issues

System information
OS Platform and Distribution - Windows 10
TensorFlow version: latest
Python version: 3.6.4
Installed using virtualenv? pip? conda?: - virtualenv
Greetings,
I hope this is the correct place to submit an inquiry of this nature, if it is not, please forgive my confusion & please point me in the right direction. I greatly appreciate your time & consideration.
I am new to Python & Tensorflow. I've done some coding with C in the past, mostly when I was in college. I am determined to learn Python & to utilize both Python & Tensorflow for AI & Machine Learning purposes.
I've had difficulties in getting Tensorflow to install properly. I started by installing the latest version of Python which didn't seem to like my attempts at installing Tensorflow, I then went with Python 3.6.4-amd64. I installed that, created a fresh directory for my environments, then installed pip & virtual env, then created a virtual environment to setup with Tensorflow.
One of the confusing issues I keep encountering is that when I install pip & virtualenv, and eventually Tensorflow, it keeps sending it by default to C:\user\username\appdata\roaming\python etc, my question is, how do I prevent it from doing that? I am trying to install in the direct being utilized in the command prop, I call up the fresh directory I created for my virtual environment, then activate the virtual environment, and no matter what I do it keeps sending all new install files into the appdata/roaming user directory sub folders.
This is causing the incredibly annoying issue of making it impossible for me to proceed with utilizing Tensorflow because I get nothing but errors on missing files, path directory etc etc. I even tried manually moving some of the files over to the virtual environment directory and that worked in some cases, but did not solve the overall problem.
Okay, now that I've made it painfully apparent how much of an uneducated newbie I am with all of this, may someone please give me some advice. The first step is admitting you need help, and I clearly do as I've spent several hours with my eyes glued to various articles and tutorials that have left me with more questions than answers. I truly appreciate any help you're willing to provide. Just a loner trying to figure this all out & increase my knowledge along the way. Thanks for your time,
Just moving the folder is not enough.
Once you have moved it, you must replace the original with a symbolic link to the new location. This will make windows think the data is still located on your C drive, while it actually is on your D drive.
Do note, this does work with AppData, but not with Program Files nor with the Windows folder, as it will break things like Windows Update.
To create the Directory Junction (Symbolic Link) do the following:
Open a cmd window with administrative privileges.
Navigate to c:\Users\username\appdata
execute the following command: mklink /d local d:\appdata\local
replace d:\appdata\local with the actual path of where you moved the appdata to.
If you cannot move/delete the original copy, create a 2nd user, make it administrator, login with it, and retry the option. This should ensure that no files are in use.
With the above issue fixed, follow the tensorflow installation steps in Anaconda provided here.
Hope this answers your question. Happy Learning.

Tensorflow Object Detection API on Windows

Tensorflow recently released their new object detection api Is there any way to run this on windows? The directions apear to be for linux.
Yes, you can run the Tensorflow Object Detection API on Windows. Unfortunately it is a bit tricky and the official documentation does not reflect that appropriately. I used the following procedure:
Install Tensorflow natively on Windows with Anaconda + CUDA + cuDNN. Note that TF 1.5 is now built against CUDA 9.0, so make sure you download the appropriate versions.
Then you clone the repository and build the Protobuf files as described in the tutorial, but beware, there is a bug in Windows Protobuf 3.5, so make sure you use version 3.4.
cd [TF-models]\research
protoc.exe object_detection/protos/*.proto --python_out=.
Finally, you need to build and install the packages with
cd [TF-models]\research\slim
python setup.py install
cd [TF-models]\research
python setup.py install
If you get the exception error: could not create 'BUILD': Cannot create a file when that file already exists here, delete the BUILD file inside first, it will be re-created automatically
And make the built binaries available to your path python path, or simply copy the directories slim and object_detection to your [Anaconda3]/Lib/site-packages directory
To see everything put together, check out our Music Object Detector, which was trained on Windows and Linux.
We don't officially support the Tensorflow Object Detection API, but some external users have gotten it to work.
Our dependencies are pillow, lxml, jupyter, matplotlib and protobuf compiler. You can download a version of the protobuf compiler here. The remaining dependencies can be installed with pip.
As I said on the other post, you can use your local GPU in windows, as Tensorflow supports GPU on python.
And here is an example.
Unfortunately, Tensoflow does not support tensorflow-serving on windows. Also as you said Nvidia-Docker is not supported on windows. Bash on windows has no support for GPU either. So I think this is the only easy way to go for now.
The below tutorial was build specifically for using the Tensorflow Object Detection API on Windows. I've successfully used the below tutorial many times:
https://github.com/EdjeElectronics/TensorFlow-Object-Detection-API-Tutorial-Train-Multiple-Objects-Windows-10

Install and run tensorflow

I have never used tensorflow (or python). I installed Python 3.5.2 from https://www.python.org/downloads/. Then I followed instructions to install tensorflow according to this page, for a Windows 64-bit installation:
https://www.tensorflow.org/versions/r0.12/get_started/os_setup.html#download-and-setup
I followed the steps for Pip installation on windows as a CPU-only install. Then I followed Test the TensorFlow installation/ Run TensorFlow from command line which also seemed mostly fine.
But I hit a brick wall when I try the section Run a TensorFlow demo model. Specifically, the command python -m tensorflow.models.image.mnist.convolutional returns a Error while finding spec for 'tensorflow.models.image.mnist.convolutional' (ImportError: No module named 'tensorflow.models').
I don't really understand the installation nor what I'm missing. Can you tell me what I've screwed up?
Tensorflow models have been moved to a different github repository.
Therefore, they wont be available out of the box anymore when TF is installed.
You can find the file right here:
https://github.com/tensorflow/models/blob/master/tutorials/image/mnist/convolutional.py
You can download this file and execute it manually.
Sorry for out of date documentation.
To run the example the way you've described I think you'd have to add the tensorflow directory (or directory containing all 3rd party packages) to the PYTHONPATH environment variable as in the answer to this question or be in a directory where python can find the tensorflow module. Alternatively, you can run the example using:
python path/to/convolutional.py
from the command line which passes the script to python.exe and executes it. Make sure to either put in the full path or cd to the directory containing the script.
Using Anaconda as mentioned in your second link might be the best bet as setting PYTHONPATH will be taken care of for you for 3rd party packages installed either using conda or pip.

In caffe installation, where to set python path in vs studio

Hi Im trying to install caffe deep learning tool box in windows.
I have to use it in python. I have so far completed first 2 steps mentioned in https://github.com/happynear/caffe-windows
For python wrapper, it says
replace the python include and library path and compile. .
I dont know where to set python include and library path in vs studio 2015.
I have also run MainBuilder.sln in build_cpu_only folder. It gives the error cannot find config.lib. I'm trying to install caffe for python in windows for several hours. Please help. A step by step simple procedure to install caffe on windows and use it in python will be highly appreciated.

Categories