Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
alexbakharew opened this issue Feb 6, 2023 · 3 comments
Closed

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

alexbakharew opened this issue Feb 6, 2023 · 3 comments

Comments

@alexbakharew
Copy link
Collaborator

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!

@fferozbasha
Copy link

hi @alexbakharew , did you get it to work. Even am facing the same issue.
ModuleNotFoundError: No module named 'importlib.metadata'. Tried importing import_metadata manually. But could not do so. Any workaround?

@joowani
Copy link
Contributor

joowani commented Feb 21, 2023

I reverted the commit with importlib.metadata in latest release 7.5.7. The issue should be resolved now.

@joowani joowani closed this as completed Feb 21, 2023
@fferozbasha
Copy link

thanks much @joowani . Shall test it with latest version again then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants