Skip to content

Latest commit

 

History

History
341 lines (228 loc) · 15.1 KB

INSTALL.md

File metadata and controls

341 lines (228 loc) · 15.1 KB

Qiita installation

Qiita is pip installable, but depends on specific versions of python and non-python packages that must be installed first. We strongly recommend using virtual environments; a popular solution to manage them is miniconda, a lightweight version of the virtual environment, python distribution, and package manager anaconda. These instructions will be based on miniconda.

Install and setup miniconda

Download the appropriate installer here corresponding to your operating system and execute it.

Next, ensure conda is up-to-date.

conda update conda

Create a conda environment for Qiita

Setup a virtual environment in conda named qiita by executing the following:

conda create -q --yes -n qiita python=3.6 pip libgfortran numpy nginx

Brief introduction to managing conda environments

Though these instructions use the newly created qiita conda environment, the concepts apply to managing conda environments in general.

Activate your newly created virtual environment for qiita whenever you want to run or develop for it:

source activate qiita

After activating your new environment, you should see this kind of output when you run which python, indicating that the python command now refers to the python binary in your new virtual environment, rather than a previous global default such as /usr/bin/python. For example, assuming you installed miniconda in /Users/your_username/:

$ which python
/Users/your_username/miniconda2/envs/qiita/bin/python
(qiita)

If you don't see this output, your $PATH variable was setup incorrectly or you haven't restarted your shell. Consult the conda documentation.

As long as you are in the active qiita environment, commands such as pip install or python will refer to and be contained within this virtual environment.

When you want to deactivate your current conda environment, e.g. to return to a different project or back to your global python and pip packages, run:

source deactivate

Install the non-python dependencies

There are several options to install these dependencies depending on your needs:

  • We suggest installing the exact versions in these instructions by following the instructions of the provided links and making them globally available in your machine. However, this might interfere with other apps that might require different versions. 
  • Alternatively, you could install them via conda. However, the conda repository may not have the exact versions of these dependencies that you want.
  • You could setup a full development environment with Vagrant, and continue using conda under it to primarily manage python dependencies. Note that we don't cover Vagrant in these instructions.

PostgreSQL installation on Mac OS X

For Mac OS X, you can either install postgres through the Postgres.app. These instructions were tested with the Postgres.app v9.5.

You'll then need to ensure that the postgres binaries (for example, psql) are in your executable search path ($PATH environment variable). If you are using Postgres.app on OS X, you can do this by running the following, though you may have to replace~/.bash_profilewith ~/.zshrc if you're using zshell rather than the built-in bash, and you may have to change the version number Versions/9.3/ to the exact one that you are installing:

echo 'export PATH="$PATH:/Applications/Postgres.app/Contents/Versions/9.5/bin/"' >> ~/.bash_profile
source ~/.bash_profile

Redis-server installation on Mac OS X

Assuming you have homebrew installed, you can install redis-server v2.8.x as follows:

brew update
brew install homebrew/versions/redis28

webdis

Note that this package is OPTIONAL and this is the only package that assumes that Qiita is already installed (due to library dependencies). Also, that the general suggestion is to have 2 redis servers running, one for webdis/redbiom and the other for Qiita. The reason for multiple redis servers is so that the redbiom cache can be flushed without impacting the operation of the qiita server itself.

The following instructions install, compile and pre-populates the redbiom redis DB so we assume that redis is running on the default port and that Qiita is fully installed as the redbiom package is installed with Qiita.

git clone https://github.com/nicolasff/webdis
pushd webdis
make
./webdis &
popd
# note that this assumes that Qiita is already installed
fp=`python -c 'import qiita_db; print qiita_db.__file__'`
qdbd=`dirname $fp`
redbiom admin scripts-writable
redbiom admin create-context --name "qiita-test" --description "qiita-test context"
redbiom admin load-sample-metadata --metadata ${qdbd}/support_files/test_data/templates/1_19700101-000000.txt
redbiom admin load-sample-metadata-search --metadata ${qdbd}/support_files/test_data/templates/1_19700101-000000.txt
redbiom admin load-sample-data --table ${qdbd}/support_files/test_data/processed_data/1_study_1001_closed_reference_otu_table.biom --context qiita-test --tag 1

