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
Related
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.
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.
How come we need to install tensorflow as a separate environment?
If we do it this way, many common libraries are not available when tensorflow is activated.
Most of the common libraries such as matplotlib, panda, etc. are not within tensorflow environment. So we have to install again to use them.
So why not just install under root so we don't have to re-install all those libraries under the new environment?
Thanks.
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.
My department has version < 1.4 version numpy isntalled in /usr/lib/somewhere/numpy. Since I don't have the permission to replace it with a new version. I installed numpy 1.5 in my home directory. However, later when I install scipy, it complained that the version in /usr/lib/somewhere/numpy has version < 1.4. How can I solve this problem?
Change sys.path so that your numpy directory comes in front of the global numpy directory.
That way your version should be imported instead of the other version. If you really want to make sure that the other version isn't used than you can use virtualenv to get your own private environment with all of your own libraries.
You should use virtualenv to create an environment isolated from system packages with the --no-site-packages option to avoid any conflicts with your system packages. You can then install numpy with pip or easy_install specifying the version you want. There are many tutorials out there about how to use virtualenv.