Skip to content

python-arango is not working without pip-install installation #244

Closed
@alexbakharew

Description

@alexbakharew

Hello!

I am uisng python-arango for benchmarking arangodb and elasticsearch. python-arango is not installed on the target machine but I am importing it in the following way:

# avoid using 'pip install arango-python' command
arango_path = os.getcwd() + "/../iresearch.deps/python-arango"
if arango_path not in sys.path:
    sys.path.insert(0, arango_path)

I followed the discussion in this issue and found following PR which broke our existing testing pipeline with this error message:

alexey@c4:/home/jenkins/workspace/arangodb-ANY-benchmarks-client/arangosearch-benchmarks$ python3 ./Benchmarks.py ../args.json arango
/usr/lib/python3/dist-packages/requests/__init__.py:78: RequestsDependencyWarning: urllib3 (1.26.14) or chardet (3.0.4) doesn't match a supported version!
  warnings.warn("urllib3 ({0}) or chardet ({1}) doesn't match a supported "
Traceback (most recent call last):
  File "/home/jenkins/workspace/arangodb-ANY-benchmarks-client/arangosearch-benchmarks/./Benchmarks.py", line 182, in <module>
    main()
  File "/home/jenkins/workspace/arangodb-ANY-benchmarks-client/arangosearch-benchmarks/./Benchmarks.py", line 128, in main
    ArangoInstance.prepare_environment(environment_config["arango"], engines["arango"]["endpoints"])
  File "/home/jenkins/workspace/arangodb-ANY-benchmarks-client/arangosearch-benchmarks/Arango.py", line 169, in prepare_environment
    remove_all_views(db)
  File "/home/jenkins/workspace/arangodb-ANY-benchmarks-client/arangosearch-benchmarks/Arango.py", line 109, in remove_all_views
    for view in db.views():
  File "/home/jenkins/workspace/arangodb-ANY-benchmarks-client/arangosearch-benchmarks/../iresearch.deps/python-arango/arango/database.py", line 2092, in views
    request = Request(method="get", endpoint="/_api/view")
  File "/home/jenkins/workspace/arangodb-ANY-benchmarks-client/arangosearch-benchmarks/../iresearch.deps/python-arango/arango/request.py", line 128, in __init__
    self.headers: Headers = normalize_headers(headers, driver_flags)
  File "/home/jenkins/workspace/arangodb-ANY-benchmarks-client/arangosearch-benchmarks/../iresearch.deps/python-arango/arango/request.py", line 12, in normalize_headers
    driver_header = generate_driver_header(driver_flags)
  File "/home/jenkins/workspace/arangodb-ANY-benchmarks-client/arangosearch-benchmarks/../iresearch.deps/python-arango/arango/request.py", line 31, in generate_driver_header
    driver_version: str = ".".join(version(name).split(".")[:3])  # Only keep semver
  File "/usr/lib/python3.9/importlib/metadata.py", line 569, in version
    return distribution(distribution_name).version
  File "/usr/lib/python3.9/importlib/metadata.py", line 542, in distribution
    return Distribution.from_name(distribution_name)
  File "/usr/lib/python3.9/importlib/metadata.py", line 196, in from_name
    raise PackageNotFoundError(name)
importlib.metadata.PackageNotFoundError: python-arango

Also I found the reason of the error above: python/cpython#94113

The problem is that importlib.metadata can't work with modules which are not installed using pip. From issue above I read that it is fixed for python 3.10 and above. But I use python 3.9.

So I have 2 questions:

  1. In readme for python-arango it is stated that supported version of python is 3.8+. But we see that for this specific case it is not working. Is it a breaking change for python 3.8 compatibility?

  2. The last question is about version retrieving. Is it possible to do it not in runtime? I think this is quite unnecessary overheading.

Thanks in advance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions