question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ImportError: cannot import name 'Version' from 'packaging.version'

See original GitHub issue

requirements.txt

gpt_index
numpy==1.23.5
pandas==1.5.2
torch
tensorflow
slack_sdk==3.19.5

generate_index.py

import gpt_index
reader = gpt_index.SlackReader(slack_token='XXX)
documents = reader.load_data(channel_ids=[
    'XXX',
    'XXX',
])
index = gpt_index.GPTTreeIndex(documents)
index.save_to_disk('gpt-index.json')

python3.10 ./generate_index.py returns error

Traceback (most recent call last):
  File "/mnt/c/Users/Slach/Downloads/altinity.staff/src/github.com/altinity/slack-qa/./generate_index.py", line 1, in <module>
    import gpt_index
  File "/home/slach/venv/slack-qa/lib/python3.10/site-packages/gpt_index/__init__.py", line 9, in <module>
    from gpt_index.indices.keyword_table.base import GPTKeywordTableIndex
  File "/home/slach/venv/slack-qa/lib/python3.10/site-packages/gpt_index/indices/keyword_table/base.py", line 15, in <module>
    from gpt_index.indices.base import (
  File "/home/slach/venv/slack-qa/lib/python3.10/site-packages/gpt_index/indices/base.py", line 17, in <module>
    from gpt_index.indices.data_structs import IndexStruct
  File "/home/slach/venv/slack-qa/lib/python3.10/site-packages/gpt_index/indices/data_structs.py", line 9, in <module>
    from dataclasses_json import DataClassJsonMixin
  File "/home/slach/venv/slack-qa/lib/python3.10/site-packages/dataclasses_json/__init__.py", line 2, in <module>
    from dataclasses_json.api import (DataClassJsonMixin,
  File "/home/slach/venv/slack-qa/lib/python3.10/site-packages/dataclasses_json/api.py", line 6, in <module>
    from dataclasses_json.cfg import config, LetterCase  # noqa: F401
  File "/home/slach/venv/slack-qa/lib/python3.10/site-packages/dataclasses_json/cfg.py", line 5, in <module>
    from marshmallow.fields import Field as MarshmallowField
  File "/home/slach/venv/slack-qa/lib/python3.10/site-packages/marshmallow/__init__.py", line 3, in <module>
    from packaging.version import Version
ImportError: cannot import name 'Version' from 'packaging.version' (/home/slach/venv/slack-qa/lib/python3.10/site-packages/packaging/version.py)

could you suggest properly libraries version?

Issue Analytics

  • State:closed
  • Created 9 months ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
Slachcommented, Dec 10, 2022

thanks for your great simple library

1reaction
Slachcommented, Dec 10, 2022

sorry, it was my broken virtual environment

Read more comments on GitHub >

github_iconTop Results From Across the Web

packaging no version #4 - facebookresearch/TorchRay - GitHub
... torchvision 0.3.0 when running the example code, there is an error: from packaging import version ImportError: cannot import name 'version'
Read more >
cannot import name 'version' from 'packaging' (transformers ...
Python ImportError: cannot import name 'version' from 'packaging' (transformers) · Which version of transformers have you installed? – cronoik.
Read more >
from packaging import version as pack_version ImportError
Dears, I am running a python code that generates for me this error : from packaging import version as pack_version ImportError: No module...
Read more >
How to Fix ImportError: Cannot Import Name in Python - Rollbar
The Python ImportError: cannot import name error occurs when an imported class is not accessible or is in a circular dependency.
Read more >
How to Fix : “ImportError: Cannot import name X” in Python
In Python "ImportError: cannot import name" error generally occurs when the imported class is not accessible, or the imported class is in a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found