Skip to content

ImportError: sys.meta_path is None on repo in script #2573

@pared

Description

@pared

Please provide information about your setup
DVC version(i.e. dvc --version), Platform and method of installation (pip, homebrew, pkg Mac, exe (Windows), DEB(Linux), RPM(Linux))

Dvc installed via pip install -e ."[all,test]" in virtualenv with Python 3.6.8.

Reproduction:

  1. Create repo:
#!/bin/bash
rm -rf repo
mkdir repo
cd repo
set -e
set -x

git init >> /dev/null && dvc init -q
  1. Try to initialize it in script:
from dvc.repo import Repo
repo = Repo("repo")
  1. Result:
Exception ignored in: <object repr() failed>
Traceback (most recent call last):
  File "/home/prd/development/tools/venvs/dvc3.6/lib/python3.6/site-packa
ges/flufl/lock/_lockfile.py", line 331, in __del__
  File "/home/prd/development/tools/venvs/dvc3.6/lib/python3.6/site-packa
ges/flufl/lock/_lockfile.py", line 326, in finalize
  File "/home/prd/development/tools/venvs/dvc3.6/lib/python3.6/site-packa
ges/flufl/lock/_lockfile.py", line 285, in unlock
  File "/home/prd/development/tools/venvs/dvc3.6/lib/python3.6/site-packa
ges/flufl/lock/_lockfile.py", line 312, in is_locked
  File "/home/prd/development/tools/venvs/dvc3.6/lib/python3.6/site-packa
ges/flufl/lock/_lockfile.py", line 459, in _touch
ImportError: sys.meta_path is None, Python is likely shutting down
  1. Something to start with:
    if we del repo before the end of the script, the problem does not occur.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugDid we break something?p2-mediumMedium priority, should be done, but less important

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions