Esri / arcgis-python-api

Documentation and samples for ArcGIS API for Python
https://developers.arcgis.com/python/
Apache License 2.0
1.91k stars 1.11k forks source link

Running into " 'install_requires' must be a string or list of strings containing valid project/version requirement specifiers" error when installing arcgis package on Azure #1567

Closed Perla-Al-Haddad closed 1 year ago

Perla-Al-Haddad commented 1 year ago

Describe the bug When building my project on azure using github actions recently, I started getting an error when installing the arcgis python package. The main error is the following:

Collecting arcgis==1.9.1 (from -r requirements.txt (line 7))
  Downloading arcgis-1.9.1.tar.gz (3.5 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 3.5/3.5 MB 16.6 MB/s eta 0:00:00
  Installing build dependencies: started
  Installing build dependencies: finished with status 'done'
  Getting requirements to build wheel: started
  Getting requirements to build wheel: finished with status 'done'
  Installing backend dependencies: started
  Installing backend dependencies: finished with status 'done'
  Preparing metadata (pyproject.toml): started
  Preparing metadata (pyproject.toml): finished with status 'error'
  error: subprocess-exited-with-error

  × Preparing metadata (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [3 lines of output]
      error in arcgis setup command: 'install_requires' must be a string or list of strings containing valid project/version requirement specifiers; Expected end or semicolon (after version specifier)
          keyring >=19,<=21.8.*
                  ~~~~~~~~~~~^
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

The main problem seems to stem from the package trying to install a specific version of the keyring package.

To Reproduce Steps to reproduce the behavior:

This is my requirements.txt file:

azure-functions
lerc
arcgis==1.9.1
sqlalchemy==1.4.45
pyodbc
pandas

A project needs to be setup on git with this requirements.txt file to be built on azure using github actions.

This is the main relevant part of my workflow file used to build the application:

  build:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@v2

      - name: Setup Python version
        uses: actions/setup-python@v1
        with:
          python-version: ${{ env.PYTHON_VERSION }}

      - name: Create and start virtual environment
        run: |
          python -m venv venv
          source venv/bin/activate      
      - name: Install dependencies
        run: pip install -r requirements.txt

The environment is set to python 3.9

Expected behavior The package should be installed normally with all it's dependencies.

Platform:

Additional context The full stack trace to install the dependencies is the following:

Run pip install -r requirements.txt
  pip install -r requirements.txt
  shell: /usr/bin/bash -e {0}
  env:
    AZURE_FUNCTIONAPP_PACKAGE_PATH: .
    PYTHON_VERSION: 3.9
    pythonLocation: /opt/hostedtoolcache/Python/3.9.16/x64
Requirement already satisfied: setuptools in /opt/hostedtoolcache/Python/3.9.16/x64/lib/python3.9/site-packages (from -r requirements.txt (line 3)) (58.1.0)
Collecting azure-functions (from -r requirements.txt (line 4))
  Downloading azure_functions-1.14.0-py3-none-any.whl (165 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 165.6/165.6 kB 4.1 MB/s eta 0:00:00
Collecting lerc (from -r requirements.txt (line 5))
  Downloading lerc-4.0.1-py3-none-any.whl (736 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 736.4/736.4 kB 9.4 MB/s eta 0:00:00
Collecting keyring<=[2](https://github.com/none/GIS-API/actions/runs/4936692859/jobs/8824537091#step:5:2)1.8.*,>=19 (from -r requirements.txt (line 6))
  Downloading keyring-21.7.0-py[3](https://github.com/none/GIS-API/actions/runs/4936692859/jobs/8824537091#step:5:3)-none-any.whl (32 kB)
Collecting arcgis==1.9.1 (from -r requirements.txt (line 7))
  Downloading arcgis-1.9.1.tar.gz (3.5 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 3.5/3.5 MB 16.6 MB/s eta 0:00:00
  Installing build dependencies: started
  Installing build dependencies: finished with status 'done'
  Getting requirements to build wheel: started
  Getting requirements to build wheel: finished with status 'done'
  Installing backend dependencies: started
  Installing backend dependencies: finished with status 'done'
  Preparing metadata (pyproject.toml): started
  Preparing metadata (pyproject.toml): finished with status 'error'
  error: subprocess-exited-with-error

  × Preparing metadata (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [3 lines of output]
      error in arcgis setup command: 'install_requires' must be a string or list of strings containing valid project/version requirement specifiers; Expected end or semicolon (after version specifier)
          keyring >=19,<=21.8.*
                  ~~~~~~~~~~~^
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

Notice:  A new release of pip is available: 22.0.[4](https://github.com/none/GIS-API/actions/runs/4936692859/jobs/8824537091#step:5:4) -> [23](https://github.com/none/GIS-API/actions/runs/4936692859/jobs/8824537091#step:5:24).1.2
Notice:  To update, run: pip install --upgrade pip
Error: Process completed with exit code 1.

Thank you for any help on this issue.

Perla-Al-Haddad commented 1 year ago

This issue #1460 seems to be related, but it concerns the 2.1.0 version of the API.

Could the changes made for the #1460 issue be applied to version 1.9.1 of the API to bypass this problem with the keyring dependency?

nanaeaubry commented 1 year ago

@Perla-Al-Haddad We cannot backport fixes, unfortunately you will have to upgrade to the fixed version

Tresky commented 1 year ago

I encounter this same issue attempting to install arcgis 2.1.0 on Ubuntu 22.04 using pip in Python 3.8 and 3.9

EDIT: Installing arcgis 2.1.0.3 works though!