Search code examples
condaartifactory

Installing any conda package returns python error only when using Artifactory repo as channel


I am an Artifactory admin trying to prototype a Conda workflow so we can provide user documentation when we upgrade Artifactory from 5.10 to 6.8. I have conda installed and I can install packages when I use the default channels (repo.anaconda.com/pkgs/...). I want this to work when I set the channels to repos in Artifactory.

I created 4 remote repos for:

I then included these into a virtual repo, called 'conda-remotes':

I followed the Artifactory "Set me up" instructions to set a .condarc file that points to my virtual repo. When I run "conda info" I get the following output:

(base) [centos@samuelm-sand ~]$ conda info

     active environment : base
    active env location : /home/centos/anaconda3
            shell level : 1
       user config file : /home/centos/.condarc
 populated config files : /home/centos/.condarc
          conda version : 4.6.14
    conda-build version : not installed
         python version : 2.7.16.final.0
       base environment : /home/centos/anaconda3  (writable)
           channel URLs : https://<<REDACTED>>/api/conda/anaconda-remotes/linux-64
                          https://<<REDACTED>>/api/conda/anaconda-remotes/noarch
          package cache : /home/centos/anaconda3/pkgs
                          /home/centos/.conda/pkgs
       envs directories : /home/centos/anaconda3/envs
                          /home/centos/.conda/envs
               platform : linux-64
             user-agent : conda/4.6.14 requests/2.20.0 CPython/2.7.16 Linux/3.10.0-693.17.1.el7.x86_64 centos/7.4.1708 glibc/2.17
                UID:GID : 1000:1000
             netrc file : None
           offline mode : False

When I run 'conda install conda-build' it finds it, asks me if I want to install, and then it installs the dependencies. I can goto my Artifactory virtual repo and see the dependencies getting cached. This is what I would expect, working so far. Then, once everything is downloaded, I get the following error:

Preparing transaction: failed

# >>>>>>>>>>>>>>>>>>>>>> ERROR REPORT <<<<<<<<<<<<<<<<<<<<<<

    Traceback (most recent call last):
      File "/home/centos/anaconda3/lib/python2.7/site-packages/conda/exceptions.py", line 1003, in __call__
        return func(*args, **kwargs)
      File "/home/centos/anaconda3/lib/python2.7/site-packages/conda/cli/main.py", line 84, in _main
        exit_code = do_call(args, p)
      File "/home/centos/anaconda3/lib/python2.7/site-packages/conda/cli/conda_argparse.py", line 82, in do_call
        exit_code = getattr(module, func_name)(args, parser)
      File "/home/centos/anaconda3/lib/python2.7/site-packages/conda/cli/main_install.py", line 20, in execute
        install(args, parser, 'install')
      File "/home/centos/anaconda3/lib/python2.7/site-packages/conda/cli/install.py", line 275, in install
        handle_txn(unlink_link_transaction, prefix, args, newenv)
      File "/home/centos/anaconda3/lib/python2.7/site-packages/conda/cli/install.py", line 304, in handle_txn
        unlink_link_transaction.execute()
      File "/home/centos/anaconda3/lib/python2.7/site-packages/conda/core/link.py", line 236, in execute
        self.verify()
      File "/home/centos/anaconda3/lib/python2.7/site-packages/conda/common/io.py", line 88, in decorated
        return f(*args, **kwds)
      File "/home/centos/anaconda3/lib/python2.7/site-packages/conda/core/link.py", line 213, in verify
        self.prepare()
      File "/home/centos/anaconda3/lib/python2.7/site-packages/conda/core/link.py", line 205, in prepare
        stp.remove_specs, stp.update_specs)
      File "/home/centos/anaconda3/lib/python2.7/site-packages/conda/core/link.py", line 280, in _prepare
        for prec, pcrec in zip(link_precs, pkg_cache_recs_to_link))
      File "/home/centos/anaconda3/lib/python2.7/site-packages/conda/core/link.py", line 280, in <genexpr>
        for prec, pcrec in zip(link_precs, pkg_cache_recs_to_link))
      File "/home/centos/anaconda3/lib/python2.7/site-packages/conda/gateways/disk/read.py", line 104, in read_package_info
        channel=Channel(record.schannel or record.channel),
      File "/home/centos/anaconda3/lib/python2.7/site-packages/conda/models/channel.py", line 37, in __call__
        c = Channel._cache_[value] = Channel.from_value(value)
      File "/home/centos/anaconda3/lib/python2.7/site-packages/conda/models/channel.py", line 106, in from_value
        return Channel.from_url(path_to_url(value))
      File "/home/centos/anaconda3/lib/python2.7/site-packages/conda/_vendor/auxlib/decorators.py", line 59, in _memoized_func
        result = func(*args, **kwargs)
      File "/home/centos/anaconda3/lib/python2.7/site-packages/conda/common/url.py", line 119, in path_to_url
        if path[1] == ':':
    IndexError: string index out of range

