> ## Documentation Index
> Fetch the complete documentation index at: https://anaconda.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Working with private channels using third-party tools

In order to access private channels via third-party tools (such as `pip`, `Twine`, or `R`), you *must* have a resource token. For more information, see [Tokens](/docs/psm-on-prem/6.6.2/user/auth_token).

## Python packages

Twine is a popular tool for uploading Python packages to repositories. For information on setting your username and password using the configuration file or environment variables, see the official [Twine package documentation](https://twine.readthedocs.io/en/latest/#configuration).

<Note>
  Anaconda Server supports user authentication using *Basic Authentication*. For information on setting your index URL using the configuration file or environment variables, see the official [pip documentation](https://pip.pypa.io/en/stable/user_guide/#configuration).
</Note>

<Tabs>
  <Tab title="Uploading">
    To upload your Python packages using `Twine`, run the following command:

    ```sh theme={null}
    # Replace <FQDN> with your Anaconda Server fully qualified domain name
    # Replace <CHANNEL> with the name of the channel you want to upload your package to
    # Replace <PACKAGE> with the name of the package you are uploading
    # Replace <TOKEN> with a resource token that provides access to the channel
    twine upload --repository-url http://<FQDN>/api/repo/<CHANNEL> <PACKAGE> -u <TOKEN> -p x-auth-token
    ```

    **Example**

    ```sh theme={null}
    twine upload --repository-url http://demo-repo.com/api/repo/my-pip-channel six-1.13.0-py2.py3-none-any.whl -u 46e98d3dbf2378bb26e2107867652ee734eb098ea5b96f35 -p x-auth-token
    ```

    <Note>
      If you are receiving a 401 error message, your token is incorrect.
    </Note>
  </Tab>

  <Tab title="Installing">
    To install a `pip` package, run the following command:

    ```sh theme={null}
    # Replace <FQDN> with your Anaconda Server fully qualified domain name
    # Replace <CHANNEL> with the name of the channel that contains your package
    # Replace <PACKAGE> with the name of the package you are installing
    # Replace <TOKEN> with a resource token that provides access to the channel
    pip install --trusted-host <FQDN> --index-url http://<TOKEN>:x-auth-token@<FQDN>/api/repo/<CHANNEL>/simple <PACKAGE>
    ```

    **Example**

    ```sh theme={null}
    pip install --trusted-host demo-repo.com --index-url http://46e98d3dbf2378bb26e2107867652ee734eb098ea5b96f35:[[email protected]](/cdn-cgi/l/email-protection)/api/repo/alex-pip/simple six
    ```
  </Tab>
</Tabs>

## R packages

There is no standard tool for uploading R packages. Upload your R packages using either the UI or API directly.

<Tabs>
  <Tab title="Uploading">
    To upload R packages, run the following command:

    ```sh theme={null}
    # Replace <FQDN> with your Anaconda Server fully qualified domain name
    # Replace <CHANNEL> with the name of the channel you want to upload your package to
    # Replace <PACKAGE> with the name of the package you are uploading
    # Replace <TOKEN> with a resource token that provides access to the channel
    curl -v -F filetype=cran_source_package -F content=@<PACKAGE> http://<FQDN>/api/repo/<CHANNEL> -H"X-Auth: <TOKEN>"
    ```

    **Example**

    ```sh theme={null}
    curl -v -F filetype=cran_source_package -F content=@abc_2.1.tar.gz http://demo-repo.com/api/repo/alex-pip -H"X-Auth: 46e98d3dbf2378bb26e2107867652ee734eb098ea5b96f35"
    ```

    <Note>
      Use `cran_source_package` for source packages and `cran_binary_package` for binary R packages.
    </Note>
  </Tab>

  <Tab title="Installing">
    You can use your domain as a repository URL in the `install.packages` function by injecting a token into the path.

    To install an `R` package, run the following command:

    ```sh theme={null}
    # Replace <FQDN> with your Anaconda Server fully qualified domain name
    # Replace <CHANNEL> with the name of the channel that contains your package
    # Replace <PACKAGE> with the name of the package you are installing
    # Replace <TOKEN> with a resource token that provides access to the channel
    install.packages("<PACKAGE>", repos="http://<FQDN>/api/repo/t/<TOKEN>/<CHANNEL>/cran")
    ```

    **Example**

    ```sh theme={null}
    install.packages("leaflet", repos="http://demo-repo.com/api/t/46e98d3dbf2378bb26e2107867652ee734eb098ea5b96f35/repo/alex-pip/cran")
    ```
  </Tab>
</Tabs>
