Skip to content

ImportError in every dvc command after pip install -e in develop environment #6835

@karajan1001

Description

@karajan1001

Bug Report

ImportError: cannot import name '__version__' from '_version' (/Users/gao/Code/dvc/dvc/_version.py)

After every dvc command didn't affect the command running but quite anonying.

Description

Meet this error message after every command.

Traceback (most recent call last):
  File "/Users/gao/Code/dvc/dvc/__main__.py", line 7, in <module>
    sys.exit(main(sys.argv[1:]))
  File "/Users/gao/Code/dvc/dvc/main.py", line 97, in main
    if analytics.is_enabled():
  File "/Users/gao/Code/dvc/dvc/analytics.py", line 50, in is_enabled
    Config(validate=False).get("core", {}).get("analytics", "true")
  File "/Users/gao/Code/dvc/dvc/config.py", line 107, in __init__
    self.load(validate=validate, config=config)
  File "/Users/gao/Code/dvc/dvc/config.py", line 153, in load
    conf = self.load_config_to_level()
  File "/Users/gao/Code/dvc/dvc/config.py", line 278, in load_config_to_level
    merge(merged_conf, self.load_one(merge_level))
  File "/Users/gao/Code/dvc/dvc/config.py", line 202, in load_one
    conf = self._load_config(level)
  File "/Users/gao/Code/dvc/dvc/config.py", line 174, in _load_config
    from configobj import ConfigObj
  File "/Users/gao/anaconda3/envs/dvc/lib/python3.8/site-packages/configobj.py", line 23, in <module>
    from _version import __version__
ImportError: cannot import name '__version__' from '_version' (/Users/gao/Code/dvc/dvc/_version.py)

Reproduce

  1. git clone git@github.com:iterative/dvc.git
  2. cd dvc
  3. pip3 install -e ".[all,tests]"
  4. dvc doctor.

Expected

No error message

Environment information

Output of dvc doctor:

$ dvc doctor
DVC version: 2.8.2.dev35+geb0b4ce6
---------------------------------
Platform: Python 3.8.8 on macOS-10.16-x86_64-i386-64bit
Supports:
	azure (adlfs = 2021.9.1, knack = 0.8.0, azure-identity = 1.5.0),
	gdrive (pydrive2 = 1.9.4),
	gs (gcsfs = 2021.10.1),
	hdfs (fsspec = 2021.10.1, pyarrow = 3.0.0),
	webhdfs (fsspec = 2021.10.1),
	http (aiohttp = 3.7.4.post0, aiohttp-retry = 2.4.5),
	https (aiohttp = 3.7.4.post0, aiohttp-retry = 2.4.5),
	s3 (s3fs = 2021.10.1, boto3 = 1.17.106),
	ssh (sshfs = 2021.9.0),
	oss (ossfs = 2021.8.0),
	webdav (webdav4 = 0.9.3),
	webdavs (webdav4 = 0.9.3)
Cache types: <https://error.dvc.org/no-dvc-cache>
Caches: local
Remotes: oss, https, s3
Workspace directory: apfs on /dev/disk3s1s1
Repo: dvc, git

Additional Information (if any):

Error go out from configobj. It wants to read the contents from https://github.com/DiffSK/configobj/blob/master/src/configobj/_version.py but this file did not install properly.

And, as there is a _version.py generated automatically after pip install -e in our dvc repo. configobj wrongly reads it.

asciicast

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugDid we break something?

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions