===============
Troubleshooting
===============

.. contents::
   :local:
   :depth: 1


This page provides instructions for troubleshooting issues that
may occur with your Anaconda Repository installation.

Cannot connect to the server on port x
=======================================

This could be because you are behind a firewall. Check if your
IPTables rules are blocking your ports::

  iptables -L -n

If a rule blocks a port you want to use, then you must allow the port::

  sudo iptables -t nat -F
  sudo iptables -A INPUT -p tcp -m tcp --dport <PORT> -j ACCEPT
  sudo service iptables save
  sudo service iptables restart


Error: "No environment named 'search' exists in..." on Windows
===============================================================

If Anaconda Client is not yet installed and you try to search for
a package on Anaconda.org using the ``anaconda`` command, you may
receive the following error message::

  C:\Users\USERNAME>anaconda search -t conda PACKAGE
  No environment named "search" exists in C:\anaconda\envs

This error occurs because the Windows version of Anaconda
contains an ``anaconda.bat`` file that is used for setting
environment paths and switching environments. If Client is not
installed, this batch file is called instead. Once you install
Client, the Anaconda ``search`` command will work::

  conda install anaconda-client
  anaconda search -t conda PACKAGE


Anaconda upload fails while behind a reverse proxy
==================================================

When configuring Client to connect to a Repository behind a
reverse proxy, the ``anaconda upload`` command may appear to try
connecting to the internal hostname rather than the external
configured one.

This can be corrected in the settings of the reverse proxy, such
as NGINX or Apache.

In NGINX, add the setting ``proxy_set_header Host $host;`` to
access the internal host with the external hostname.

In Apache, turn on the option ``ProxyPreserveHost``.

Other reverse proxies each have their own settings to handle
hostnames correctly.

EXAMPLE: Some other reverse proxies use a settings syntax such as
``http_proxy=id:passwd@proxyhost:port``.


Start Repository application as a foreground process
====================================================

Repository should normally be started as a daemon. For
troubleshooting, it can instead be started as a foreground
process on a specified port::

  anaconda-server --port 8080

Stop the application with Control-C.