`$ /home/centos/anaconda3/bin/conda install conda-build`

  environment variables:
                 CIO_TEST=<not set>
        CONDA_DEFAULT_ENV=base
                CONDA_EXE=/home/centos/anaconda3/bin/conda
             CONDA_PREFIX=/home/centos/anaconda3
    CONDA_PROMPT_MODIFIER=(base)
         CONDA_PYTHON_EXE=/home/centos/anaconda3/bin/python
               CONDA_ROOT=/home/centos/anaconda3
              CONDA_SHLVL=1
                 GEM_PATH=/home/centos/.chefdk/gem/ruby/2.4.0:/opt/chefdk/embedded/lib/ruby/gems
                          /2.4.0
                     PATH=/home/centos/anaconda3/bin:/home/centos/anaconda3/bin:/home/centos/ana
                          conda3/condabin:/opt/chefdk/bin:/home/centos/.chefdk/gem/ruby/2.4.0/bi
                          n:/opt/chefdk/embedded/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/us
                          r/sbin:/opt/chefdk/gitbin:/home/centos/.local/bin:/home/centos/bin:/us
                          r/local/go/bin
       REQUESTS_CA_BUNDLE=<not set>
            SSL_CERT_FILE=<not set>

     active environment : base
    active env location : /home/centos/anaconda3
            shell level : 1
       user config file : /home/centos/.condarc
 populated config files : /home/centos/.condarc
          conda version : 4.6.14
    conda-build version : not installed
         python version : 2.7.16.final.0
       base environment : /home/centos/anaconda3  (writable)
           channel URLs : https://<<REDACTED>>/api/conda/anaconda-remotes/linux-64
                          https://<<REDACTED>>/api/conda/anaconda-remotes/noarch
          package cache : /home/centos/anaconda3/pkgs
                          /home/centos/.conda/pkgs
       envs directories : /home/centos/anaconda3/envs
                          /home/centos/.conda/envs
               platform : linux-64
             user-agent : conda/4.6.14 requests/2.20.0 CPython/2.7.16 Linux/3.10.0-693.17.1.el7.x86_64 centos/7.4.1708 glibc/2.17
                UID:GID : 1000:1000
             netrc file : None
           offline mode : False


An unexpected error has occurred. Conda has prepared the above report.

This exact same error has occurred for EVERYTHING I have tried to install. As I stated before, if I don't use the .condarc and just use the default channels this works. Any help would be greatly appreciated!


Solution

  • I got this email from jfrog support, my issue appears to be a bug w/ conda client:

    Hi Samuel,

    Please be informed that we were able to reproduce the same behavior with the latest conda client. You may refer to the following issue on GitHub (https://github.com/conda/conda/issues/8623) for more information and description - > Latest Conda doesn't work against Artifactory with "conda install". A fix will be included in the upcoming versions of conda client (Fix path_to_url "string index out of range" error #8625).

    As a workaround, we suggest using an older conda client version, 4.5.x and below. Please let us know if any further clarifications are needed, we'll be glad to assist.