Search code examples
pythonpython-3.xpipartifactory

pip install cannot resolve the version from artifactory


When installing using pip install -r requirement.txt (it has avro-python3) on a ubuntu machine. I am getting following error, it used to be a warning for a while ago, but now it's resulting in error.

Collecting avro-python3==1.9.2.1
  Downloading https://artifactory/avro-python3-1.9.2.1.tar.gz (37 kB)
WARNING: Requested avro-python3==1.9.2.1 from https://artifactory/avro-python3-1.9.2.1.tar.gz#sha256=ca1e77a3da5ac98e8833588f71fb2e170b38e34787ee0e04920de0e9470b7d32 (from -r requirements.txt (line 4)), but installing version file-.avro-VERSION.txt
ERROR: Requested avro-python3==1.9.2.1 from  https://artifactory/avro-python3-1.9.2.1.tar.gz#sha256=ca1e77a3da5ac98e8833588f71fb2e170b38e34787ee0e04920de0e9470b7d32 (from -r requirements.txt (line 4)) has different version in metadata: 'file-.avro-VERSION.txt'

My requirements.txt looks like

avro-python3==1.9.2.1

Is there a way to avoid this error?

What needs to be fixed in order to resolve it?

Is there a way I can specify in requirement.txt ? to not use artifactory for this package?


Solution

  • I downloaded avro-python3-1.9.2.1.tar.gz from PyPI. And its setup.cfg file looks like:

    [metadata]
    name = avro-python3
    version = file: avro/VERSION.txt
    description = Avro is a serialization and RPC framework.
    ...
    

    Note the version line and the file: notation. This notation was added in setuptools 39.2.0:

    So, make sure that your setuptools version is at least 39.2.0 and it would probably work better (maybe upgrading pip could help as well).