Install Qiita development version and its python dependencies

Clone the git repository with the development version of Qiita into your current directory:

git clone https://github.com/biocore/qiita.git

Navigate to the cloned directory and ensure your conda environment is active:

cd qiita
source activate qiita

Install Qiita (this occurs through setuptools' setup.py file in the qiita directory):

pip install . --no-binary redbiom

At this point, Qiita will be installed and the system will start. However, you will need to install plugins in order to process any kind of data. For a list of available plugins, visit the Qiita Spots github organization. Each of the plugins have their own installation instructions, we suggest looking at each individual .travis.yml file to see detailed installation instructions. Note that the most common plugins are:

Configure Qiita

After these commands are executed, you will need to:

Move the Qiita sample configuration file to a different directory by executing:

 cp ./qiita_core/support_files/config_test.cfg ~/.qiita_config_test.cfg

Note that you will need to change BASE_URL = https://localhost:8383 to BASE_URL = https://localhost:21174 if you are not using NGINX.

Set your QIITA_CONFIG_FP environment variable to point to that file (into .bashrc if using bash; .zshrc if using zshell):

  echo "export QIITA_CONFIG_FP=$HOME/.qiita_config_test.cfg" >> ~/.bashrc
  source ~/.bashrc
  # Re-enable conda environment for qiita
  source activate qiita

Update paths in the newly copied configuration file to match your settings, e.g. replace /home/travis/ with your user home directory.

Next, make a test environment:

qiita-env make --no-load-ontologies

Finally, redbiom relies on the REDBIOM_HOST environment variable to set the URL to query. By default is set to Qiita redbiom public repository. To change it you could do:

export REDBIOM_HOST=http://my_host.com:7379

Confirgure NGINX and supervisor

(NGINX)[https://www.nginx.com/] is not a requirement for Qiita development but it's highly recommended for deploys as this will allow us to have multiple workers. Note that we are already installing (NGINX)[https://www.nginx.com/] within the Qiita conda environment; also, that Qiita comes with an example (NGINX)[https://www.nginx.com/] config file: qiita_pet/nginx_example.conf, which is used in the Travis builds.

Now, (supervisor)[https://github.com/Supervisor/supervisor] will allow us to start all the workers we want based on its configuration file; and we need that both the (NGINX)[https://www.nginx.com/] and (supervisor)[https://github.com/Supervisor/supervisor] config files to match. For our Travis testing we are creating 3 workers: 21174 for master and 21175-6 as a regular workers.

If you are using (NGINX)[https://www.nginx.com/] via conda, you are going to need to create the NGINX folder within the environment; thus run:

mkdir -p ${CONDA_PREFIX}/var/run/nginx/

Start Qiita

Start postgres (instructions vary depending on operating system and install method).

Next, start redis server (the command may differ depending on your operating system and install location):

redis-server --port 7777

Start the qiita server:

# this builds documentation before starting the server
# alternatively: qiita pet webserver --no-build-docs start
qiita pet webserver start

If all the above commands executed correctly, you should be able to access Qiita by going in your browser to https://localhost:21174 if you are not using NGINX, or https://localhost:8383 if you are using NGINX, to login use test@foo.bar and password as the credentials. (In the future, we will have a single user mode that will allow you to use a local Qiita server without logging in. You can track progress on this on issue #920.)

Frequently Asked Questions and Troubleshooting

Error: database "qiita_test" already exists

This usually happens after an incomplete run of the qiita-env setup procedure. Drop the postgres table named qiita_test and retry setting up qiita-env as per instructions above:

 $ psql
 DROP DATABASE qiita_test;\q
 # now re-run qiita-env make --no-load-ontologies

Operating-system specific troubleshooting

Ubuntu

fe_sendauth: no password supplied

If you get a traceback similar to this one when starting up Qiita

File "/home/jorge/code/qiita/scripts/qiita-env", line 71, in make
  make_environment(load_ontologies, download_reference, add_demo_user)
File "/home/jorge/code/qiita/qiita_db/sql_connection.py", line 120, in __init__
  self._open_connection()
File "/home/jorge/code/qiita/qiita_db/sql_connection.py", line 155, in _open_connection
  raise RuntimeError("Cannot connect to database: %s" % str(e))
RuntimeError: Cannot connect to database: fe_sendauth: no password supplied

it can be solved by setting a password for the database (replace postgres with the actual name of the database qiita is configured to use):

$ psql postgres
ALTER USER postgres PASSWORD 'supersecurepassword';
\q

It might be necessary to restart postgresql: sudo service postgresql restart.

Furthermore, the pg_hba.conf file can be modified to change authentication type for local users to trust (rather than, e.g., md5) but we haven't tested this solution.

Error: You need to install postgresql-server-dev-X.Y for building a server-side extension or libpq-dev for building a client-side application.

Run the following. Note that for older ubuntu versions (< 14), these commands may install an older version of postgres (< 9.3) which may cause trouble. Ensure you're downloading and installing postgresql 9.3 via a different apt repository as per instructions here.

sudo apt-get update
sudo apt-get install postgresql
sudo apt-get install postgresql-contrib
sudo apt-get install libpq-dev

c/_cffi_backend.c:15:17: fatal error: ffi.h: No such file or directory

Missing dependency. Run the following and then re-run whatever command failed earlier:

sudo apt-get install -y libffi-dev

from PyQt4 import QtCore, QtGui ImportError: libSM.so.6: cannot open shared object file: No such file or directory

 sudo apt-get install -y python-qt4

ERROR: could not open extension control file "/usr/share/postgresql/9.3/extension/uuid-ossp.control": No such file or directory

sudo apt-get install postgresql-contrib
# or: sudo apt-get install postgresql-contrib-9.3 depending on your OS and apt repository versions

General Troubleshooting

Please note that the following notes are related to dependencies that Qiita does not maintain. As such, we strongly suggest you consult their official documentation to resolve issues. We cannot guarantee the accuracy of the suggestions below.

xcode

If running on OS X you should make sure that the Xcode and the Xcode command line tools are installed.

postgres

If you are using Postgres.app 9.3 on OSX, a database user will be created with your system username. If you want to use this user account, change the USER and ADMIN_USER settings to your username under the [postgres] section of your Qiita config file.

conda

If you are getting an error message running conda create, complaining about missing packages, then you might have to locate the appropriate conda channels and re-run conda create with the --channel flag:

For example, if libgfortran is missing:

# Install anaconda-client to search repositories
conda install anaconda-client

# Now search for missing package
anaconda search -t conda libgfortran
Using Anaconda Cloud api site https://api.anaconda.org
Run 'anaconda show <USER/PACKAGE>' to get more details:
Packages:
     Name                      |  Version | Package Types   | Platforms
     ------------------------- |   ------ | --------------- | ---------------
     OpenMDAO/libgfortran      |    4.8.3 | conda           | linux-32, osx-64
     aetrial/libgfortran       |          | conda           | linux-64
     ....etc....

Install the appropriate channel name that corresponds to your platform. For example, for Mac OS X 64-bit this would be:

conda install --channel https://conda.anaconda.org/OpenMDAO libgfortran

Now you can re-run your conda create command:

conda create [previous parameters go here] --channel OpenMDAO/libgfortran

python

As a general rule of thumb you will want to have an updated version of Python 3.6.

H5PY is known to cause a few problems, however their installation instructions are a great resource to troubleshoot your system in case any of the steps above fail.

matplotlib

In the event that you get _tkinter.TclError: no display name and no $DISPLAY environment variable error while trying to generate figures that rely on matplotlib, you should create a matplotlib rc file. This configuration file should have backend : agg. For more information you should visit the matplotlib configuration and troubleshooting page.