which one is better in installing tensorflow - tensorflow

I followed the instructions on the official website to download the TensorFlow. I chose to create a virtual environment as the instruction shown for macOS. My question is that if I need to activate the virtual environment each time before I use TensorFlow?
For example, I want to use tensor flow on Jupiter notebook and that means I need to install Jupiter and other required packages like Seaborn/pandas as well on the virtual environment. However I already downloaded anaconda and basically, it has all the packages I need.
Besides, will it make a difference if I download it with conda?

Well, if you downloaded the packages (like you said TensorFlow and Seaborn) in the base Conda environment which is the default environment that anaconda provides on installation, then to use what it has, you need to run whatever program/IDE like Jupyter lab from it. So you would open Anaconda Prompt and then type in jupyter lab and it would open up a new socket and you can edit with your installed python libraries from Conda.
Otherwise in IDE's VSCode you can simply set the python interpreter to that from Conda.
However, if you install the libraries and packages you need using pip on your actual python installation not Conda, then there is no need for any activation. Everything will run right out of the box. You don't need to select the interpreter in IDE's like VSCode.
Bottom line, if you know what libraries you need and don't mind running pip install package-name every time you need a package, stick with pip.
If you don't like to that sort of 'low level' stuff then use Anaconda or Miniconda.

Related

tensorflow probability installation

I am trying to install "TensorFlow-Probability" for windows offline without going through internet so that I can avoid network firewall issue, but I could not find any instruction about how to. Any suggestion?
TensorFlow-Probability is pure python, there is no need for a windows build of it.
You should be able to download the file from: https://pypi.org/project/tensorflow-probability/#files
and pip install it in a conda or python environment.

anaconda installing numpy/pandas/matplotlib error

first post here, so I'm going to try to be as thorough as possible.
I'm trying to install numpy/matplotlib/pandas for a project. First time trying to use them. I'm following the steps of a tutorial, so I can't vary from that too much (have to use anaconda). I'm using mac OS Sierra 10.12.5
What I've done:
installed python 3, anaconda, and create and initialize a virtual environment using Anaconda. I then type:
conda install numpy pandas matplotlib
The terminal then tells me what new packages will be installed, I proceed. A few are installed successfully, and then I get this error:
CondaError: CondaHTTPError: HTTP None None for url https://repo.continuum.io/pkgs/free/osx-64/mkl-2017.0.3-0.tar.bz2
Elapsed: None
An HTTP error occurred when trying to retrieve this URL.
HTTP errors are often intermittent, and a simple retry will get you on your way.
I thought this might be a connection issue, as I'm in China, but I've tried multiple times both using and not using a VPN. This problem is really stopping me in my tracks, any ideas?
Have you tried using the pip installer, or installing using the Anaconda navigator? To install using pip, after creating the virtual environment, open a terminal console, and type
source activate [name of virtual environment]
pip install numpy
pip install matplotlib
pip install pandas
Pip is included in the base anaconda installation, so this should work. If your Anaconda installation included the Anaconda Navigator, you can also install these modules through the GUI, by opening the Anaconda Navigator, clicking on the environments tab, selecting the virtual environment, searching for module in the search bar (make sure you select All and not Installed in the dropdown menu next to it), and then selecting the desired modules and clicking the apply button (this is an example).

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.

Is there an specific order to install the following packages?

I want to install numpy, scipy, matplotlib, and opencv
I do not want to mess it up. Not sure if there is a specific order I should install them or if I can do any.
I know opencv should be the last because requires numpy.
What about the others?
Thank you
As per OP's interest, I would like to suggest the installation of Anaconda distribution. It includes the packages NumPy, SciPy, Scikit Image, Matplotlib, Jupyter and over 100 libraries as pre-built packages as documented here. (choose specific python version as you like)
Once anaconda installation is finished, you can easily install opencv from the command prompt like:
# install opencv
$ conda install opencv
It's very easy to search for a package and install it using the conda package manager.
First I suggest always to use a virtualenv for all projects (see here: http://docs.python-guide.org/en/latest/dev/virtualenvs/). Think of it as a type of insurance that enables you to roll back or re-do things in case you mess things up.
Second, when you usually install a python package python checks for dependencies and install them (at least with pip install). However, it does not hurt to do things in the right order- you can find those dependencies on the python documentation of these specific packages. For example, opencv requires numpy as a dependency (see https://pypi.python.org/pypi/opencv-python).
Order:
1) numpy
2) scipy
3) matplotlib and opencv

Is it safe to install Tensorflow in an existing Conda environment?

I am looking into using Tensorflow for my research soon, and looked at the online documentation for installing with Conda https://www.tensorflow.org/versions/r0.11/get_started/os_setup.html#anaconda-installation.
It suggested creating a new environment, and installing Tensorflow in it, and the installing other python packages afterwards.
But I already have an existing environment with lots of packages I need, and I'm wondering if its safe to add Tensorflow into that environment?
Also, I have a question about how this installation with conda works. I know that Conda will create a distinct set of folders containing the libraries needed for each environment, but if I install Tensorflow, what happens to all the base low level C++ and CUDA libraries that get compiled? Do they reside in my Conda environment's folder, or are they in some system wide libraries closer to my root?
PS: I'm using Ubuntu 16.04, and have a GPU that I want to run Tensorflow on.
Thank you.
But I already have an existing environment with lots of packages I need, and I'm wondering if its safe to add Tensorflow into that environment?
conda has this awesome feature called "revisions". You can show your current environment with
conda list --revisions
which allows you to revert changes to your conda environment. This allows you to install new packages with confidence that if something breaks you can always revert it later. See this page for more info: https://www.continuum.io/blog/developer/advanced-features-conda-part-2. tl;dr: conda install --revisions <revision_number>
what happens to all the base low level C++ and CUDA libraries that get compiled
Are you talking about the libraries that get compiled when you are trying to run your code? Or the C++/CUDA libraries? If you're talking about the C++/CUDA libs then conda is not compiling them, but merely installing a pre-compiled binary into a specific location that gets picked up. If you're talking about your code, then where exactly those files live would seem to depend on where you put them.