after_merge
stringlengths
28
79.6k
before_merge
stringlengths
20
79.6k
url
stringlengths
38
71
full_traceback
stringlengths
43
922k
traceback_type
stringclasses
555 values
def init_params(self): self.v = int_value(self.param.get("V", 0)) self.r = int_value(self.param["R"]) self.p = uint_value(self.param["P"], 32) self.o = str_value(self.param["O"]) self.u = str_value(self.param["U"]) self.length = int_value(self.param.get("Length", 40)) return
def init_params(self): self.v = int_value(self.param.get("V", 0)) self.r = int_value(self.param["R"]) self.p = int_value(self.param["P"]) self.o = str_value(self.param["O"]) self.u = str_value(self.param["U"]) self.length = int_value(self.param.get("Length", 40)) return
https://github.com/pdfminer/pdfminer.six/issues/186
Traceback (most recent call last): File "/mnt/c/Users/aq4'july/Desktop/CleanTextAPI_withNewPdfAnalyser/PdfAnalyzer.py", line 108, in GetTextFromPdf for page in PDFPage.get_pages(pdfFile): File "/usr/local/lib/python3.5/dist-packages/pdfminer/pdfpage.py", line 129, in get_pages doc = PDFDocument(parser, password=password, caching=caching) File "/usr/local/lib/python3.5/dist-packages/pdfminer/pdfdocument.py", line 577, in __init__ self._initialize_password(password) File "/usr/local/lib/python3.5/dist-packages/pdfminer/pdfdocument.py", line 603, in _initialize_password handler = factory(docid, param, password) File "/usr/local/lib/python3.5/dist-packages/pdfminer/pdfdocument.py", line 303, in __init__ self.init() File "/usr/local/lib/python3.5/dist-packages/pdfminer/pdfdocument.py", line 310, in init self.init_key() File "/usr/local/lib/python3.5/dist-packages/pdfminer/pdfdocument.py", line 323, in init_key self.key = self.authenticate(self.password) File "/usr/local/lib/python3.5/dist-packages/pdfminer/pdfdocument.py", line 372, in authenticate key = self.authenticate_user_password(password) File "/usr/local/lib/python3.5/dist-packages/pdfminer/pdfdocument.py", line 378, in authenticate_user_password key = self.compute_encryption_key(password) File "/usr/local/lib/python3.5/dist-packages/pdfminer/pdfdocument.py", line 357, in compute_encryption_key hash.update(struct.pack('<l', self.p)) # 4 struct.error: 'l' format requires -2147483648 <= number <= 2147483647
struct.error
def compute_encryption_key(self, password): # Algorithm 3.2 password = (password + self.PASSWORD_PADDING)[:32] # 1 hash = md5.md5(password) # 2 hash.update(self.o) # 3 # See https://github.com/pdfminer/pdfminer.six/issues/186 hash.update(struct.pack("<L", self.p)) # 4 hash.update(self.docid[0]) # 5 if self.r >= 4: if not self.encrypt_metadata: hash.update(b"\xff\xff\xff\xff") result = hash.digest() n = 5 if self.r >= 3: n = self.length // 8 for _ in range(50): result = md5.md5(result[:n]).digest() return result[:n]
def compute_encryption_key(self, password): # Algorithm 3.2 password = (password + self.PASSWORD_PADDING)[:32] # 1 hash = md5.md5(password) # 2 hash.update(self.o) # 3 hash.update(struct.pack("<l", self.p)) # 4 hash.update(self.docid[0]) # 5 if self.r >= 4: if not self.encrypt_metadata: hash.update(b"\xff\xff\xff\xff") result = hash.digest() n = 5 if self.r >= 3: n = self.length // 8 for _ in range(50): result = md5.md5(result[:n]).digest() return result[:n]
https://github.com/pdfminer/pdfminer.six/issues/186
Traceback (most recent call last): File "/mnt/c/Users/aq4'july/Desktop/CleanTextAPI_withNewPdfAnalyser/PdfAnalyzer.py", line 108, in GetTextFromPdf for page in PDFPage.get_pages(pdfFile): File "/usr/local/lib/python3.5/dist-packages/pdfminer/pdfpage.py", line 129, in get_pages doc = PDFDocument(parser, password=password, caching=caching) File "/usr/local/lib/python3.5/dist-packages/pdfminer/pdfdocument.py", line 577, in __init__ self._initialize_password(password) File "/usr/local/lib/python3.5/dist-packages/pdfminer/pdfdocument.py", line 603, in _initialize_password handler = factory(docid, param, password) File "/usr/local/lib/python3.5/dist-packages/pdfminer/pdfdocument.py", line 303, in __init__ self.init() File "/usr/local/lib/python3.5/dist-packages/pdfminer/pdfdocument.py", line 310, in init self.init_key() File "/usr/local/lib/python3.5/dist-packages/pdfminer/pdfdocument.py", line 323, in init_key self.key = self.authenticate(self.password) File "/usr/local/lib/python3.5/dist-packages/pdfminer/pdfdocument.py", line 372, in authenticate key = self.authenticate_user_password(password) File "/usr/local/lib/python3.5/dist-packages/pdfminer/pdfdocument.py", line 378, in authenticate_user_password key = self.compute_encryption_key(password) File "/usr/local/lib/python3.5/dist-packages/pdfminer/pdfdocument.py", line 357, in compute_encryption_key hash.update(struct.pack('<l', self.p)) # 4 struct.error: 'l' format requires -2147483648 <= number <= 2147483647
struct.error
def isnumber(x): return isinstance(x, (int, float))
def isnumber(x): return isinstance(x, ((int,), float))
https://github.com/pdfminer/pdfminer.six/issues/186
Traceback (most recent call last): File "/mnt/c/Users/aq4'july/Desktop/CleanTextAPI_withNewPdfAnalyser/PdfAnalyzer.py", line 108, in GetTextFromPdf for page in PDFPage.get_pages(pdfFile): File "/usr/local/lib/python3.5/dist-packages/pdfminer/pdfpage.py", line 129, in get_pages doc = PDFDocument(parser, password=password, caching=caching) File "/usr/local/lib/python3.5/dist-packages/pdfminer/pdfdocument.py", line 577, in __init__ self._initialize_password(password) File "/usr/local/lib/python3.5/dist-packages/pdfminer/pdfdocument.py", line 603, in _initialize_password handler = factory(docid, param, password) File "/usr/local/lib/python3.5/dist-packages/pdfminer/pdfdocument.py", line 303, in __init__ self.init() File "/usr/local/lib/python3.5/dist-packages/pdfminer/pdfdocument.py", line 310, in init self.init_key() File "/usr/local/lib/python3.5/dist-packages/pdfminer/pdfdocument.py", line 323, in init_key self.key = self.authenticate(self.password) File "/usr/local/lib/python3.5/dist-packages/pdfminer/pdfdocument.py", line 372, in authenticate key = self.authenticate_user_password(password) File "/usr/local/lib/python3.5/dist-packages/pdfminer/pdfdocument.py", line 378, in authenticate_user_password key = self.compute_encryption_key(password) File "/usr/local/lib/python3.5/dist-packages/pdfminer/pdfdocument.py", line 357, in compute_encryption_key hash.update(struct.pack('<l', self.p)) # 4 struct.error: 'l' format requires -2147483648 <= number <= 2147483647
struct.error
def getobj(self, objid): """Get object from PDF :raises PDFException if PDFDocument is not initialized :raises PDFObjectNotFound if objid does not exist in PDF """ if not self.xrefs: raise PDFException("PDFDocument is not initialized") log.debug("getobj: objid=%r", objid) if objid in self._cached_objs: (obj, genno) = self._cached_objs[objid] else: for xref in self.xrefs: try: (strmid, index, genno) = xref.get_pos(objid) except KeyError: continue try: if strmid is not None: stream = stream_value(self.getobj(strmid)) obj = self._getobj_objstm(stream, index, objid) else: obj = self._getobj_parse(index, objid) if self.decipher: obj = decipher_all(self.decipher, objid, genno, obj) if isinstance(obj, PDFStream): obj.set_objid(objid, genno) break except (PSEOF, PDFSyntaxError): continue else: raise PDFObjectNotFound(objid) log.debug("register: objid=%r: %r", objid, obj) if self.caching: self._cached_objs[objid] = (obj, genno) return obj
def getobj(self, objid): assert objid != 0 if not self.xrefs: raise PDFException("PDFDocument is not initialized") log.debug("getobj: objid=%r", objid) if objid in self._cached_objs: (obj, genno) = self._cached_objs[objid] else: for xref in self.xrefs: try: (strmid, index, genno) = xref.get_pos(objid) except KeyError: continue try: if strmid is not None: stream = stream_value(self.getobj(strmid)) obj = self._getobj_objstm(stream, index, objid) else: obj = self._getobj_parse(index, objid) if self.decipher: obj = decipher_all(self.decipher, objid, genno, obj) if isinstance(obj, PDFStream): obj.set_objid(objid, genno) break except (PSEOF, PDFSyntaxError): continue else: raise PDFObjectNotFound(objid) log.debug("register: objid=%r: %r", objid, obj) if self.caching: self._cached_objs[objid] = (obj, genno) return obj
https://github.com/pdfminer/pdfminer.six/issues/94
$ dumppdf -a invalid.pdf <pdf>Traceback (most recent call last): File "/usr/bin/dumppdf", line 268, in <module> if __name__ == '__main__': sys.exit(main(sys.argv)) File "/usr/bin/dumppdf", line 265, in main dumpall=dumpall, codec=codec, extractdir=extractdir) File "/usr/bin/dumppdf", line 216, in dumppdf dumpallobjs(outfp, doc, codec=codec) File "/usr/bin/dumppdf", line 102, in dumpallobjs obj = doc.getobj(objid) File "/usr/local/lib/python2.7/dist-packages/pdfminer/pdfdocument.py", line 658, in getobj assert objid != 0 AssertionError
AssertionError
def __init__(self, descriptor, widths, default_width=None): self.descriptor = descriptor self.widths = resolve_all(widths) self.fontname = resolve1(descriptor.get("FontName", "unknown")) if isinstance(self.fontname, PSLiteral): self.fontname = literal_name(self.fontname) self.flags = int_value(descriptor.get("Flags", 0)) self.ascent = num_value(descriptor.get("Ascent", 0)) self.descent = num_value(descriptor.get("Descent", 0)) self.italic_angle = num_value(descriptor.get("ItalicAngle", 0)) self.default_width = default_width or num_value(descriptor.get("MissingWidth", 0)) self.leading = num_value(descriptor.get("Leading", 0)) self.bbox = list_value(resolve_all(descriptor.get("FontBBox", (0, 0, 0, 0)))) self.hscale = self.vscale = 0.001 return
def __init__(self, descriptor, widths, default_width=None): self.descriptor = descriptor self.widths = widths self.fontname = resolve1(descriptor.get("FontName", "unknown")) if isinstance(self.fontname, PSLiteral): self.fontname = literal_name(self.fontname) self.flags = int_value(descriptor.get("Flags", 0)) self.ascent = num_value(descriptor.get("Ascent", 0)) self.descent = num_value(descriptor.get("Descent", 0)) self.italic_angle = num_value(descriptor.get("ItalicAngle", 0)) self.default_width = default_width or num_value(descriptor.get("MissingWidth", 0)) self.leading = num_value(descriptor.get("Leading", 0)) self.bbox = list_value(descriptor.get("FontBBox", (0, 0, 0, 0))) self.hscale = self.vscale = 0.001 return
https://github.com/pdfminer/pdfminer.six/issues/268
Traceback (most recent call last): File "./main.py", line 748, in parseEachProfile self.people.append(parser.parse(None)) File "./main.py", line 322, in parse poslist = parser.parsepdf2(filename) File "/Users/____/Dropbox/___/Parser/pdfparsing.py", line 167, in parsepdf2 interpreter.process_page(page) File "/usr/local/lib/python2.7/site-packages/pdfminer/pdfinterp.py", line 839, in process_page self.render_contents(page.resources, page.contents, ctm=ctm) File "/usr/local/lib/python2.7/site-packages/pdfminer/pdfinterp.py", line 852, in render_contents self.execute(list_value(streams)) File "/usr/local/lib/python2.7/site-packages/pdfminer/pdfinterp.py", line 877, in execute func(*args) File "/usr/local/lib/python2.7/site-packages/pdfminer/pdfinterp.py", line 760, in do_TJ self.device.render_string(self.textstate, seq) File "/usr/local/lib/python2.7/site-packages/pdfminer/pdfdevice.py", line 82, in render_string scaling, charspace, wordspace, rise, dxscale) File "/usr/local/lib/python2.7/site-packages/pdfminer/pdfdevice.py", line 98, in render_string_horizontal font, fontsize, scaling, rise, cid) File "/usr/local/lib/python2.7/site-packages/pdfminer/converter.py", line 112, in render_char textwidth = font.char_width(cid) File "/usr/local/lib/python2.7/site-packages/pdfminer/pdffont.py", line 517, in char_width return self.widths[cid] * self.hscale TypeError: unsupported operand type(s) for *: 'PDFObjRef' and 'float'
TypeError
def name2unicode(name): """Converts Adobe glyph names to Unicode numbers. In contrast to the specification, this raises a KeyError instead of return an empty string when the key is unknown. This way the caller must explicitly define what to do when there is not a match. Reference: https://github.com/adobe-type-tools/agl-specification#2-the-mapping :returns unicode character if name resembles something, otherwise a KeyError """ name = name.split(".")[0] components = name.split("_") if len(components) > 1: return "".join(map(name2unicode, components)) else: if name in glyphname2unicode: return glyphname2unicode.get(name) elif name.startswith("uni"): name_without_uni = name.strip("uni") if HEXADECIMAL.match(name_without_uni) and len(name_without_uni) % 4 == 0: unicode_digits = [ int(name_without_uni[i : i + 4], base=16) for i in range(0, len(name_without_uni), 4) ] for digit in unicode_digits: raise_key_error_for_invalid_unicode(digit) characters = map(six.unichr, unicode_digits) return "".join(characters) elif name.startswith("u"): name_without_u = name.strip("u") if HEXADECIMAL.match(name_without_u) and 4 <= len(name_without_u) <= 6: unicode_digit = int(name_without_u, base=16) raise_key_error_for_invalid_unicode(unicode_digit) return six.unichr(unicode_digit) raise KeyError( 'Could not convert unicode name "%s" to character because it does not match specification' % name )
def name2unicode(name): """Converts Adobe glyph names to Unicode numbers.""" if name in glyphname2unicode: return glyphname2unicode[name] m = STRIP_NAME.search(name) if not m: raise KeyError(name) return six.unichr(int(m.group(0)))
https://github.com/pdfminer/pdfminer.six/issues/177
Traceback (most recent call last): File "/Users/rakshabm/Documents/Python/extract_from_pdf.py", line 95, in <module> interpreter.process_page(page) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pdfminer/pdfinterp.py", line 852, in process_page self.render_contents(page.resources, page.contents, ctm=ctm) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pdfminer/pdfinterp.py", line 862, in render_contents self.init_resources(resources) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pdfminer/pdfinterp.py", line 362, in init_resources self.fontmap[fontid] = self.rsrcmgr.get_font(objid, spec) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pdfminer/pdfinterp.py", line 200, in get_font font = PDFType3Font(self, spec) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pdfminer/pdffont.py", line 622, in __init__ PDFSimpleFont.__init__(self, descriptor, widths, spec) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pdfminer/pdffont.py", line 547, in __init__ self.cid2unicode = EncodingDB.get_encoding(name, diff) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pdfminer/encodingdb.py", line 61, in get_encoding cid2unicode[cid] = name2unicode(x.name) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pdfminer/encodingdb.py", line 21, in name2unicode return six.unichr(int(m.group(0))) OverflowError: Python int too large to convert to C long
OverflowError
def get_encoding(klass, name, diff=None): cid2unicode = klass.encodings.get(name, klass.std2unicode) if diff: cid2unicode = cid2unicode.copy() cid = 0 for x in diff: if isinstance(x, int): cid = x elif isinstance(x, PSLiteral): try: cid2unicode[cid] = name2unicode(x.name) except KeyError as e: log.debug(str(e)) cid += 1 return cid2unicode
def get_encoding(klass, name, diff=None): cid2unicode = klass.encodings.get(name, klass.std2unicode) if diff: cid2unicode = cid2unicode.copy() cid = 0 for x in diff: if isinstance(x, int): cid = x elif isinstance(x, PSLiteral): try: cid2unicode[cid] = name2unicode(x.name) except KeyError: pass cid += 1 return cid2unicode
https://github.com/pdfminer/pdfminer.six/issues/177
Traceback (most recent call last): File "/Users/rakshabm/Documents/Python/extract_from_pdf.py", line 95, in <module> interpreter.process_page(page) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pdfminer/pdfinterp.py", line 852, in process_page self.render_contents(page.resources, page.contents, ctm=ctm) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pdfminer/pdfinterp.py", line 862, in render_contents self.init_resources(resources) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pdfminer/pdfinterp.py", line 362, in init_resources self.fontmap[fontid] = self.rsrcmgr.get_font(objid, spec) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pdfminer/pdfinterp.py", line 200, in get_font font = PDFType3Font(self, spec) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pdfminer/pdffont.py", line 622, in __init__ PDFSimpleFont.__init__(self, descriptor, widths, spec) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pdfminer/pdffont.py", line 547, in __init__ self.cid2unicode = EncodingDB.get_encoding(name, diff) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pdfminer/encodingdb.py", line 61, in get_encoding cid2unicode[cid] = name2unicode(x.name) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pdfminer/encodingdb.py", line 21, in name2unicode return six.unichr(int(m.group(0))) OverflowError: Python int too large to convert to C long
OverflowError
def get_encoding(self): """Parse the font encoding The Type1 font encoding maps character codes to character names. These character names could either be standard Adobe glyph names, or character names associated with custom CharStrings for this font. A CharString is a sequence of operations that describe how the character should be drawn. Currently, this function returns '' (empty string) for character names that are associated with a CharStrings. References: http://wwwimages.adobe.com/content/dam/Adobe/en/devnet/font/pdfs/T1_SPEC.pdf :returns mapping of character identifiers (cid's) to unicode characters """ while 1: try: (cid, name) = self.nextobject() except PSEOF: break try: self._cid2unicode[cid] = name2unicode(name) except KeyError as e: log.debug(str(e)) return self._cid2unicode
def get_encoding(self): while 1: try: (cid, name) = self.nextobject() except PSEOF: break try: self._cid2unicode[cid] = name2unicode(name) except KeyError: pass return self._cid2unicode
https://github.com/pdfminer/pdfminer.six/issues/177
Traceback (most recent call last): File "/Users/rakshabm/Documents/Python/extract_from_pdf.py", line 95, in <module> interpreter.process_page(page) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pdfminer/pdfinterp.py", line 852, in process_page self.render_contents(page.resources, page.contents, ctm=ctm) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pdfminer/pdfinterp.py", line 862, in render_contents self.init_resources(resources) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pdfminer/pdfinterp.py", line 362, in init_resources self.fontmap[fontid] = self.rsrcmgr.get_font(objid, spec) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pdfminer/pdfinterp.py", line 200, in get_font font = PDFType3Font(self, spec) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pdfminer/pdffont.py", line 622, in __init__ PDFSimpleFont.__init__(self, descriptor, widths, spec) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pdfminer/pdffont.py", line 547, in __init__ self.cid2unicode = EncodingDB.get_encoding(name, diff) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pdfminer/encodingdb.py", line 61, in get_encoding cid2unicode[cid] = name2unicode(x.name) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pdfminer/encodingdb.py", line 21, in name2unicode return six.unichr(int(m.group(0))) OverflowError: Python int too large to convert to C long
OverflowError
def drange(v0, v1, d): """Returns a discrete range.""" return range(int(v0) // d, int(v1 + d) // d)
def drange(v0, v1, d): """Returns a discrete range.""" assert v0 < v1, str((v0, v1, d)) return range(int(v0) // d, int(v1 + d) // d)
https://github.com/pdfminer/pdfminer.six/issues/66
Traceback (most recent call last): File "./pdfstats.py", line 81, in <module> sys.exit(main(sys.argv[1:])) File "./pdfstats.py", line 71, in main interpreter.process_page(page) File "/usr/local/lib/python3.6/site-packages/pdfminer/pdfinterp.py", line 851, in process_page self.device.end_page(page) File "/usr/local/lib/python3.6/site-packages/pdfminer/converter.py", line 51, in end_page self.cur_item.analyze(self.laparams) File "/usr/local/lib/python3.6/site-packages/pdfminer/layout.py", line 677, in analyze obj.analyze(laparams) File "/usr/local/lib/python3.6/site-packages/pdfminer/layout.py", line 724, in analyze LTLayoutContainer.analyze(self, laparams) File "/usr/local/lib/python3.6/site-packages/pdfminer/layout.py", line 684, in analyze textboxes = list(self.group_textlines(laparams, textlines)) File "/usr/local/lib/python3.6/site-packages/pdfminer/layout.py", line 579, in group_textlines neighbors = line.find_neighbors(plane, laparams.line_margin) File "/usr/local/lib/python3.6/site-packages/pdfminer/layout.py", line 387, in find_neighbors return [obj for obj in objs File "/usr/local/lib/python3.6/site-packages/pdfminer/layout.py", line 387, in <listcomp> return [obj for obj in objs File "/usr/local/lib/python3.6/site-packages/pdfminer/utils.py", line 373, in find for k in self._getrange(bbox): File "/usr/local/lib/python3.6/site-packages/pdfminer/utils.py", line 335, in _getrange for y in drange(y0, y1, self.gridsize): File "/usr/local/lib/python3.6/site-packages/pdfminer/utils.py", line 173, in drange assert v0 < v1 AssertionError: (807.874, 807.874, 50)
AssertionError
def get_cmap(klass, name): if name == "Identity-H": return IdentityCMap(WMode=0) elif name == "Identity-V": return IdentityCMap(WMode=1) elif name == "OneByteIdentityH": return IdentityCMapByte(WMode=0) elif name == "OneByteIdentityV": return IdentityCMapByte(WMode=1) try: return klass._cmap_cache[name] except KeyError: pass data = klass._load_data(name) klass._cmap_cache[name] = cmap = PyCMap(name, data) return cmap
def get_cmap(klass, name): if name == "Identity-H": return IdentityCMap(WMode=0) elif name == "Identity-V": return IdentityCMap(WMode=1) try: return klass._cmap_cache[name] except KeyError: pass data = klass._load_data(name) klass._cmap_cache[name] = cmap = PyCMap(name, data) return cmap
https://github.com/pdfminer/pdfminer.six/issues/210
Traceback (most recent call last): File "/home/felix/anaconda3/bin/pdf2txt.py", line 136, in <module> if __name__ == '__main__': sys.exit(main()) File "/home/felix/anaconda3/bin/pdf2txt.py", line 131, in main outfp = extract_text(**vars(A)) File "/home/felix/anaconda3/bin/pdf2txt.py", line 63, in extract_text pdfminer.high_level.extract_text_to_fp(fp, **locals()) File "/home/felix/anaconda3/lib/python3.6/site-packages/pdfminer/high_level.py", line 82, in extract_text_to_fp interpreter.process_page(page) File "/home/felix/anaconda3/lib/python3.6/site-packages/pdfminer/pdfinterp.py", line 852, in process_page self.render_contents(page.resources, page.contents, ctm=ctm) File "/home/felix/anaconda3/lib/python3.6/site-packages/pdfminer/pdfinterp.py", line 862, in render_contents self.init_resources(resources) File "/home/felix/anaconda3/lib/python3.6/site-packages/pdfminer/pdfinterp.py", line 362, in init_resources self.fontmap[fontid] = self.rsrcmgr.get_font(objid, spec) File "/home/felix/anaconda3/lib/python3.6/site-packages/pdfminer/pdfinterp.py", line 212, in get_font font = self.get_font(None, subspec) File "/home/felix/anaconda3/lib/python3.6/site-packages/pdfminer/pdfinterp.py", line 203, in get_font font = PDFCIDFont(self, spec) File "/home/felix/anaconda3/lib/python3.6/site-packages/pdfminer/pdffont.py", line 658, in __init__ self.cmap = CMapDB.get_cmap(name) File "/home/felix/anaconda3/lib/python3.6/site-packages/pdfminer/cmapdb.py", line 259, in get_cmap data = klass._load_data(name) File "/home/felix/anaconda3/lib/python3.6/site-packages/pdfminer/cmapdb.py", line 233, in _load_data name = name.replace("\0", "") AttributeError: 'PDFStream' object has no attribute 'replace'
AttributeError
def do_keyword(self, pos, token): if token is self.KEYWORD_BEGINCMAP: self._in_cmap = True self.popall() return elif token is self.KEYWORD_ENDCMAP: self._in_cmap = False return if not self._in_cmap: return # if token is self.KEYWORD_DEF: try: ((_, k), (_, v)) = self.pop(2) self.cmap.set_attr(literal_name(k), v) except PSSyntaxError: pass return if token is self.KEYWORD_USECMAP: try: ((_, cmapname),) = self.pop(1) self.cmap.use_cmap(CMapDB.get_cmap(literal_name(cmapname))) except PSSyntaxError: pass except CMapDB.CMapNotFound: pass return if token is self.KEYWORD_BEGINCODESPACERANGE: self.popall() return if token is self.KEYWORD_ENDCODESPACERANGE: self.popall() return if token is self.KEYWORD_BEGINCIDRANGE: self.popall() return if token is self.KEYWORD_ENDCIDRANGE: objs = [obj for (__, obj) in self.popall()] for s, e, cid in choplist(3, objs): if ( not isinstance(s, str) or not isinstance(e, str) or not isinstance(cid, int) or len(s) != len(e) ): continue sprefix = s[:-4] eprefix = e[:-4] if sprefix != eprefix: continue svar = s[-4:] evar = e[-4:] s1 = nunpack(svar) e1 = nunpack(evar) vlen = len(svar) for i in range(e1 - s1 + 1): x = sprefix + struct.pack(">L", s1 + i)[-vlen:] self.cmap.add_code2cid(x, cid + i) return if token is self.KEYWORD_BEGINCIDCHAR: self.popall() return if token is self.KEYWORD_ENDCIDCHAR: objs = [obj for (__, obj) in self.popall()] for cid, code in choplist(2, objs): if isinstance(code, str) and isinstance(cid, str): self.cmap.add_code2cid(code, nunpack(cid)) return if token is self.KEYWORD_BEGINBFRANGE: self.popall() return if token is self.KEYWORD_ENDBFRANGE: objs = [obj for (__, obj) in self.popall()] for s, e, code in choplist(3, objs): if not isinstance(s, bytes) or not isinstance(e, bytes) or len(s) != len(e): continue s1 = nunpack(s) e1 = nunpack(e) if isinstance(code, list): for i in range(e1 - s1 + 1): self.cmap.add_cid2unichr(s1 + i, code[i]) else: var = code[-4:] base = nunpack(var) prefix = code[:-4] vlen = len(var) for i in range(e1 - s1 + 1): x = prefix + struct.pack(">L", base + i)[-vlen:] self.cmap.add_cid2unichr(s1 + i, x) return if token is self.KEYWORD_BEGINBFCHAR: self.popall() return if token is self.KEYWORD_ENDBFCHAR: objs = [obj for (__, obj) in self.popall()] for cid, code in choplist(2, objs): if isinstance(cid, bytes) and isinstance(code, bytes): self.cmap.add_cid2unichr(nunpack(cid), code) return if token is self.KEYWORD_BEGINNOTDEFRANGE: self.popall() return if token is self.KEYWORD_ENDNOTDEFRANGE: self.popall() return self.push((pos, token)) return
def do_keyword(self, pos, token): if token is self.KEYWORD_BEGINCMAP: self._in_cmap = True self.popall() return elif token is self.KEYWORD_ENDCMAP: self._in_cmap = False return if not self._in_cmap: return # if token is self.KEYWORD_DEF: try: ((_, k), (_, v)) = self.pop(2) self.cmap.set_attr(literal_name(k), v) except PSSyntaxError: pass return if token is self.KEYWORD_USECMAP: try: ((_, cmapname),) = self.pop(1) self.cmap.use_cmap(CMapDB.get_cmap(literal_name(cmapname))) except PSSyntaxError: pass except CMapDB.CMapNotFound: pass return if token is self.KEYWORD_BEGINCODESPACERANGE: self.popall() return if token is self.KEYWORD_ENDCODESPACERANGE: self.popall() return if token is self.KEYWORD_BEGINCIDRANGE: self.popall() return if token is self.KEYWORD_ENDCIDRANGE: objs = [obj for (__, obj) in self.popall()] for s, e, cid in choplist(3, objs): if ( not isinstance(s, str) or not isinstance(e, str) or not isinstance(cid, int) or len(s) != len(e) ): continue sprefix = s[:-4] eprefix = e[:-4] if sprefix != eprefix: continue svar = s[-4:] evar = e[-4:] s1 = nunpack(svar) e1 = nunpack(evar) vlen = len(svar) # assert s1 <= e1, str((s1, e1)) for i in range(e1 - s1 + 1): x = sprefix + struct.pack(">L", s1 + i)[-vlen:] self.cmap.add_code2cid(x, cid + i) return if token is self.KEYWORD_BEGINCIDCHAR: self.popall() return if token is self.KEYWORD_ENDCIDCHAR: objs = [obj for (__, obj) in self.popall()] for cid, code in choplist(2, objs): if isinstance(code, str) and isinstance(cid, str): self.cmap.add_code2cid(code, nunpack(cid)) return if token is self.KEYWORD_BEGINBFRANGE: self.popall() return if token is self.KEYWORD_ENDBFRANGE: objs = [obj for (__, obj) in self.popall()] for s, e, code in choplist(3, objs): if not isinstance(s, bytes) or not isinstance(e, bytes) or len(s) != len(e): continue s1 = nunpack(s) e1 = nunpack(e) # assert s1 <= e1, str((s1, e1)) if isinstance(code, list): for i in range(e1 - s1 + 1): self.cmap.add_cid2unichr(s1 + i, code[i]) else: var = code[-4:] base = nunpack(var) prefix = code[:-4] vlen = len(var) for i in range(e1 - s1 + 1): x = prefix + struct.pack(">L", base + i)[-vlen:] self.cmap.add_cid2unichr(s1 + i, x) return if token is self.KEYWORD_BEGINBFCHAR: self.popall() return if token is self.KEYWORD_ENDBFCHAR: objs = [obj for (__, obj) in self.popall()] for cid, code in choplist(2, objs): if isinstance(cid, bytes) and isinstance(code, bytes): self.cmap.add_cid2unichr(nunpack(cid), code) return if token is self.KEYWORD_BEGINNOTDEFRANGE: self.popall() return if token is self.KEYWORD_ENDNOTDEFRANGE: self.popall() return self.push((pos, token)) return
https://github.com/pdfminer/pdfminer.six/issues/210
Traceback (most recent call last): File "/home/felix/anaconda3/bin/pdf2txt.py", line 136, in <module> if __name__ == '__main__': sys.exit(main()) File "/home/felix/anaconda3/bin/pdf2txt.py", line 131, in main outfp = extract_text(**vars(A)) File "/home/felix/anaconda3/bin/pdf2txt.py", line 63, in extract_text pdfminer.high_level.extract_text_to_fp(fp, **locals()) File "/home/felix/anaconda3/lib/python3.6/site-packages/pdfminer/high_level.py", line 82, in extract_text_to_fp interpreter.process_page(page) File "/home/felix/anaconda3/lib/python3.6/site-packages/pdfminer/pdfinterp.py", line 852, in process_page self.render_contents(page.resources, page.contents, ctm=ctm) File "/home/felix/anaconda3/lib/python3.6/site-packages/pdfminer/pdfinterp.py", line 862, in render_contents self.init_resources(resources) File "/home/felix/anaconda3/lib/python3.6/site-packages/pdfminer/pdfinterp.py", line 362, in init_resources self.fontmap[fontid] = self.rsrcmgr.get_font(objid, spec) File "/home/felix/anaconda3/lib/python3.6/site-packages/pdfminer/pdfinterp.py", line 212, in get_font font = self.get_font(None, subspec) File "/home/felix/anaconda3/lib/python3.6/site-packages/pdfminer/pdfinterp.py", line 203, in get_font font = PDFCIDFont(self, spec) File "/home/felix/anaconda3/lib/python3.6/site-packages/pdfminer/pdffont.py", line 658, in __init__ self.cmap = CMapDB.get_cmap(name) File "/home/felix/anaconda3/lib/python3.6/site-packages/pdfminer/cmapdb.py", line 259, in get_cmap data = klass._load_data(name) File "/home/felix/anaconda3/lib/python3.6/site-packages/pdfminer/cmapdb.py", line 233, in _load_data name = name.replace("\0", "") AttributeError: 'PDFStream' object has no attribute 'replace'
AttributeError
def main(argv): args = argv[1:] for fname in args: fp = open(fname, "rb") cmap = FileUnicodeMap() CMapParser(cmap, fp).run() fp.close() cmap.dump() return
def main(argv): args = argv[1:] for fname in args: fp = open(fname, "rb") cmap = FileUnicodeMap() # cmap = FileCMap() CMapParser(cmap, fp).run() fp.close() cmap.dump() return
https://github.com/pdfminer/pdfminer.six/issues/210
Traceback (most recent call last): File "/home/felix/anaconda3/bin/pdf2txt.py", line 136, in <module> if __name__ == '__main__': sys.exit(main()) File "/home/felix/anaconda3/bin/pdf2txt.py", line 131, in main outfp = extract_text(**vars(A)) File "/home/felix/anaconda3/bin/pdf2txt.py", line 63, in extract_text pdfminer.high_level.extract_text_to_fp(fp, **locals()) File "/home/felix/anaconda3/lib/python3.6/site-packages/pdfminer/high_level.py", line 82, in extract_text_to_fp interpreter.process_page(page) File "/home/felix/anaconda3/lib/python3.6/site-packages/pdfminer/pdfinterp.py", line 852, in process_page self.render_contents(page.resources, page.contents, ctm=ctm) File "/home/felix/anaconda3/lib/python3.6/site-packages/pdfminer/pdfinterp.py", line 862, in render_contents self.init_resources(resources) File "/home/felix/anaconda3/lib/python3.6/site-packages/pdfminer/pdfinterp.py", line 362, in init_resources self.fontmap[fontid] = self.rsrcmgr.get_font(objid, spec) File "/home/felix/anaconda3/lib/python3.6/site-packages/pdfminer/pdfinterp.py", line 212, in get_font font = self.get_font(None, subspec) File "/home/felix/anaconda3/lib/python3.6/site-packages/pdfminer/pdfinterp.py", line 203, in get_font font = PDFCIDFont(self, spec) File "/home/felix/anaconda3/lib/python3.6/site-packages/pdfminer/pdffont.py", line 658, in __init__ self.cmap = CMapDB.get_cmap(name) File "/home/felix/anaconda3/lib/python3.6/site-packages/pdfminer/cmapdb.py", line 259, in get_cmap data = klass._load_data(name) File "/home/felix/anaconda3/lib/python3.6/site-packages/pdfminer/cmapdb.py", line 233, in _load_data name = name.replace("\0", "") AttributeError: 'PDFStream' object has no attribute 'replace'
AttributeError
def decode(self, code): n = len(code) if n: return struct.unpack(">%dB" % n, code) else: return ()
def decode(self, code): n = len(code) // 2 if n: return struct.unpack(">%dH" % n, code) else: return ()
https://github.com/pdfminer/pdfminer.six/issues/210
Traceback (most recent call last): File "/home/felix/anaconda3/bin/pdf2txt.py", line 136, in <module> if __name__ == '__main__': sys.exit(main()) File "/home/felix/anaconda3/bin/pdf2txt.py", line 131, in main outfp = extract_text(**vars(A)) File "/home/felix/anaconda3/bin/pdf2txt.py", line 63, in extract_text pdfminer.high_level.extract_text_to_fp(fp, **locals()) File "/home/felix/anaconda3/lib/python3.6/site-packages/pdfminer/high_level.py", line 82, in extract_text_to_fp interpreter.process_page(page) File "/home/felix/anaconda3/lib/python3.6/site-packages/pdfminer/pdfinterp.py", line 852, in process_page self.render_contents(page.resources, page.contents, ctm=ctm) File "/home/felix/anaconda3/lib/python3.6/site-packages/pdfminer/pdfinterp.py", line 862, in render_contents self.init_resources(resources) File "/home/felix/anaconda3/lib/python3.6/site-packages/pdfminer/pdfinterp.py", line 362, in init_resources self.fontmap[fontid] = self.rsrcmgr.get_font(objid, spec) File "/home/felix/anaconda3/lib/python3.6/site-packages/pdfminer/pdfinterp.py", line 212, in get_font font = self.get_font(None, subspec) File "/home/felix/anaconda3/lib/python3.6/site-packages/pdfminer/pdfinterp.py", line 203, in get_font font = PDFCIDFont(self, spec) File "/home/felix/anaconda3/lib/python3.6/site-packages/pdfminer/pdffont.py", line 658, in __init__ self.cmap = CMapDB.get_cmap(name) File "/home/felix/anaconda3/lib/python3.6/site-packages/pdfminer/cmapdb.py", line 259, in get_cmap data = klass._load_data(name) File "/home/felix/anaconda3/lib/python3.6/site-packages/pdfminer/cmapdb.py", line 233, in _load_data name = name.replace("\0", "") AttributeError: 'PDFStream' object has no attribute 'replace'
AttributeError
def __init__(self, rsrcmgr, spec, strict=settings.STRICT): try: self.basefont = literal_name(spec["BaseFont"]) except KeyError: if strict: raise PDFFontError("BaseFont is missing") self.basefont = "unknown" self.cidsysteminfo = dict_value(spec.get("CIDSystemInfo", {})) self.cidcoding = "%s-%s" % ( resolve1(self.cidsysteminfo.get("Registry", b"unknown")).decode("latin1"), resolve1(self.cidsysteminfo.get("Ordering", b"unknown")).decode("latin1"), ) self.cmap = self.get_cmap_from_spec(spec, strict) try: descriptor = dict_value(spec["FontDescriptor"]) except KeyError: if strict: raise PDFFontError("FontDescriptor is missing") descriptor = {} ttf = None if "FontFile2" in descriptor: self.fontfile = stream_value(descriptor.get("FontFile2")) ttf = TrueTypeFont(self.basefont, BytesIO(self.fontfile.get_data())) self.unicode_map = None if "ToUnicode" in spec: strm = stream_value(spec["ToUnicode"]) self.unicode_map = FileUnicodeMap() CMapParser(self.unicode_map, BytesIO(strm.get_data())).run() elif self.cidcoding in ("Adobe-Identity", "Adobe-UCS"): if ttf: try: self.unicode_map = ttf.create_unicode_map() except TrueTypeFont.CMapNotFound: pass else: try: self.unicode_map = CMapDB.get_unicode_map( self.cidcoding, self.cmap.is_vertical() ) except CMapDB.CMapNotFound as e: pass self.vertical = self.cmap.is_vertical() if self.vertical: # writing mode: vertical widths = get_widths2(list_value(spec.get("W2", []))) self.disps = dict( (cid, (vx, vy)) for (cid, (_, (vx, vy))) in six.iteritems(widths) ) (vy, w) = spec.get("DW2", [880, -1000]) self.default_disp = (None, vy) widths = dict((cid, w) for (cid, (w, _)) in six.iteritems(widths)) default_width = w else: # writing mode: horizontal self.disps = {} self.default_disp = 0 widths = get_widths(list_value(spec.get("W", []))) default_width = spec.get("DW", 1000) PDFFont.__init__(self, descriptor, widths, default_width=default_width) return
def __init__(self, rsrcmgr, spec, strict=settings.STRICT): try: self.basefont = literal_name(spec["BaseFont"]) except KeyError: if strict: raise PDFFontError("BaseFont is missing") self.basefont = "unknown" self.cidsysteminfo = dict_value(spec.get("CIDSystemInfo", {})) self.cidcoding = "%s-%s" % ( resolve1(self.cidsysteminfo.get("Registry", b"unknown")).decode("latin1"), resolve1(self.cidsysteminfo.get("Ordering", b"unknown")).decode("latin1"), ) try: name = literal_name(spec["Encoding"]) except KeyError: if strict: raise PDFFontError("Encoding is unspecified") name = "unknown" try: self.cmap = CMapDB.get_cmap(name) except CMapDB.CMapNotFound as e: if strict: raise PDFFontError(e) self.cmap = CMap() try: descriptor = dict_value(spec["FontDescriptor"]) except KeyError: if strict: raise PDFFontError("FontDescriptor is missing") descriptor = {} ttf = None if "FontFile2" in descriptor: self.fontfile = stream_value(descriptor.get("FontFile2")) ttf = TrueTypeFont(self.basefont, BytesIO(self.fontfile.get_data())) self.unicode_map = None if "ToUnicode" in spec: strm = stream_value(spec["ToUnicode"]) self.unicode_map = FileUnicodeMap() CMapParser(self.unicode_map, BytesIO(strm.get_data())).run() elif self.cidcoding in ("Adobe-Identity", "Adobe-UCS"): if ttf: try: self.unicode_map = ttf.create_unicode_map() except TrueTypeFont.CMapNotFound: pass else: try: self.unicode_map = CMapDB.get_unicode_map( self.cidcoding, self.cmap.is_vertical() ) except CMapDB.CMapNotFound as e: pass self.vertical = self.cmap.is_vertical() if self.vertical: # writing mode: vertical widths = get_widths2(list_value(spec.get("W2", []))) self.disps = dict( (cid, (vx, vy)) for (cid, (_, (vx, vy))) in six.iteritems(widths) ) (vy, w) = spec.get("DW2", [880, -1000]) self.default_disp = (None, vy) widths = dict((cid, w) for (cid, (w, _)) in six.iteritems(widths)) default_width = w else: # writing mode: horizontal self.disps = {} self.default_disp = 0 widths = get_widths(list_value(spec.get("W", []))) default_width = spec.get("DW", 1000) PDFFont.__init__(self, descriptor, widths, default_width=default_width) return
https://github.com/pdfminer/pdfminer.six/issues/210
Traceback (most recent call last): File "/home/felix/anaconda3/bin/pdf2txt.py", line 136, in <module> if __name__ == '__main__': sys.exit(main()) File "/home/felix/anaconda3/bin/pdf2txt.py", line 131, in main outfp = extract_text(**vars(A)) File "/home/felix/anaconda3/bin/pdf2txt.py", line 63, in extract_text pdfminer.high_level.extract_text_to_fp(fp, **locals()) File "/home/felix/anaconda3/lib/python3.6/site-packages/pdfminer/high_level.py", line 82, in extract_text_to_fp interpreter.process_page(page) File "/home/felix/anaconda3/lib/python3.6/site-packages/pdfminer/pdfinterp.py", line 852, in process_page self.render_contents(page.resources, page.contents, ctm=ctm) File "/home/felix/anaconda3/lib/python3.6/site-packages/pdfminer/pdfinterp.py", line 862, in render_contents self.init_resources(resources) File "/home/felix/anaconda3/lib/python3.6/site-packages/pdfminer/pdfinterp.py", line 362, in init_resources self.fontmap[fontid] = self.rsrcmgr.get_font(objid, spec) File "/home/felix/anaconda3/lib/python3.6/site-packages/pdfminer/pdfinterp.py", line 212, in get_font font = self.get_font(None, subspec) File "/home/felix/anaconda3/lib/python3.6/site-packages/pdfminer/pdfinterp.py", line 203, in get_font font = PDFCIDFont(self, spec) File "/home/felix/anaconda3/lib/python3.6/site-packages/pdfminer/pdffont.py", line 658, in __init__ self.cmap = CMapDB.get_cmap(name) File "/home/felix/anaconda3/lib/python3.6/site-packages/pdfminer/cmapdb.py", line 259, in get_cmap data = klass._load_data(name) File "/home/felix/anaconda3/lib/python3.6/site-packages/pdfminer/cmapdb.py", line 233, in _load_data name = name.replace("\0", "") AttributeError: 'PDFStream' object has no attribute 'replace'
AttributeError
def main(argv): for fname in argv[1:]: fp = open(fname, "rb") font = CFFFont(fname, fp) print(font) fp.close() return
def main(argv): for fname in argv[1:]: fp = open(fname, "rb") # font = TrueTypeFont(fname, fp) font = CFFFont(fname, fp) print(font) fp.close() return
https://github.com/pdfminer/pdfminer.six/issues/210
Traceback (most recent call last): File "/home/felix/anaconda3/bin/pdf2txt.py", line 136, in <module> if __name__ == '__main__': sys.exit(main()) File "/home/felix/anaconda3/bin/pdf2txt.py", line 131, in main outfp = extract_text(**vars(A)) File "/home/felix/anaconda3/bin/pdf2txt.py", line 63, in extract_text pdfminer.high_level.extract_text_to_fp(fp, **locals()) File "/home/felix/anaconda3/lib/python3.6/site-packages/pdfminer/high_level.py", line 82, in extract_text_to_fp interpreter.process_page(page) File "/home/felix/anaconda3/lib/python3.6/site-packages/pdfminer/pdfinterp.py", line 852, in process_page self.render_contents(page.resources, page.contents, ctm=ctm) File "/home/felix/anaconda3/lib/python3.6/site-packages/pdfminer/pdfinterp.py", line 862, in render_contents self.init_resources(resources) File "/home/felix/anaconda3/lib/python3.6/site-packages/pdfminer/pdfinterp.py", line 362, in init_resources self.fontmap[fontid] = self.rsrcmgr.get_font(objid, spec) File "/home/felix/anaconda3/lib/python3.6/site-packages/pdfminer/pdfinterp.py", line 212, in get_font font = self.get_font(None, subspec) File "/home/felix/anaconda3/lib/python3.6/site-packages/pdfminer/pdfinterp.py", line 203, in get_font font = PDFCIDFont(self, spec) File "/home/felix/anaconda3/lib/python3.6/site-packages/pdfminer/pdffont.py", line 658, in __init__ self.cmap = CMapDB.get_cmap(name) File "/home/felix/anaconda3/lib/python3.6/site-packages/pdfminer/cmapdb.py", line 259, in get_cmap data = klass._load_data(name) File "/home/felix/anaconda3/lib/python3.6/site-packages/pdfminer/cmapdb.py", line 233, in _load_data name = name.replace("\0", "") AttributeError: 'PDFStream' object has no attribute 'replace'
AttributeError
def _prepare_requests(self): """Created the TTS API the request(s) without sending them. Returns: list: ``requests.PreparedRequests_``. <https://2.python-requests.org/en/master/api/#requests.PreparedRequest>`_``. """ # TTS API URL translate_url = _translate_url( tld=self.tld, path="_/TranslateWebserverUi/data/batchexecute" ) text_parts = self._tokenize(self.text) log.debug("text_parts: %s", str(text_parts)) log.debug("text_parts: %i", len(text_parts)) assert text_parts, "No text to send to TTS API" prepared_requests = [] for idx, part in enumerate(text_parts): data = self._package_rpc(part) log.debug("data-%i: %s", idx, data) # Request r = requests.Request( method="POST", url=translate_url, data=data, headers=self.GOOGLE_TTS_HEADERS ) # Prepare request prepared_requests.append(r.prepare()) return prepared_requests
def _prepare_requests(self): """Created the TTS API the request(s) without sending them. Returns: list: ``requests.PreparedRequests_``. <https://2.python-requests.org/en/master/api/#requests.PreparedRequest>`_``. """ # TTS API URL translate_url = _translate_url( tld=self.tld, path="_/TranslateWebserverUi/data/batchexecute" ) text_parts = self._tokenize(self.text) log.debug("text_parts: %i", len(text_parts)) assert text_parts, "No text to send to TTS API" prepared_requests = [] for idx, part in enumerate(text_parts): data = self._package_rpc() log.debug("data-%i: %s", idx, data) # Request r = requests.Request( method="POST", url=translate_url, data=data, headers=self.GOOGLE_TTS_HEADERS ) # Prepare request prepared_requests.append(r.prepare()) return prepared_requests
https://github.com/pndurette/gTTS/issues/252
Traceback (most recent call last): File "main.py", line 11, in <module> myobj.save("audiobook.mp3") File "/usr/local/lib/python3.8/dist-packages/gtts/tts.py", line 311, in save self.write_to_fp(f) File "/usr/local/lib/python3.8/dist-packages/gtts/tts.py", line 293, in write_to_fp raise gTTSError(tts=self, response=r) gtts.tts.gTTSError: 200 (OK) from TTS API. Probable cause: Unknown
gtts.tts.gTTSError
def _package_rpc(self, text): parameter = [text, self.lang, self.speed, "null"] escaped_parameter = json.dumps(parameter, separators=(",", ":")) rpc = [[[self.GOOGLE_TTS_RPC, escaped_parameter, None, "generic"]]] espaced_rpc = json.dumps(rpc, separators=(",", ":")) return "f.req={}&".format(quote(espaced_rpc))
def _package_rpc(self): parameter = [self.text, self.lang, self.speed, "null"] escaped_parameter = json.dumps(parameter, separators=(",", ":")) rpc = [[[self.GOOGLE_TTS_RPC, escaped_parameter, None, "generic"]]] espaced_rpc = json.dumps(rpc, separators=(",", ":")) return "f.req={}&".format(quote(espaced_rpc))
https://github.com/pndurette/gTTS/issues/252
Traceback (most recent call last): File "main.py", line 11, in <module> myobj.save("audiobook.mp3") File "/usr/local/lib/python3.8/dist-packages/gtts/tts.py", line 311, in save self.write_to_fp(f) File "/usr/local/lib/python3.8/dist-packages/gtts/tts.py", line 293, in write_to_fp raise gTTSError(tts=self, response=r) gtts.tts.gTTSError: 200 (OK) from TTS API. Probable cause: Unknown
gtts.tts.gTTSError
def __init__( self, name: str, permutation: Union[List[Union[int, np.int_]], np.ndarray] ): if not isinstance(name, str): raise TypeError("Gate name must be a string") if name in RESERVED_WORDS: raise ValueError( f"Cannot use {name} for a gate name since it's a reserved word" ) if not isinstance(permutation, (list, np.ndarray)): raise ValueError( f"Permutation must be a list or NumPy array, got value of type {type(permutation)}" ) permutation = np.asarray(permutation) ndim = permutation.ndim if 1 != ndim: raise ValueError(f"Permutation must have dimension 1, got {permutation.ndim}") elts = permutation.shape[0] if 0 != elts & (elts - 1): raise ValueError(f"Dimension of permutation must be a power of 2, got {elts}") self.name = name self.permutation = permutation self.parameters = None
def __init__( self, name: str, permutation: Union[List[Union[int, np.int_]], np.ndarray] ): if not isinstance(name, str): raise TypeError("Gate name must be a string") if name in RESERVED_WORDS: raise ValueError( "Cannot use {} for a gate name since it's a reserved word".format(name) ) if isinstance(permutation, list): elts = len(permutation) elif isinstance(permutation, np.ndarray): elts, cols = permutation.shape if cols != 1: raise ValueError("Permutation must have shape (N, 1)") else: raise ValueError("Permutation must be a list or NumPy array") if 0 != elts & (elts - 1): raise ValueError( "Dimension of permutation must be a power of 2, got {0}".format(elts) ) self.name = name self.permutation = np.asarray(permutation) self.parameters = None
https://github.com/rigetti/pyquil/issues/1223
import numpy as np from pyquil.quilbase import DefPermutationGate DefPermutationGate('MYGATE', [0, 1, 2, 3, 4, 5, 7, 6]) <pyquil.quilbase.DefPermutationGate object at 0x0000021D192D0820> DefPermutationGate('MYGATE', np.array([0, 1, 2, 3, 4, 5, 7, 6])) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "C:\Users\Username\.virtualenvs\venv-name\lib\site-packages\pyquil\quilbase.py", line 486, in __init__ elts, cols = permutation.shape ValueError: not enough values to unpack (expected 2, got 1) DefPermutationGate('MYGATE', np.array([0, 1, 2, 3, 4, 5, 7, 6]).reshape(-1, 1)) <pyquil.quilbase.DefPermutationGate object at 0x0000021D19759190>
ValueError
def load(self, executable): if isinstance(executable, PyQuilExecutableResponse): program = _extract_program_from_pyquil_executable_response(executable) else: program = executable # initialize program counter self.program = program self.program_counter = 0 self._memory_results = None # clear RAM, although it's not strictly clear if this should happen here self.ram = {} # if we're clearing RAM, we ought to clear the WF too self.wf_simulator.reset() # grab the gate definitions for future use self._extract_defined_gates() self.status = "loaded" return self
def load(self, executable): if isinstance(executable, PyQuilExecutableResponse): program = _extract_program_from_pyquil_executable_response(executable) else: program = executable # initialize program counter self.program = program self.program_counter = 0 self._memory_results = None # clear RAM, although it's not strictly clear if this should happen here self.ram = {} # if we're clearing RAM, we ought to clear the WF too self.wf_simulator.reset() # grab the gate definitions for future use self.defined_gates = dict() for dg in self.program.defined_gates: if dg.parameters is not None and len(dg.parameters) > 0: raise NotImplementedError("PyQVM does not support parameterized DEFGATEs") self.defined_gates[dg.name] = dg.matrix self.status = "loaded" return self
https://github.com/rigetti/pyquil/issues/1059
KeyError Traceback (most recent call last) <ipython-input-14-a45963b2b08a> in <module> ----> 1 qc.execute(p).wf_simulator.wf.flatten() ~/miniconda3/envs/py36/lib/python3.6/site-packages/pyquil/pyqvm.py in execute(self, program) 449 halted = len(program) == 0 450 while not halted: --> 451 halted = self.transition() 452 453 return self ~/miniconda3/envs/py36/lib/python3.6/site-packages/pyquil/pyqvm.py in transition(self) 282 qubits=[q.index for q in instruction.qubits]) 283 else: --> 284 self.wf_simulator.do_gate(gate=instruction) 285 286 for noise_type, noise_prob in self.post_gate_noise_probabilities.items(): ~/miniconda3/envs/py36/lib/python3.6/site-packages/pyquil/numpy_simulator.py in do_gate(self, gate) 266 :return: ``self`` to support method chaining. 267 """ --> 268 gate_matrix, qubit_inds = _get_gate_tensor_and_qubits(gate=gate) 269 # Note to developers: you can use either einsum- or tensordot- based functions. 270 # tensordot seems a little faster, but feel free to experiment. ~/miniconda3/envs/py36/lib/python3.6/site-packages/pyquil/numpy_simulator.py in _get_gate_tensor_and_qubits(gate) 160 """ 161 if len(gate.params) > 0: --> 162 matrix = QUANTUM_GATES[gate.name](*gate.params) 163 else: 164 matrix = QUANTUM_GATES[gate.name] KeyError: 'CRX'
KeyError
def run(self): self.status = "running" self._memory_results = {} for _ in range(self.program.num_shots): self.wf_simulator.reset() self._execute_program() for name in self.ram.keys(): self._memory_results.setdefault(name, list()) self._memory_results[name].append(self.ram[name]) # TODO: this will need to be removed in merge conflict with #873 self._bitstrings = self._memory_results["ro"] return self
def run(self): self.status = "running" self._memory_results = {} for _ in range(self.program.num_shots): self.wf_simulator.reset() self.execute(self.program) for name in self.ram.keys(): self._memory_results.setdefault(name, list()) self._memory_results[name].append(self.ram[name]) # TODO: this will need to be removed in merge conflict with #873 self._bitstrings = self._memory_results["ro"] return self
https://github.com/rigetti/pyquil/issues/1059
KeyError Traceback (most recent call last) <ipython-input-14-a45963b2b08a> in <module> ----> 1 qc.execute(p).wf_simulator.wf.flatten() ~/miniconda3/envs/py36/lib/python3.6/site-packages/pyquil/pyqvm.py in execute(self, program) 449 halted = len(program) == 0 450 while not halted: --> 451 halted = self.transition() 452 453 return self ~/miniconda3/envs/py36/lib/python3.6/site-packages/pyquil/pyqvm.py in transition(self) 282 qubits=[q.index for q in instruction.qubits]) 283 else: --> 284 self.wf_simulator.do_gate(gate=instruction) 285 286 for noise_type, noise_prob in self.post_gate_noise_probabilities.items(): ~/miniconda3/envs/py36/lib/python3.6/site-packages/pyquil/numpy_simulator.py in do_gate(self, gate) 266 :return: ``self`` to support method chaining. 267 """ --> 268 gate_matrix, qubit_inds = _get_gate_tensor_and_qubits(gate=gate) 269 # Note to developers: you can use either einsum- or tensordot- based functions. 270 # tensordot seems a little faster, but feel free to experiment. ~/miniconda3/envs/py36/lib/python3.6/site-packages/pyquil/numpy_simulator.py in _get_gate_tensor_and_qubits(gate) 160 """ 161 if len(gate.params) > 0: --> 162 matrix = QUANTUM_GATES[gate.name](*gate.params) 163 else: 164 matrix = QUANTUM_GATES[gate.name] KeyError: 'CRX'
KeyError
def execute(self, program: Program): """ Execute one outer loop of a program on the QVM. Note that the QAM is stateful. Subsequent calls to :py:func:`execute` will not automatically reset the wavefunction or the classical RAM. If this is desired, consider starting your program with ``RESET``. :return: ``self`` to support method chaining. """ self.program = program self._extract_defined_gates() return self._execute_program()
def execute(self, program: Program): """ Execute one outer loop of a program on the QVM. Note that the QAM is stateful. Subsequent calls to :py:func:`execute` will not automatically reset the wavefunction or the classical RAM. If this is desired, consider starting your program with ``RESET``. :return: ``self`` to support method chaining. """ # initialize program counter self.program = program self.program_counter = 0 halted = len(program) == 0 while not halted: halted = self.transition() return self
https://github.com/rigetti/pyquil/issues/1059
KeyError Traceback (most recent call last) <ipython-input-14-a45963b2b08a> in <module> ----> 1 qc.execute(p).wf_simulator.wf.flatten() ~/miniconda3/envs/py36/lib/python3.6/site-packages/pyquil/pyqvm.py in execute(self, program) 449 halted = len(program) == 0 450 while not halted: --> 451 halted = self.transition() 452 453 return self ~/miniconda3/envs/py36/lib/python3.6/site-packages/pyquil/pyqvm.py in transition(self) 282 qubits=[q.index for q in instruction.qubits]) 283 else: --> 284 self.wf_simulator.do_gate(gate=instruction) 285 286 for noise_type, noise_prob in self.post_gate_noise_probabilities.items(): ~/miniconda3/envs/py36/lib/python3.6/site-packages/pyquil/numpy_simulator.py in do_gate(self, gate) 266 :return: ``self`` to support method chaining. 267 """ --> 268 gate_matrix, qubit_inds = _get_gate_tensor_and_qubits(gate=gate) 269 # Note to developers: you can use either einsum- or tensordot- based functions. 270 # tensordot seems a little faster, but feel free to experiment. ~/miniconda3/envs/py36/lib/python3.6/site-packages/pyquil/numpy_simulator.py in _get_gate_tensor_and_qubits(gate) 160 """ 161 if len(gate.params) > 0: --> 162 matrix = QUANTUM_GATES[gate.name](*gate.params) 163 else: 164 matrix = QUANTUM_GATES[gate.name] KeyError: 'CRX'
KeyError
def body(circuit, settings): """ Return the body of the Latex document, including the entire circuit in TikZ format. :param Program circuit: The circuit to be drawn, represented as a pyquil program. :param dict settings: :return: Latex string to draw the entire circuit. :rtype: string """ qubit_instruction_mapping = {} # Allocate each qubit. for inst in circuit: if isinstance(inst, Measurement): inst.qubits = [inst.qubit] inst.name = "MEASURE" elif isinstance(inst, Gate): for qubit in inst.qubits: qubit_instruction_mapping[qubit.index] = [] for k, v in list(qubit_instruction_mapping.items()): v.append(command(ALLOCATE, [k], [], [k], k)) for inst in circuit: # Ignore everything that is neither a Gate nor a Measurement (e.g. a Pragma) if not isinstance(inst, Gate) and not isinstance(inst, Measurement): continue qubits = [qubit.index for qubit in inst.qubits] gate = inst.name # If this is a single qubit instruction. if len(qubits) == 1: for qubit in qubits: qubit_instruction_mapping[qubit].append( command(gate, [qubit], [], [qubit], qubit) ) # If this is a many-qubit operation. else: # All qubits explicitly involved in the gate. explicit_lines = [qubit for qubit in copy(qubits)] # All lines to consider that will run through this circuit element. all_lines = list(range(min(explicit_lines), max(explicit_lines) + 1)) # Include all lines that are in-use and in the range of lines used in this instruction. for line in all_lines: if line not in qubit_instruction_mapping.keys() and line in all_lines: all_lines.remove(line) for i, qubit in enumerate(all_lines): if gate == CZ: ctrl_lines = list(explicit_lines) ctrl_lines.remove(qubits[-1]) qubit_instruction_mapping[qubit].append( command(Z, list(all_lines), list(ctrl_lines), qubits[-1:], None) ) elif gate == CNOT: ctrl_lines = list(explicit_lines) ctrl_lines.remove(qubits[-1]) qubit_instruction_mapping[qubit].append( command(X, list(all_lines), list(ctrl_lines), qubits[-1:], None) ) else: qubit_instruction_mapping[qubit].append( command(gate, list(all_lines), [], list(explicit_lines), None) ) # Zero index, and remove gaps in spacing. relabeled_circuit = {} # Store a mapping so we can relabel command labels. index_map = {} for i, key in enumerate(sorted(qubit_instruction_mapping.keys())): relabeled_circuit[i] = qubit_instruction_mapping[key] index_map[key] = i for line in list(relabeled_circuit.values()): for cmd in line: for i, qubit in enumerate(cmd.lines): cmd.lines[i] = index_map[qubit] for i, qubit in enumerate(cmd.ctrl_lines): cmd.ctrl_lines[i] = index_map[qubit] for i, qubit in enumerate(cmd.target_lines): cmd.target_lines[i] = index_map[qubit] code_generator = CircuitTikzGenerator(settings) return code_generator.generate_circuit(relabeled_circuit)
def body(circuit, settings): """ Return the body of the Latex document, including the entire circuit in TikZ format. :param Program circuit: The circuit to be drawn, represented as a pyquil program. :param dict settings: :return: Latex string to draw the entire circuit. :rtype: string """ qubit_instruction_mapping = {} # Allocate each qubit. for inst in circuit: if isinstance(inst, Measurement): inst.qubits = [inst.qubit] inst.name = "MEASURE" else: qubits = inst.qubits for qubit in qubits: qubit_instruction_mapping[qubit.index] = [] for k, v in list(qubit_instruction_mapping.items()): v.append(command(ALLOCATE, [k], [], [k], k)) for inst in circuit: qubits = [qubit.index for qubit in inst.qubits] gate = inst.name # If this is a single qubit instruction. if len(qubits) == 1: for qubit in qubits: qubit_instruction_mapping[qubit].append( command(gate, [qubit], [], [qubit], qubit) ) # If this is a many-qubit operation. else: # All qubits explicitly involved in the gate. explicit_lines = [qubit for qubit in copy(qubits)] # All lines to consider that will run through this circuit element. all_lines = list(range(min(explicit_lines), max(explicit_lines) + 1)) # Include all lines that are in-use and in the range of lines used in this instruction. for line in all_lines: if line not in qubit_instruction_mapping.keys() and line in all_lines: all_lines.remove(line) for i, qubit in enumerate(all_lines): if gate == CZ: ctrl_lines = list(explicit_lines) ctrl_lines.remove(qubits[-1]) qubit_instruction_mapping[qubit].append( command(Z, list(all_lines), list(ctrl_lines), qubits[-1:], None) ) elif gate == CNOT: ctrl_lines = list(explicit_lines) ctrl_lines.remove(qubits[-1]) qubit_instruction_mapping[qubit].append( command(X, list(all_lines), list(ctrl_lines), qubits[-1:], None) ) else: qubit_instruction_mapping[qubit].append( command(gate, list(all_lines), [], list(explicit_lines), None) ) # Zero index, and remove gaps in spacing. relabeled_circuit = {} # Store a mapping so we can relabel command labels. index_map = {} for i, key in enumerate(sorted(qubit_instruction_mapping.keys())): relabeled_circuit[i] = qubit_instruction_mapping[key] index_map[key] = i for line in list(relabeled_circuit.values()): for cmd in line: for i, qubit in enumerate(cmd.lines): cmd.lines[i] = index_map[qubit] for i, qubit in enumerate(cmd.ctrl_lines): cmd.ctrl_lines[i] = index_map[qubit] for i, qubit in enumerate(cmd.target_lines): cmd.target_lines[i] = index_map[qubit] code_generator = CircuitTikzGenerator(settings) return code_generator.generate_circuit(relabeled_circuit)
https://github.com/rigetti/pyquil/issues/637
AttributeError Traceback (most recent call last) <ipython-input-26-d8bbe53f84fe> in <module> 1 test_p = Program("DECLARE beta REAL", "H 0") ----> 2 print(to_latex(test_p)) ~/anaconda3/envs/pyquil2/lib/python3.7/site-packages/pyquil/latex/latex_generation.py in to_latex(circuit, settings) 63 settings = get_default_settings() 64 text = header(settings) ---> 65 text += body(circuit, settings) 66 text += footer() 67 return text ~/anaconda3/envs/pyquil2/lib/python3.7/site-packages/pyquil/latex/latex_generation.py in body(circuit, settings) 87 inst.name = "MEASURE" 88 else: ---> 89 qubits = inst.qubits 90 for qubit in qubits: 91 qubit_instruction_mapping[qubit.index] = [] AttributeError: 'Declare' object has no attribute 'qubits'
AttributeError
def run_bell_high_level(n_shots=1000): # Step 1. Get a device. Either a QVM or a QPU qc = get_qc("9q-generic-qvm") q = [4, 5] # qubits # Step 2. Construct your program program = Program(H(q[0]), CNOT(q[0], q[1])) # Step 3. Run results = qc.run_and_measure(program, trials=n_shots) # Bincount bitstrings ints = sum(results[q[i]] * 2**i for i in range(len(q))) print("bincounts", np.bincount(ints)) # Check parity parities = (results[q[0]] + results[q[1]]) % 2 print("avg parity", np.mean(parities))
def run_bell_high_level(n_shots=1000): # Step 1. Get a device. Either a QVM or a QPU qc = get_qc("9q-generic-qvm") q = [4, 5] # qubits # Step 2. Construct your program program = Program(H(q[0]), CNOT(q[0], q[1])) # Step 3. Run bitstrings = qc.run_and_measure(program, trials=n_shots) # Bincount bitstrings basis = np.array([2**i for i in range(len(q))]) ints = np.sum(bitstrings * basis, axis=1) print("bincounts", np.bincount(ints)) # Check parity parities = np.sum(bitstrings, axis=1) % 2 print("avg parity", np.mean(parities))
https://github.com/rigetti/pyquil/issues/572
`ValueError: if c is a list/tuple, its first member should be a string Please enter number of sides: 60 --------------------------------------------------------------------------- ValueError Traceback (most recent call last) <ipython-input-30-d058bffa3dca> in <module>() 65 number_of_sides = int(input("Please enter number of sides: ")) 66 while True: ---> 67 print(roll_die(number_of_sides)) <ipython-input-30-d058bffa3dca> in roll_die(n) 52 addresses = list(range(qubits_needed(n))) 53 if not n in dice: ---> 54 dice[n] = die_program(n) 55 die = dice[n] 56 # Generate results and do rejection sampling. <ipython-input-30-d058bffa3dca> in die_program(n) 31 # Measure everything. 32 for q in range(qubits): ---> 33 prog.measure(q, [q]) 34 return prog 35 ~/anaconda3/lib/python3.6/site-packages/pyquil/quil.py in measure(self, qubit_index, classical_reg) 284 :rtype: Program 285 """ --> 286 return self.inst(MEASURE(qubit_index, classical_reg)) 287 288 def reset(self, qubit_index=None): ~/anaconda3/lib/python3.6/site-packages/pyquil/gates.py in MEASURE(qubit, classical_reg) 489 address = MemoryReference("ro", classical_reg) 490 else: --> 491 address = unpack_classical_reg(classical_reg) 492 return Measurement(qubit, address) 493 ~/anaconda3/lib/python3.6/site-packages/pyquil/quilatom.py in unpack_classical_reg(c) 137 c = (c[0], 0) 138 if not isinstance(c[0], str): --> 139 raise ValueError("if c is a list/tuple, its first member should be a string") 140 if not isinstance(c[1], int): 141 raise ValueError("if c is a list/tuple, its second member should be an int") ValueError: if c is a list/tuple, its first member should be a string `
ValueError
def run_bell_low_level(n_shots=1000): # Step 1. Get some device components qc = get_qc("9q-generic-qvm") compiler = qc.compiler qam = qc.qam del qc q = [4, 5] # qubits # Step 2. Construct your program program = Program() program += H(q[0]) program += CNOT(q[0], q[1]) # Step 2.1. Manage read-out memory ro = program.declare("ro", memory_type="BIT", memory_size="2") program += MEASURE(q[0], ro[0]) program += MEASURE(q[1], ro[1]) # Step 2.2. Run the program in a loop program = program.wrap_in_numshots_loop(n_shots) # Step 3. Compile and run nq_program = compiler.quil_to_native_quil(program) executable = compiler.native_quil_to_executable(nq_program) bitstrings = ( qam.load(executable).run().wait().read_from_memory_region(region_name="ro") ) # Bincount bitstrings basis = np.array([2**i for i in range(len(q))]) ints = np.sum(bitstrings * basis, axis=1) print("bincounts", np.bincount(ints)) # Check parity parities = np.sum(bitstrings, axis=1) % 2 print("avg parity", np.mean(parities))
def run_bell_low_level(n_shots=1000): # Step 1. Get some device components qc = get_qc("9q-generic-qvm") compiler = qc.compiler qam = qc.qam del qc q = [4, 5] # qubits # Step 2. Construct your program program = Program() program += H(q[0]) program += CNOT(q[0], q[1]) # Step 2.1. Manage read-out memory ro = program.declare("ro", memory_type="BIT", memory_size="2") program += MEASURE(q[0], ro[0]) program += MEASURE(q[1], ro[1]) # Step 2.2. Run the program in a loop program = program.wrap_in_numshots_loop(n_shots) # Step 3. Compile and run nq_program = compiler.quil_to_native_quil(program) executable = compiler.native_quil_to_executable(nq_program) bitstrings = ( qam.load(executable) .run() .wait() .read_from_memory_region(region_name="ro", offsets=True) ) # Bincount bitstrings basis = np.array([2**i for i in range(len(q))]) ints = np.sum(bitstrings * basis, axis=1) print("bincounts", np.bincount(ints)) # Check parity parities = np.sum(bitstrings, axis=1) % 2 print("avg parity", np.mean(parities))
https://github.com/rigetti/pyquil/issues/572
`ValueError: if c is a list/tuple, its first member should be a string Please enter number of sides: 60 --------------------------------------------------------------------------- ValueError Traceback (most recent call last) <ipython-input-30-d058bffa3dca> in <module>() 65 number_of_sides = int(input("Please enter number of sides: ")) 66 while True: ---> 67 print(roll_die(number_of_sides)) <ipython-input-30-d058bffa3dca> in roll_die(n) 52 addresses = list(range(qubits_needed(n))) 53 if not n in dice: ---> 54 dice[n] = die_program(n) 55 die = dice[n] 56 # Generate results and do rejection sampling. <ipython-input-30-d058bffa3dca> in die_program(n) 31 # Measure everything. 32 for q in range(qubits): ---> 33 prog.measure(q, [q]) 34 return prog 35 ~/anaconda3/lib/python3.6/site-packages/pyquil/quil.py in measure(self, qubit_index, classical_reg) 284 :rtype: Program 285 """ --> 286 return self.inst(MEASURE(qubit_index, classical_reg)) 287 288 def reset(self, qubit_index=None): ~/anaconda3/lib/python3.6/site-packages/pyquil/gates.py in MEASURE(qubit, classical_reg) 489 address = MemoryReference("ro", classical_reg) 490 else: --> 491 address = unpack_classical_reg(classical_reg) 492 return Measurement(qubit, address) 493 ~/anaconda3/lib/python3.6/site-packages/pyquil/quilatom.py in unpack_classical_reg(c) 137 c = (c[0], 0) 138 if not isinstance(c[0], str): --> 139 raise ValueError("if c is a list/tuple, its first member should be a string") 140 if not isinstance(c[1], int): 141 raise ValueError("if c is a list/tuple, its second member should be an int") ValueError: if c is a list/tuple, its first member should be a string `
ValueError
def meyer_penny_program(): """ Returns the program to simulate the Meyer-Penny Game The full description is available in docs/source/examples.rst :return: pyQuil Program """ prog = pq.Program() ro = prog.declare("ro") picard_register = ro[1] answer_register = ro[0] then_branch = pq.Program(X(0)) else_branch = pq.Program(I(0)) # Prepare Qubits in Heads state or superposition, respectively prog.inst(X(0), H(1)) # Q puts the coin into a superposition prog.inst(H(0)) # Picard makes a decision and acts accordingly prog.measure(1, picard_register) prog.if_then(picard_register, then_branch, else_branch) # Q undoes his superposition operation prog.inst(H(0)) # The outcome is recorded into the answer register prog.measure(0, answer_register) return prog
def meyer_penny_program(): """ Returns the program to simulate the Meyer-Penny Game The full description is available in docs/source/examples.rst :return: pyQuil Program """ picard_register = 1 answer_register = 0 then_branch = pq.Program(X(0)) else_branch = pq.Program(I(0)) return ( pq.Program() # Prepare Qubits in Heads state or superposition, respectively .inst(X(0), H(1)) # Q puts the coin into a superposition .inst(H(0)) # Picard makes a decision and acts accordingly .measure(1, picard_register) .if_then(picard_register, then_branch, else_branch) # Q undoes his superposition operation .inst(H(0)) # The outcome is recorded into the answer register .measure(0, answer_register) )
https://github.com/rigetti/pyquil/issues/572
`ValueError: if c is a list/tuple, its first member should be a string Please enter number of sides: 60 --------------------------------------------------------------------------- ValueError Traceback (most recent call last) <ipython-input-30-d058bffa3dca> in <module>() 65 number_of_sides = int(input("Please enter number of sides: ")) 66 while True: ---> 67 print(roll_die(number_of_sides)) <ipython-input-30-d058bffa3dca> in roll_die(n) 52 addresses = list(range(qubits_needed(n))) 53 if not n in dice: ---> 54 dice[n] = die_program(n) 55 die = dice[n] 56 # Generate results and do rejection sampling. <ipython-input-30-d058bffa3dca> in die_program(n) 31 # Measure everything. 32 for q in range(qubits): ---> 33 prog.measure(q, [q]) 34 return prog 35 ~/anaconda3/lib/python3.6/site-packages/pyquil/quil.py in measure(self, qubit_index, classical_reg) 284 :rtype: Program 285 """ --> 286 return self.inst(MEASURE(qubit_index, classical_reg)) 287 288 def reset(self, qubit_index=None): ~/anaconda3/lib/python3.6/site-packages/pyquil/gates.py in MEASURE(qubit, classical_reg) 489 address = MemoryReference("ro", classical_reg) 490 else: --> 491 address = unpack_classical_reg(classical_reg) 492 return Measurement(qubit, address) 493 ~/anaconda3/lib/python3.6/site-packages/pyquil/quilatom.py in unpack_classical_reg(c) 137 c = (c[0], 0) 138 if not isinstance(c[0], str): --> 139 raise ValueError("if c is a list/tuple, its first member should be a string") 140 if not isinstance(c[1], int): 141 raise ValueError("if c is a list/tuple, its second member should be an int") ValueError: if c is a list/tuple, its first member should be a string `
ValueError
def qaoa_ansatz(gammas, betas): """ Function that returns a QAOA ansatz program for a list of angles betas and gammas. len(betas) == len(gammas) == P for a QAOA program of order P. :param list(float) gammas: Angles over which to parameterize the cost Hamiltonian. :param list(float) betas: Angles over which to parameterize the driver Hamiltonian. :return: The QAOA ansatz program. :rtype: Program. """ return Program( [ exponentiate_commuting_pauli_sum(h_cost)(g) + exponentiate_commuting_pauli_sum(h_driver)(b) for g, b in zip(gammas, betas) ] )
def qaoa_ansatz(gammas, betas): """ Function that returns a QAOA ansatz program for a list of angles betas and gammas. len(betas) == len(gammas) == P for a QAOA program of order P. :param list(float) gammas: Angles over which to parameterize the cost Hamiltonian. :param list(float) betas: Angles over which to parameterize the driver Hamiltonian. :return: The QAOA ansatz program. :rtype: Program. """ return Program( [ exponentiate_commuting_pauli_sum(h_cost)(g) + exponentiate_commuting_pauli_sum(h_driver)(b) for g, b in zip(gammas, betas) ] )
https://github.com/rigetti/pyquil/issues/572
`ValueError: if c is a list/tuple, its first member should be a string Please enter number of sides: 60 --------------------------------------------------------------------------- ValueError Traceback (most recent call last) <ipython-input-30-d058bffa3dca> in <module>() 65 number_of_sides = int(input("Please enter number of sides: ")) 66 while True: ---> 67 print(roll_die(number_of_sides)) <ipython-input-30-d058bffa3dca> in roll_die(n) 52 addresses = list(range(qubits_needed(n))) 53 if not n in dice: ---> 54 dice[n] = die_program(n) 55 die = dice[n] 56 # Generate results and do rejection sampling. <ipython-input-30-d058bffa3dca> in die_program(n) 31 # Measure everything. 32 for q in range(qubits): ---> 33 prog.measure(q, [q]) 34 return prog 35 ~/anaconda3/lib/python3.6/site-packages/pyquil/quil.py in measure(self, qubit_index, classical_reg) 284 :rtype: Program 285 """ --> 286 return self.inst(MEASURE(qubit_index, classical_reg)) 287 288 def reset(self, qubit_index=None): ~/anaconda3/lib/python3.6/site-packages/pyquil/gates.py in MEASURE(qubit, classical_reg) 489 address = MemoryReference("ro", classical_reg) 490 else: --> 491 address = unpack_classical_reg(classical_reg) 492 return Measurement(qubit, address) 493 ~/anaconda3/lib/python3.6/site-packages/pyquil/quilatom.py in unpack_classical_reg(c) 137 c = (c[0], 0) 138 if not isinstance(c[0], str): --> 139 raise ValueError("if c is a list/tuple, its first member should be a string") 140 if not isinstance(c[1], int): 141 raise ValueError("if c is a list/tuple, its second member should be an int") ValueError: if c is a list/tuple, its first member should be a string `
ValueError
def die_program(n): """ Generate a quantum program to roll a die of n faces. """ prog = pq.Program() ro = prog.declare("ro") qubits = qubits_needed(n) # Hadamard initialize. for q in range(qubits): prog.inst(H(q)) # Measure everything. for q in range(qubits): prog.measure(q, ro[q]) return prog
def die_program(n): """ Generate a quantum program to roll a die of n faces. """ prog = pq.Program() qubits = qubits_needed(n) # Hadamard initialize. for q in range(qubits): prog.inst(H(q)) # Measure everything. for q in range(qubits): prog.measure(q, [q]) return prog
https://github.com/rigetti/pyquil/issues/572
`ValueError: if c is a list/tuple, its first member should be a string Please enter number of sides: 60 --------------------------------------------------------------------------- ValueError Traceback (most recent call last) <ipython-input-30-d058bffa3dca> in <module>() 65 number_of_sides = int(input("Please enter number of sides: ")) 66 while True: ---> 67 print(roll_die(number_of_sides)) <ipython-input-30-d058bffa3dca> in roll_die(n) 52 addresses = list(range(qubits_needed(n))) 53 if not n in dice: ---> 54 dice[n] = die_program(n) 55 die = dice[n] 56 # Generate results and do rejection sampling. <ipython-input-30-d058bffa3dca> in die_program(n) 31 # Measure everything. 32 for q in range(qubits): ---> 33 prog.measure(q, [q]) 34 return prog 35 ~/anaconda3/lib/python3.6/site-packages/pyquil/quil.py in measure(self, qubit_index, classical_reg) 284 :rtype: Program 285 """ --> 286 return self.inst(MEASURE(qubit_index, classical_reg)) 287 288 def reset(self, qubit_index=None): ~/anaconda3/lib/python3.6/site-packages/pyquil/gates.py in MEASURE(qubit, classical_reg) 489 address = MemoryReference("ro", classical_reg) 490 else: --> 491 address = unpack_classical_reg(classical_reg) 492 return Measurement(qubit, address) 493 ~/anaconda3/lib/python3.6/site-packages/pyquil/quilatom.py in unpack_classical_reg(c) 137 c = (c[0], 0) 138 if not isinstance(c[0], str): --> 139 raise ValueError("if c is a list/tuple, its first member should be a string") 140 if not isinstance(c[1], int): 141 raise ValueError("if c is a list/tuple, its second member should be an int") ValueError: if c is a list/tuple, its first member should be a string `
ValueError
def roll_die(n): """ Roll an n-sided quantum die. """ addresses = list(range(qubits_needed(n))) if n not in dice: dice[n] = die_program(n) die = dice[n] # Generate results and do rejection sampling. while True: results = qvm.run(die, addresses, BATCH_SIZE) for r in results: x = process_result(r) + 1 if 0 < x <= n: return x
def roll_die(n): """ Roll an n-sided quantum die. """ addresses = list(range(qubits_needed(n))) if not n in dice: dice[n] = die_program(n) die = dice[n] # Generate results and do rejection sampling. while True: results = qvm.run(die, addresses, BATCH_SIZE) for r in results: x = process_result(r) + 1 if 0 < x <= n: return x
https://github.com/rigetti/pyquil/issues/572
`ValueError: if c is a list/tuple, its first member should be a string Please enter number of sides: 60 --------------------------------------------------------------------------- ValueError Traceback (most recent call last) <ipython-input-30-d058bffa3dca> in <module>() 65 number_of_sides = int(input("Please enter number of sides: ")) 66 while True: ---> 67 print(roll_die(number_of_sides)) <ipython-input-30-d058bffa3dca> in roll_die(n) 52 addresses = list(range(qubits_needed(n))) 53 if not n in dice: ---> 54 dice[n] = die_program(n) 55 die = dice[n] 56 # Generate results and do rejection sampling. <ipython-input-30-d058bffa3dca> in die_program(n) 31 # Measure everything. 32 for q in range(qubits): ---> 33 prog.measure(q, [q]) 34 return prog 35 ~/anaconda3/lib/python3.6/site-packages/pyquil/quil.py in measure(self, qubit_index, classical_reg) 284 :rtype: Program 285 """ --> 286 return self.inst(MEASURE(qubit_index, classical_reg)) 287 288 def reset(self, qubit_index=None): ~/anaconda3/lib/python3.6/site-packages/pyquil/gates.py in MEASURE(qubit, classical_reg) 489 address = MemoryReference("ro", classical_reg) 490 else: --> 491 address = unpack_classical_reg(classical_reg) 492 return Measurement(qubit, address) 493 ~/anaconda3/lib/python3.6/site-packages/pyquil/quilatom.py in unpack_classical_reg(c) 137 c = (c[0], 0) 138 if not isinstance(c[0], str): --> 139 raise ValueError("if c is a list/tuple, its first member should be a string") 140 if not isinstance(c[1], int): 141 raise ValueError("if c is a list/tuple, its second member should be an int") ValueError: if c is a list/tuple, its first member should be a string `
ValueError
def teleport(start_index, end_index, ancilla_index): """Teleport a qubit from start to end using an ancilla qubit""" program = make_bell_pair(end_index, ancilla_index) ro = program.declare("ro") # do the teleportation program.inst(CNOT(start_index, ancilla_index)) program.inst(H(start_index)) # measure the results and store them in classical registers [0] and [1] program.measure(start_index, ro[0]) program.measure(ancilla_index, ro[1]) program.if_then(ro[1], X(2)) program.if_then(ro[0], Z(2)) program.measure(end_index, ro[2]) print(program) return program
def teleport(start_index, end_index, ancilla_index): """Teleport a qubit from start to end using an ancilla qubit""" program = make_bell_pair(end_index, ancilla_index) # do the teleportation program.inst(CNOT(start_index, ancilla_index)) program.inst(H(start_index)) # measure the results and store them in classical registers [0] and [1] program.measure(start_index, 0) program.measure(ancilla_index, 1) program.if_then(1, X(2)) program.if_then(0, Z(2)) program.measure(end_index, 2) return program
https://github.com/rigetti/pyquil/issues/572
`ValueError: if c is a list/tuple, its first member should be a string Please enter number of sides: 60 --------------------------------------------------------------------------- ValueError Traceback (most recent call last) <ipython-input-30-d058bffa3dca> in <module>() 65 number_of_sides = int(input("Please enter number of sides: ")) 66 while True: ---> 67 print(roll_die(number_of_sides)) <ipython-input-30-d058bffa3dca> in roll_die(n) 52 addresses = list(range(qubits_needed(n))) 53 if not n in dice: ---> 54 dice[n] = die_program(n) 55 die = dice[n] 56 # Generate results and do rejection sampling. <ipython-input-30-d058bffa3dca> in die_program(n) 31 # Measure everything. 32 for q in range(qubits): ---> 33 prog.measure(q, [q]) 34 return prog 35 ~/anaconda3/lib/python3.6/site-packages/pyquil/quil.py in measure(self, qubit_index, classical_reg) 284 :rtype: Program 285 """ --> 286 return self.inst(MEASURE(qubit_index, classical_reg)) 287 288 def reset(self, qubit_index=None): ~/anaconda3/lib/python3.6/site-packages/pyquil/gates.py in MEASURE(qubit, classical_reg) 489 address = MemoryReference("ro", classical_reg) 490 else: --> 491 address = unpack_classical_reg(classical_reg) 492 return Measurement(qubit, address) 493 ~/anaconda3/lib/python3.6/site-packages/pyquil/quilatom.py in unpack_classical_reg(c) 137 c = (c[0], 0) 138 if not isinstance(c[0], str): --> 139 raise ValueError("if c is a list/tuple, its first member should be a string") 140 if not isinstance(c[1], int): 141 raise ValueError("if c is a list/tuple, its second member should be an int") ValueError: if c is a list/tuple, its first member should be a string `
ValueError
def declare( self, name, memory_type="BIT", memory_size=1, shared_region=None, offsets=None ): """DECLARE a quil variable This adds the declaration to the current program and returns a MemoryReference to the base (offset = 0) of the declared memory. .. note:: This function returns a MemoryReference and cannot be chained like some of the other Program methods. Consider using ``inst(DECLARE(...))`` if you would like to chain methods, but please be aware that you must create your own MemoryReferences later on. :param name: Name of the declared variable :param memory_type: Type of the declared variable :param memory_size: Number of array elements in the declared memory. :param shared_region: You can declare a variable that shares its underlying memory with another region. This allows aliasing. For example, you can interpret an array of measured bits as an integer. :param offsets: If you are using ``shared_region``, this allows you to share only a part of the parent region. The offset is given by an array type and the number of elements of that type. For example, ``DECLARE target-bit BIT SHARING real-region OFFSET 1 REAL 4 BIT`` will let you use target-bit to poke into the fourth bit of the second real from the leading edge of real-region. :return: a MemoryReference to the start of the declared memory region, ie a memory reference to ``name[0]``. """ self.inst( Declare( name=name, memory_type=memory_type, memory_size=memory_size, shared_region=shared_region, offsets=offsets, ) ) return MemoryReference(name=name, declared_size=memory_size)
def declare(self, name, memory_type, memory_size=1, shared_region=None, offsets=None): """DECLARE a quil variable This adds the declaration to the current program and returns a MemoryReference to the base (offset = 0) of the declared memory. .. note:: This function returns a MemoryReference and cannot be chained like some of the other Program methods. Consider using ``inst(DECLARE(...))`` if you would like to chain methods, but please be aware that you must create your own MemoryReferences later on. :param name: Name of the declared variable :param memory_type: Type of the declared variable :param memory_size: Number of array elements in the declared memory. :param shared_region: You can declare a variable that shares its underlying memory with another region. This allows aliasing. For example, you can interpret an array of measured bits as an integer. :param offsets: If you are using ``shared_region``, this allows you to share only a part of the parent region. The offset is given by an array type and the number of elements of that type. For example, ``DECLARE target-bit BIT SHARING real-region OFFSET 1 REAL 4 BIT`` will let you use target-bit to poke into the fourth bit of the second real from the leading edge of real-region. :return: a MemoryReference to the start of the declared memory region, ie a memory reference to ``name[0]``. """ self.inst( Declare( name=name, memory_type=memory_type, memory_size=memory_size, shared_region=shared_region, offsets=offsets, ) ) return MemoryReference(name=name, declared_size=memory_size)
https://github.com/rigetti/pyquil/issues/572
`ValueError: if c is a list/tuple, its first member should be a string Please enter number of sides: 60 --------------------------------------------------------------------------- ValueError Traceback (most recent call last) <ipython-input-30-d058bffa3dca> in <module>() 65 number_of_sides = int(input("Please enter number of sides: ")) 66 while True: ---> 67 print(roll_die(number_of_sides)) <ipython-input-30-d058bffa3dca> in roll_die(n) 52 addresses = list(range(qubits_needed(n))) 53 if not n in dice: ---> 54 dice[n] = die_program(n) 55 die = dice[n] 56 # Generate results and do rejection sampling. <ipython-input-30-d058bffa3dca> in die_program(n) 31 # Measure everything. 32 for q in range(qubits): ---> 33 prog.measure(q, [q]) 34 return prog 35 ~/anaconda3/lib/python3.6/site-packages/pyquil/quil.py in measure(self, qubit_index, classical_reg) 284 :rtype: Program 285 """ --> 286 return self.inst(MEASURE(qubit_index, classical_reg)) 287 288 def reset(self, qubit_index=None): ~/anaconda3/lib/python3.6/site-packages/pyquil/gates.py in MEASURE(qubit, classical_reg) 489 address = MemoryReference("ro", classical_reg) 490 else: --> 491 address = unpack_classical_reg(classical_reg) 492 return Measurement(qubit, address) 493 ~/anaconda3/lib/python3.6/site-packages/pyquil/quilatom.py in unpack_classical_reg(c) 137 c = (c[0], 0) 138 if not isinstance(c[0], str): --> 139 raise ValueError("if c is a list/tuple, its first member should be a string") 140 if not isinstance(c[1], int): 141 raise ValueError("if c is a list/tuple, its second member should be an int") ValueError: if c is a list/tuple, its first member should be a string `
ValueError
def load(self, executable): """ Initialize a QAM into a fresh state. :param executable: Load a compiled executable onto the QAM. """ if self.status == "loaded": warnings.warn("Overwriting previously loaded executable.") assert self.status in ["connected", "done", "loaded"] self._variables_shim = {} self._executable = executable self._bitstrings = None self.status = "loaded" return self
def load(self, executable): """ Initialize a QAM into a fresh state. :param executable: Load a compiled executable onto the QAM. """ assert self.status in ["connected", "done"] self._variables_shim = {} self._executable = executable self._bitstrings = None self.status = "loaded" return self
https://github.com/rigetti/pyquil/issues/580
Traceback (most recent call last): File "tmp.py", line 13, in <module> print(qvm.run(p)) File "/usr/local/lib/python3.7/site-packages/pyquil/api/_error_reporting.py", line 234, in wrapper val = func(*args, **kwargs) File "/usr/local/lib/python3.7/site-packages/pyquil/api/_quantum_computer.py", line 123, in run return self.qam.load(executable) \ File "/usr/local/lib/python3.7/site-packages/pyquil/api/_error_reporting.py", line 234, in wrapper val = func(*args, **kwargs) File "/usr/local/lib/python3.7/site-packages/pyquil/api/_qvm.py", line 445, in run random_seed=self.random_seed)['ro'] KeyError: 'ro'
KeyError
def run(self): """ Run a pyquil program on the QPU. This formats the classified data from the QPU server by stacking measured bits into an array of shape (trials, classical_addresses). The mapping of qubit to classical address is backed out from MEASURE instructions in the program, so only do measurements where there is a 1-to-1 mapping between qubits and classical addresses. :return: The QPU object itself. """ super().run() request = QPURequest( program=self._executable.program, patch_values=self._build_patch_values(), id=str(uuid.uuid4()), ) job_id = self.client.call("execute_qpu_request", request=request, user=self.user) results = self._get_buffers(job_id) ro_sources = self._executable.ro_sources if results: bitstrings = _extract_bitstrings(ro_sources, results) elif not ro_sources: warnings.warn( "You are running a QPU program with no MEASURE instructions. " "The result of this program will always be an empty array. Are " "you sure you didn't mean to measure some of your qubits?" ) bitstrings = np.zeros((0, 0), dtype=np.int64) else: bitstrings = None self._bitstrings = bitstrings self._last_results = results return self
def run(self): """ Run a pyquil program on the QPU. This formats the classified data from the QPU server by stacking measured bits into an array of shape (trials, classical_addresses). The mapping of qubit to classical address is backed out from MEASURE instructions in the program, so only do measurements where there is a 1-to-1 mapping between qubits and classical addresses. :return: The QPU object itself. """ super().run() request = QPURequest( program=self._executable.program, patch_values=self._build_patch_values(), id=str(uuid.uuid4()), ) job_id = self.client.call("execute_qpu_request", request=request, user=self.user) results = self._get_buffers(job_id) ro_sources = self._executable.ro_sources if results: bitstrings = _extract_bitstrings(ro_sources, results) else: bitstrings = None self._bitstrings = bitstrings self._last_results = results return self
https://github.com/rigetti/pyquil/issues/580
Traceback (most recent call last): File "tmp.py", line 13, in <module> print(qvm.run(p)) File "/usr/local/lib/python3.7/site-packages/pyquil/api/_error_reporting.py", line 234, in wrapper val = func(*args, **kwargs) File "/usr/local/lib/python3.7/site-packages/pyquil/api/_quantum_computer.py", line 123, in run return self.qam.load(executable) \ File "/usr/local/lib/python3.7/site-packages/pyquil/api/_error_reporting.py", line 234, in wrapper val = func(*args, **kwargs) File "/usr/local/lib/python3.7/site-packages/pyquil/api/_qvm.py", line 445, in run random_seed=self.random_seed)['ro'] KeyError: 'ro'
KeyError
def run(self): """ Run a Quil program on the QVM multiple times and return the values stored in the classical registers designated by the classical_addresses parameter. :return: An array of bitstrings of shape ``(trials, len(classical_addresses))`` """ super().run() if isinstance(self._executable, PyQuilExecutableResponse): quil_program = _extract_program_from_pyquil_executable_response( self._executable ) elif isinstance(self._executable, Program): quil_program = self._executable else: raise TypeError( "quil_binary argument must be a PyQuilExecutableResponse or a Program." "This error is typically triggered by forgetting to pass (nativized)" "Quil to native_quil_to_executable or by using a compiler meant to be" "used for jobs bound for a QPU." ) trials = quil_program.num_shots classical_addresses = get_classical_addresses_from_program(quil_program) if self.noise_model is not None: quil_program = apply_noise_model(quil_program, self.noise_model) quil_program = self.augment_program_with_memory_values(quil_program) try: self._bitstrings = self.connection._qvm_run( quil_program=quil_program, classical_addresses=classical_addresses, trials=trials, measurement_noise=self.measurement_noise, gate_noise=self.gate_noise, random_seed=self.random_seed, )["ro"] except KeyError: warnings.warn( "You are running a QVM program with no MEASURE instructions. " "The result of this program will always be an empty array. Are " "you sure you didn't mean to measure some of your qubits?" ) self._bitstrings = np.zeros((trials, 0), dtype=np.int64) return self
def run(self): """ Run a Quil program on the QVM multiple times and return the values stored in the classical registers designated by the classical_addresses parameter. :return: An array of bitstrings of shape ``(trials, len(classical_addresses))`` """ super().run() if isinstance(self._executable, PyQuilExecutableResponse): quil_program = _extract_program_from_pyquil_executable_response( self._executable ) elif isinstance(self._executable, Program): quil_program = self._executable else: raise TypeError( "quil_binary argument must be a PyQuilExecutableResponse or a Program." "This error is typically triggered by forgetting to pass (nativized)" "Quil to native_quil_to_executable or by using a compiler meant to be" "used for jobs bound for a QPU." ) trials = quil_program.num_shots classical_addresses = get_classical_addresses_from_program(quil_program) if self.noise_model is not None: quil_program = apply_noise_model(quil_program, self.noise_model) quil_program = self.augment_program_with_memory_values(quil_program) self._bitstrings = self.connection._qvm_run( quil_program=quil_program, classical_addresses=classical_addresses, trials=trials, measurement_noise=self.measurement_noise, gate_noise=self.gate_noise, random_seed=self.random_seed, )["ro"] return self
https://github.com/rigetti/pyquil/issues/580
Traceback (most recent call last): File "tmp.py", line 13, in <module> print(qvm.run(p)) File "/usr/local/lib/python3.7/site-packages/pyquil/api/_error_reporting.py", line 234, in wrapper val = func(*args, **kwargs) File "/usr/local/lib/python3.7/site-packages/pyquil/api/_quantum_computer.py", line 123, in run return self.qam.load(executable) \ File "/usr/local/lib/python3.7/site-packages/pyquil/api/_error_reporting.py", line 234, in wrapper val = func(*args, **kwargs) File "/usr/local/lib/python3.7/site-packages/pyquil/api/_qvm.py", line 445, in run random_seed=self.random_seed)['ro'] KeyError: 'ro'
KeyError
def dagger(self, inv_dict=None, suffix="-INV"): """ Creates the conjugate transpose of the Quil program. The program must not contain any irreversible actions (measurement, control flow, qubit allocation). :return: The Quil program's inverse :rtype: Program """ if not self.is_protoquil(): raise ValueError("Program must be valid Protoquil") daggered = Program() for gate in self._defined_gates: if inv_dict is None or gate.name not in inv_dict: if gate.parameters: raise TypeError( "Cannot auto define daggered version of parameterized gates" ) daggered.defgate(gate.name + suffix, gate.matrix.T.conj()) for gate in reversed(self._instructions): if gate.name in STANDARD_GATES: if gate.name == "S": daggered.inst(STANDARD_GATES["PHASE"](-pi / 2, *gate.qubits)) elif gate.name == "T": daggered.inst(STANDARD_GATES["RZ"](pi / 4, *gate.qubits)) elif gate.name == "ISWAP": daggered.inst(STANDARD_GATES["PSWAP"](pi / 2, *gate.qubits)) else: negated_params = list(map(lambda x: -1 * x, gate.params)) daggered.inst( STANDARD_GATES[gate.name](*(negated_params + gate.qubits)) ) else: if inv_dict is None or gate.name not in inv_dict: gate_inv_name = gate.name + suffix else: gate_inv_name = inv_dict[gate.name] daggered.inst(Gate(gate_inv_name, gate.params, gate.qubits)) return daggered
def dagger(self, inv_dict=None, suffix="-INV"): """ Creates the conjugate transpose of the Quil program. The program must not contain any irreversible actions (measurement, control flow, qubit allocation). :return: The Quil program's inverse :rtype: Program """ if not self.is_protoquil(): raise ValueError("Program must be valid Protoquil") daggered = Program() for gate in self._defined_gates: if inv_dict is None or gate.name not in inv_dict: daggered.defgate(gate.name + suffix, gate.matrix.T.conj()) for gate in reversed(self._instructions): if gate.name in STANDARD_GATES: if gate.name == "S": daggered.inst(STANDARD_GATES["PHASE"](-pi / 2, *gate.qubits)) elif gate.name == "T": daggered.inst(STANDARD_GATES["RZ"](pi / 4, *gate.qubits)) elif gate.name == "ISWAP": daggered.inst(STANDARD_GATES["PSWAP"](pi / 2, *gate.qubits)) else: negated_params = list(map(lambda x: -1 * x, gate.params)) daggered.inst( STANDARD_GATES[gate.name](*(negated_params + gate.qubits)) ) else: if inv_dict is None or gate.name not in inv_dict: gate_inv_name = gate.name + suffix else: gate_inv_name = inv_dict[gate.name] daggered.inst(tuple([gate_inv_name] + gate.qubits)) return daggered
https://github.com/rigetti/pyquil/issues/304
DEFGATE CRY(%theta): 1, 0, 0, 0 0, 1, 0, 0 0, 0, cos(%theta/2), -1*sin(%theta/2) 0, 0, sin(%theta/2), cos(%theta/2) CRY(0) 0 1 CRY-INV 0 1 --------------------------------------------------------------------------- QVMError Traceback (most recent call last) <ipython-input-2-83481f00619d> in <module>() 24 ) 25 print(prog) ---> 26 qvm.run(prog, [0]) ~/code/pyquil/pyquil/api/qvm.py in run(self, quil_program, classical_addresses, trials) 101 else: 102 payload = self._run_payload(quil_program, classical_addresses, trials) --> 103 response = post_json(self.session, self.sync_endpoint + "/qvm", payload) 104 return response.json() 105 ~/code/pyquil/pyquil/api/_base_connection.py in post_json(session, url, json) 79 res = session.post(url, json=json) 80 if res.status_code >= 400: ---> 81 raise parse_error(res) 82 return res 83 QVMError: There is no primary method for the generic function #<STANDARD-GENERIC-FUNCTION QVM:TRANSITION (27)> when called with arguments (#<QVM-APP::PROFILED-PURE-STATE-QVM {1008732163}> #<CL-QUIL:UNRESOLVED-APPLICATION {1008730AD3}>). See also: The ANSI Standard, Section 7.6.6.2 The QVM returned the above error. This could be due to a bug in the server or a bug in your code. If you suspect this to be a bug in pyQuil or Rigetti Forest, then please describe the problem in a GitHub issue at: https://github.com/rigetticomputing/pyquil/issues
QVMError
def out(self): """ Prints a readable Quil string representation of this gate. :returns: String representation of a gate :rtype: string """ def format_matrix_element(element): """ Formats a parameterized matrix element. :param element: {int, float, complex, str} The parameterized element to format. """ if isinstance(element, integer_types) or isinstance( element, (float, complex, np.int_) ): return format_parameter(element) elif isinstance(element, string_types): return element else: raise TypeError("Invalid matrix element: %r" % element) result = "DEFGATE %s:\n" % self.name for row in self.matrix: result += " " fcols = [format_matrix_element(col) for col in row] result += ", ".join(fcols) result += "\n" return result
def out(self): """ Prints a readable Quil string representation of this gate. :returns: String representation of a gate :rtype: string """ def format_matrix_element(element): """ Formats a parameterized matrix element. :param element: {int, float, complex, str} The parameterized element to format. """ if isinstance(element, integer_types) or isinstance(element, (float, complex)): return format_parameter(element) elif isinstance(element, string_types): return element else: raise TypeError("Invalid matrix element: %r" % element) result = "DEFGATE %s:\n" % self.name for row in self.matrix: result += " " fcols = [format_matrix_element(col) for col in row] result += ", ".join(fcols) result += "\n" return result
https://github.com/rigetti/pyquil/issues/138
Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/Users/steven/workspace/pyquil/pyquil/quilbase.py", line 208, in out fcols = [format_matrix_element(col) for col in row] File "/Users/steven/workspace/pyquil/pyquil/quilbase.py", line 208, in <listcomp> fcols = [format_matrix_element(col) for col in row] File "/Users/steven/workspace/pyquil/pyquil/quilbase.py", line 68, in format_matrix_element assert False, "Invalid matrix element: %r" % element AssertionError: Invalid matrix element: 1
AssertionError
def format_matrix_element(element): """ Formats a parameterized matrix element. :param element: {int, float, complex, str} The parameterized element to format. """ if isinstance(element, integer_types) or isinstance( element, (float, complex, np.int_) ): return format_parameter(element) elif isinstance(element, string_types): return element else: raise TypeError("Invalid matrix element: %r" % element)
def format_matrix_element(element): """ Formats a parameterized matrix element. :param element: {int, float, complex, str} The parameterized element to format. """ if isinstance(element, integer_types) or isinstance(element, (float, complex)): return format_parameter(element) elif isinstance(element, string_types): return element else: raise TypeError("Invalid matrix element: %r" % element)
https://github.com/rigetti/pyquil/issues/138
Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/Users/steven/workspace/pyquil/pyquil/quilbase.py", line 208, in out fcols = [format_matrix_element(col) for col in row] File "/Users/steven/workspace/pyquil/pyquil/quilbase.py", line 208, in <listcomp> fcols = [format_matrix_element(col) for col in row] File "/Users/steven/workspace/pyquil/pyquil/quilbase.py", line 68, in format_matrix_element assert False, "Invalid matrix element: %r" % element AssertionError: Invalid matrix element: 1
AssertionError
def format_parameter(element): """ Formats a particular parameter. Essentially the same as built-in formatting except using 'i' instead of 'j' for the imaginary number. :param element: {int, float, long, complex, Slot} Formats a parameter for Quil output. """ if isinstance(element, integer_types) or isinstance(element, np.int_): return repr(element) elif isinstance(element, float): return check_for_pi(element) elif isinstance(element, complex): r = element.real i = element.imag if i < 0: return repr(r) + "-" + repr(abs(i)) + "i" else: return repr(r) + "+" + repr(i) + "i" elif isinstance(element, Slot): return format_parameter(element.value()) assert False, "Invalid parameter: %r" % element
def format_parameter(element): """ Formats a particular parameter. Essentially the same as built-in formatting except using 'i' instead of 'j' for the imaginary number. :param element: {int, float, long, complex, Slot} Formats a parameter for Quil output. """ if isinstance(element, integer_types): return repr(element) elif isinstance(element, float): return check_for_pi(element) elif isinstance(element, complex): r = element.real i = element.imag if i < 0: return repr(r) + "-" + repr(abs(i)) + "i" else: return repr(r) + "+" + repr(i) + "i" elif isinstance(element, Slot): return format_parameter(element.value()) assert False, "Invalid parameter: %r" % element
https://github.com/rigetti/pyquil/issues/138
Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/Users/steven/workspace/pyquil/pyquil/quilbase.py", line 208, in out fcols = [format_matrix_element(col) for col in row] File "/Users/steven/workspace/pyquil/pyquil/quilbase.py", line 208, in <listcomp> fcols = [format_matrix_element(col) for col in row] File "/Users/steven/workspace/pyquil/pyquil/quilbase.py", line 68, in format_matrix_element assert False, "Invalid matrix element: %r" % element AssertionError: Invalid matrix element: 1
AssertionError
def decode(self): """ Decodes the result of the job. :return: Depends on the type of job. A JSON object. """ return self.result["result"]
def decode(self): """ Decodes the result of the job. :return: Depends on the type of job. A JSON object. """ return json.loads(self.result["result"])
https://github.com/rigetti/pyquil/issues/130
from pyquil.quil import Program from pyquil.gates import * import pyquil.api as api cxn = api.JobConnection(endpoint="https://job.rigetti.com/beta") res = cxn.run(Program(X(0)).measure(0, 0), [0]) # wait a bit res.get() res.decode() --------------------------------------------------------------------------- TypeError Traceback (most recent call last) <ipython-input-3-623312af8776> in <module>() ----> 1 res.decode() /Users/willzeng/code/pyquil/pyquil/job_results.pyc in decode(self) 73 :return: Depends on the type of job. A JSON object. 74 """ ---> 75 return json.loads(self.result['result']) 76 77 def __str__(self): /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/__init__.pyc in loads(s, encoding, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw) 336 parse_int is None and parse_float is None and 337 parse_constant is None and object_pairs_hook is None and not kw): --> 338 return _default_decoder.decode(s) 339 if cls is None: 340 cls = JSONDecoder /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.pyc in decode(self, s, _w) 364 365 """ --> 366 obj, end = self.raw_decode(s, idx=_w(s, 0).end()) 367 end = _w(s, end).end() 368 if end != len(s): TypeError: expected string or buffer
TypeError
def add_armory_library(sdk_path: str, name: str, rel_path=False) -> str: if rel_path: sdk_path = "../" + os.path.relpath(sdk_path, arm.utils.get_fp()).replace( "\\", "/" ) return ( ('project.addLibrary("' + sdk_path + "/" + name + '");\n') .replace("\\", "/") .replace("//", "/") )
def add_armory_library(sdk_path, name, rel_path=False): if rel_path: sdk_path = "../" + os.path.relpath(sdk_path, arm.utils.get_fp()).replace( "\\", "/" ) return ( ('project.addLibrary("' + sdk_path + "/" + name + '");\n') .replace("\\", "/") .replace("//", "/") )
https://github.com/armory3d/armory/issues/1519
location: <unknown location>:-1 Error: Traceback (most recent call last): File "C:\Users\nobody\Documents\ArmorySDK//armory/blender\arm\props_ui.py", line 457, in execute make.play() File "C:\Users\nobody\Documents\ArmorySDK//armory/blender\arm\make.py", line 462, in play build(target=runtime_to_target(), is_play=True) File "C:\Users\nobody\Documents\ArmorySDK//armory/blender\arm\make.py", line 346, in build export_data(fp, sdk_path) File "C:\Users\nobody\Documents\ArmorySDK//armory/blender\arm\make.py", line 155, in export_data write_data.write_compiledglsl(defs + cdefs, make_variants=has_config) File "C:\Users\nobody\Documents\ArmorySDK//armory/blender\arm\write_data.py", line 440, in write_compiledglsl with open(arm.utils.build_dir() + '/compiled/Shaders/compiled.inc', 'w') as f: FileNotFoundError: [Errno 2] No such file or directory: 'build_0untitled/compiled/Shaders/compiled.inc' location: <unknown location>:-1
FileNotFoundError
def add_assets(path: str, quality=1.0, use_data_dir=False, rel_path=False) -> str: if not bpy.data.worlds["Arm"].arm_minimize and path.endswith(".arm"): path = path[:-4] + ".json" if rel_path: path = os.path.relpath(path, arm.utils.get_fp()).replace("\\", "/") notinlist = not path.endswith(".ttf") # TODO s = 'project.addAssets("' + path + '", { notinlist: ' + str(notinlist).lower() + " " if quality < 1.0: s += ", quality: " + str(quality) if use_data_dir: s += ', destination: "data/{name}"' s += "});\n" return s
def add_assets(path, quality=1.0, use_data_dir=False, rel_path=False): if not bpy.data.worlds["Arm"].arm_minimize and path.endswith(".arm"): path = path[:-4] + ".json" if rel_path: path = os.path.relpath(path, arm.utils.get_fp()).replace("\\", "/") notinlist = not path.endswith(".ttf") # TODO s = 'project.addAssets("' + path + '", { notinlist: ' + str(notinlist).lower() + " " if quality < 1.0: s += ", quality: " + str(quality) if use_data_dir: s += ', destination: "data/{name}"' s += "});\n" return s
https://github.com/armory3d/armory/issues/1519
location: <unknown location>:-1 Error: Traceback (most recent call last): File "C:\Users\nobody\Documents\ArmorySDK//armory/blender\arm\props_ui.py", line 457, in execute make.play() File "C:\Users\nobody\Documents\ArmorySDK//armory/blender\arm\make.py", line 462, in play build(target=runtime_to_target(), is_play=True) File "C:\Users\nobody\Documents\ArmorySDK//armory/blender\arm\make.py", line 346, in build export_data(fp, sdk_path) File "C:\Users\nobody\Documents\ArmorySDK//armory/blender\arm\make.py", line 155, in export_data write_data.write_compiledglsl(defs + cdefs, make_variants=has_config) File "C:\Users\nobody\Documents\ArmorySDK//armory/blender\arm\write_data.py", line 440, in write_compiledglsl with open(arm.utils.build_dir() + '/compiled/Shaders/compiled.inc', 'w') as f: FileNotFoundError: [Errno 2] No such file or directory: 'build_0untitled/compiled/Shaders/compiled.inc' location: <unknown location>:-1
FileNotFoundError
def add_shaders(path: str, rel_path=False) -> str: if rel_path: path = os.path.relpath(path, arm.utils.get_fp()) return 'project.addShaders("' + path.replace("\\", "/").replace("//", "/") + '");\n'
def add_shaders(path, rel_path=False): if rel_path: path = os.path.relpath(path, arm.utils.get_fp()) return 'project.addShaders("' + path.replace("\\", "/").replace("//", "/") + '");\n'
https://github.com/armory3d/armory/issues/1519
location: <unknown location>:-1 Error: Traceback (most recent call last): File "C:\Users\nobody\Documents\ArmorySDK//armory/blender\arm\props_ui.py", line 457, in execute make.play() File "C:\Users\nobody\Documents\ArmorySDK//armory/blender\arm\make.py", line 462, in play build(target=runtime_to_target(), is_play=True) File "C:\Users\nobody\Documents\ArmorySDK//armory/blender\arm\make.py", line 346, in build export_data(fp, sdk_path) File "C:\Users\nobody\Documents\ArmorySDK//armory/blender\arm\make.py", line 155, in export_data write_data.write_compiledglsl(defs + cdefs, make_variants=has_config) File "C:\Users\nobody\Documents\ArmorySDK//armory/blender\arm\write_data.py", line 440, in write_compiledglsl with open(arm.utils.build_dir() + '/compiled/Shaders/compiled.inc', 'w') as f: FileNotFoundError: [Errno 2] No such file or directory: 'build_0untitled/compiled/Shaders/compiled.inc' location: <unknown location>:-1
FileNotFoundError
def write_khafilejs( is_play, export_physics: bool, export_navigation: bool, export_ui: bool, is_publish: bool, enable_dce: bool, import_traits: List[str], import_logicnodes, ) -> None: wrd = bpy.data.worlds["Arm"] sdk_path = arm.utils.get_sdk_path() rel_path = arm.utils.get_relative_paths() # Convert absolute paths to relative project_path = arm.utils.get_fp() build_dir = arm.utils.build_dir() # Whether to use relative paths for paths inside the SDK do_relpath_sdk = rel_path and on_same_drive(sdk_path, project_path) with open("khafile.js", "w", encoding="utf-8") as khafile: khafile.write( """// Auto-generated let project = new Project('""" + arm.utils.safesrc(wrd.arm_project_name + "-" + wrd.arm_project_version) + """'); project.addSources('Sources'); """ ) # Auto-add assets located in Bundled directory if os.path.exists("Bundled"): for file in glob.glob("Bundled/**", recursive=True): if os.path.isfile(file): assets.add(file) # Add project shaders if os.path.exists("Shaders"): # Copy to enable includes shader_path = os.path.join(build_dir, "compiled", "Shaders", "Project") if os.path.exists(shader_path): shutil.rmtree(shader_path, onerror=remove_readonly) shutil.copytree("Shaders", shader_path) khafile.write( "project.addShaders('" + build_dir + "/compiled/Shaders/Project/**');\n" ) # for file in glob.glob("Shaders/**", recursive=True): # if os.path.isfile(file): # assets.add_shader(file) # Add engine sources if the project does not use its own armory/iron versions if not os.path.exists(os.path.join("Libraries", "armory")): khafile.write( add_armory_library(sdk_path, "armory", rel_path=do_relpath_sdk) ) if not os.path.exists(os.path.join("Libraries", "iron")): khafile.write(add_armory_library(sdk_path, "iron", rel_path=do_relpath_sdk)) # Project libraries if os.path.exists("Libraries"): libs = os.listdir("Libraries") for lib in libs: if os.path.isdir("Libraries/" + lib): khafile.write( 'project.addLibrary("{0}");\n'.format(lib.replace("//", "/")) ) # Subprojects, merge this with libraries if os.path.exists("Subprojects"): libs = os.listdir("Subprojects") for lib in libs: if os.path.isdir("Subprojects/" + lib): khafile.write( 'await project.addProject("Subprojects/{0}");\n'.format(lib) ) if export_physics: assets.add_khafile_def("arm_physics") if wrd.arm_physics_engine == "Bullet": assets.add_khafile_def("arm_bullet") if not os.path.exists("Libraries/haxebullet"): khafile.write( add_armory_library( sdk_path + "/lib/", "haxebullet", rel_path=do_relpath_sdk ) ) if state.target.startswith("krom"): ammojs_path = sdk_path + "/lib/haxebullet/ammo/ammo.wasm.js" ammojs_path = ammojs_path.replace("\\", "/").replace("//", "/") khafile.write(add_assets(ammojs_path, rel_path=do_relpath_sdk)) ammojs_wasm_path = sdk_path + "/lib/haxebullet/ammo/ammo.wasm.wasm" ammojs_wasm_path = ammojs_wasm_path.replace("\\", "/").replace( "//", "/" ) khafile.write(add_assets(ammojs_wasm_path, rel_path=do_relpath_sdk)) elif state.target == "html5" or state.target == "node": ammojs_path = sdk_path + "/lib/haxebullet/ammo/ammo.js" ammojs_path = ammojs_path.replace("\\", "/").replace("//", "/") khafile.write(add_assets(ammojs_path, rel_path=do_relpath_sdk)) elif wrd.arm_physics_engine == "Oimo": assets.add_khafile_def("arm_oimo") if not os.path.exists("Libraries/oimo"): khafile.write( add_armory_library( sdk_path + "/lib/", "oimo", rel_path=do_relpath_sdk ) ) if export_navigation: assets.add_khafile_def("arm_navigation") if not os.path.exists("Libraries/haxerecast"): khafile.write( add_armory_library( sdk_path + "/lib/", "haxerecast", rel_path=do_relpath_sdk ) ) if state.target.startswith("krom") or state.target == "html5": recastjs_path = sdk_path + "/lib/haxerecast/js/recast/recast.js" recastjs_path = recastjs_path.replace("\\", "/").replace("//", "/") khafile.write(add_assets(recastjs_path, rel_path=do_relpath_sdk)) if is_publish: assets.add_khafile_def("arm_published") if wrd.arm_asset_compression: assets.add_khafile_def("arm_compress") else: pass # khafile.write("""project.addParameter("--macro include('armory.trait')");\n""") # khafile.write("""project.addParameter("--macro include('armory.trait.internal')");\n""") # if export_physics: # khafile.write("""project.addParameter("--macro include('armory.trait.physics')");\n""") # if wrd.arm_physics_engine == 'Bullet': # khafile.write("""project.addParameter("--macro include('armory.trait.physics.bullet')");\n""") # else: # khafile.write("""project.addParameter("--macro include('armory.trait.physics.oimo')");\n""") # if export_navigation: # khafile.write("""project.addParameter("--macro include('armory.trait.navigation')");\n""") # if import_logicnodes: # Live patching for logic nodes # khafile.write("""project.addParameter("--macro include('armory.logicnode')");\n""") if not wrd.arm_compiler_inline: khafile.write("project.addParameter('--no-inline');\n") if enable_dce: khafile.write("project.addParameter('-dce full');\n") live_patch = wrd.arm_live_patch and state.target == "krom" if wrd.arm_debug_console or live_patch: import_traits.append("armory.trait.internal.Bridge") if live_patch: assets.add_khafile_def("arm_patch") import_traits = list(set(import_traits)) for i in range(0, len(import_traits)): khafile.write("project.addParameter('" + import_traits[i] + "');\n") khafile.write( """project.addParameter("--macro keep('""" + import_traits[i] + """')");\n""" ) noembed = wrd.arm_cache_build and not is_publish and state.target == "krom" if noembed: # Load shaders manually assets.add_khafile_def("arm_noembed") noembed = False # TODO: always embed shaders for now, check compatibility with haxe compile server shaders_path = build_dir + "/compiled/Shaders/*.glsl" if rel_path: shaders_path = os.path.relpath(shaders_path, project_path).replace( "\\", "/" ) khafile.write( 'project.addShaders("' + shaders_path + '", { noembed: ' + str(noembed).lower() + "});\n" ) if arm.utils.get_gapi() == "direct3d11": # noprocessing flag - gets renamed to .d3d11 shaders_path = build_dir + "/compiled/Hlsl/*.glsl" if rel_path: shaders_path = os.path.relpath(shaders_path, project_path).replace( "\\", "/" ) khafile.write( 'project.addShaders("' + shaders_path + '", { noprocessing: true, noembed: ' + str(noembed).lower() + " });\n" ) # Move assets for published game to /data folder use_data_dir = is_publish and ( state.target == "krom-windows" or state.target == "krom-linux" or state.target == "windows-hl" or state.target == "linux-hl" ) if use_data_dir: assets.add_khafile_def("arm_data_dir") ext = "arm" if wrd.arm_minimize else "json" assets_path = build_dir + "/compiled/Assets/**" assets_path_sh = build_dir + "/compiled/Shaders/*." + ext if rel_path: assets_path = os.path.relpath(assets_path, project_path).replace("\\", "/") assets_path_sh = os.path.relpath(assets_path_sh, project_path).replace( "\\", "/" ) dest = "" if use_data_dir: dest += ', destination: "data/{name}"' khafile.write( 'project.addAssets("' + assets_path + '", { notinlist: true ' + dest + "});\n" ) khafile.write( 'project.addAssets("' + assets_path_sh + '", { notinlist: true ' + dest + "});\n" ) shader_data_references = sorted(list(set(assets.shader_datas))) for ref in shader_data_references: ref = ref.replace("\\", "/").replace("//", "/") if "/compiled/" in ref: # Asset already included continue do_relpath_shaders = rel_path and on_same_drive(ref, project_path) khafile.write( add_assets(ref, use_data_dir=use_data_dir, rel_path=do_relpath_shaders) ) asset_references = sorted(list(set(assets.assets))) for ref in asset_references: ref = ref.replace("\\", "/").replace("//", "/") if "/compiled/" in ref: # Asset already included continue quality = 1.0 s = ref.lower() if s.endswith(".wav"): quality = wrd.arm_sound_quality elif s.endswith(".png") or s.endswith(".jpg"): quality = wrd.arm_texture_quality do_relpath_assets = rel_path and on_same_drive(ref, project_path) khafile.write( add_assets( ref, quality=quality, use_data_dir=use_data_dir, rel_path=do_relpath_assets, ) ) if wrd.arm_sound_quality < 1.0 or state.target == "html5": assets.add_khafile_def("arm_soundcompress") if wrd.arm_audio == "Disabled": assets.add_khafile_def("kha_no_ogg") else: assets.add_khafile_def("arm_audio") if wrd.arm_texture_quality < 1.0: assets.add_khafile_def("arm_texcompress") if wrd.arm_debug_console: assets.add_khafile_def("arm_debug") khafile.write( add_shaders( sdk_path + "/armory/Shaders/debug_draw/**", rel_path=do_relpath_sdk ) ) if wrd.arm_verbose_output: khafile.write("project.addParameter('--times');\n") if export_ui: if not os.path.exists("Libraries/zui"): khafile.write( add_armory_library(sdk_path, "lib/zui", rel_path=do_relpath_sdk) ) p = sdk_path + "/armory/Assets/font_default.ttf" p = p.replace("//", "/") khafile.write( add_assets( p.replace("\\", "/"), use_data_dir=use_data_dir, rel_path=do_relpath_sdk, ) ) assets.add_khafile_def("arm_ui") if not wrd.arm_minimize: assets.add_khafile_def("arm_json") if wrd.arm_deinterleaved_buffers: assets.add_khafile_def("arm_deinterleaved") if wrd.arm_batch_meshes: assets.add_khafile_def("arm_batch") if wrd.arm_stream_scene: assets.add_khafile_def("arm_stream") rpdat = arm.utils.get_rp() if rpdat.arm_skin != "Off": assets.add_khafile_def("arm_skin") if rpdat.arm_particles != "Off": assets.add_khafile_def("arm_particles") if rpdat.rp_draw_order == "Shader": assets.add_khafile_def("arm_draworder_shader") if arm.utils.get_viewport_controls() == "azerty": assets.add_khafile_def("arm_azerty") if os.path.exists(project_path + "/Bundled/config.arm"): assets.add_khafile_def("arm_config") if is_publish and wrd.arm_loadscreen: assets.add_khafile_def("arm_loadscreen") if wrd.arm_winresize or state.target == "html5": assets.add_khafile_def("arm_resizable") # if bpy.data.scenes[0].unit_settings.system_rotation == 'DEGREES': # assets.add_khafile_def('arm_degrees') for d in assets.khafile_defs: khafile.write("project.addDefine('" + d + "');\n") for p in assets.khafile_params: khafile.write("project.addParameter('" + p + "');\n") # Let libraries differentiate between Armory and pure Kha assets.add_khafile_def("armory") if state.target.startswith("android"): bundle = ( "org.armory3d." + wrd.arm_project_package if wrd.arm_project_bundle == "" else wrd.arm_project_bundle ) khafile.write( "project.targetOptions.android_native.package = '{0}';\n".format( arm.utils.safestr(bundle) ) ) if wrd.arm_winorient != "Multi": khafile.write( "project.targetOptions.android_native.screenOrientation = '{0}';\n".format( wrd.arm_winorient.lower() ) ) # Android SDK Versions khafile.write( "project.targetOptions.android_native.compileSdkVersion = '{0}';\n".format( wrd.arm_project_android_sdk_compile ) ) khafile.write( "project.targetOptions.android_native.minSdkVersion = '{0}';\n".format( wrd.arm_project_android_sdk_min ) ) khafile.write( "project.targetOptions.android_native.targetSdkVersion = '{0}';\n".format( wrd.arm_project_android_sdk_target ) ) # Permissions if len(wrd.arm_exporter_android_permission_list) > 0: perms = "" for item in wrd.arm_exporter_android_permission_list: perm = "'android.permission." + item.arm_android_permissions + "'" # Checking In if perms.find(perm) == -1: if len(perms) > 0: perms = perms + ", " + perm else: perms = perm if len(perms) > 0: khafile.write( "project.targetOptions.android_native.permissions = [{0}];\n".format( perms ) ) # Android ABI Filters if len(wrd.arm_exporter_android_abi_list) > 0: abis = "" for item in wrd.arm_exporter_android_abi_list: abi = "'" + item.arm_android_abi + "'" # Checking In if abis.find(abi) == -1: if len(abis) > 0: abis = abis + ", " + abi else: abis = abi if len(abis) > 0: khafile.write( "project.targetOptions.android_native.abiFilters = [{0}];\n".format( abis ) ) elif state.target.startswith("ios"): bundle = ( "org.armory3d." + wrd.arm_project_package if wrd.arm_project_bundle == "" else wrd.arm_project_bundle ) khafile.write( "project.targetOptions.ios.bundle = '{0}';\n".format( arm.utils.safestr(bundle) ) ) if wrd.arm_project_icon != "": shutil.copy( bpy.path.abspath(wrd.arm_project_icon), project_path + "/icon.png" ) if wrd.arm_khafile is not None: khafile.write(wrd.arm_khafile.as_string()) khafile.write("\n\nresolve(project);\n")
def write_khafilejs( is_play, export_physics, export_navigation, export_ui, is_publish, enable_dce, import_traits, import_logicnodes, ): sdk_path = arm.utils.get_sdk_path() rel_path = arm.utils.get_relative_paths() # Convert absolute paths to relative wrd = bpy.data.worlds["Arm"] with open("khafile.js", "w", encoding="utf-8") as khafile: khafile.write( """// Auto-generated let project = new Project('""" + arm.utils.safesrc(wrd.arm_project_name + "-" + wrd.arm_project_version) + """'); project.addSources('Sources'); """ ) # Let libraries differentiate between Armory and pure Kha assets.add_khafile_def("armory") # Auto-add assets located in Bundled directory if os.path.exists("Bundled"): for file in glob.glob("Bundled/**", recursive=True): if os.path.isfile(file): assets.add(file) if os.path.exists("Shaders"): # Copy to enable includes if os.path.exists(arm.utils.build_dir() + "/compiled/Shaders/Project"): shutil.rmtree( arm.utils.build_dir() + "/compiled/Shaders/Project", onerror=remove_readonly, ) shutil.copytree( "Shaders", arm.utils.build_dir() + "/compiled/Shaders/Project" ) khafile.write( "project.addShaders('" + arm.utils.build_dir() + "/compiled/Shaders/Project/**');\n" ) # for file in glob.glob("Shaders/**", recursive=True): # if os.path.isfile(file): # assets.add_shader(file) if not os.path.exists("Libraries/armory"): khafile.write(add_armory_library(sdk_path, "armory", rel_path=rel_path)) if not os.path.exists("Libraries/iron"): khafile.write(add_armory_library(sdk_path, "iron", rel_path=rel_path)) # Project libraries if os.path.exists("Libraries"): libs = os.listdir("Libraries") for lib in libs: if os.path.isdir("Libraries/" + lib): khafile.write( 'project.addLibrary("{0}");\n'.format(lib.replace("//", "/")) ) # Subprojects, merge this with libraries if os.path.exists("Subprojects"): libs = os.listdir("Subprojects") for lib in libs: if os.path.isdir("Subprojects/" + lib): khafile.write( 'await project.addProject("Subprojects/{0}");\n'.format(lib) ) if wrd.arm_audio == "Disabled": assets.add_khafile_def("kha_no_ogg") else: assets.add_khafile_def("arm_audio") if export_physics: assets.add_khafile_def("arm_physics") if wrd.arm_physics_engine == "Bullet": assets.add_khafile_def("arm_bullet") if not os.path.exists("Libraries/haxebullet"): khafile.write( add_armory_library( sdk_path + "/lib/", "haxebullet", rel_path=rel_path ) ) if state.target.startswith("krom"): ammojs_path = sdk_path + "/lib/haxebullet/ammo/ammo.wasm.js" ammojs_path = ammojs_path.replace("\\", "/").replace("//", "/") khafile.write(add_assets(ammojs_path, rel_path=rel_path)) ammojs_wasm_path = sdk_path + "/lib/haxebullet/ammo/ammo.wasm.wasm" ammojs_wasm_path = ammojs_wasm_path.replace("\\", "/").replace( "//", "/" ) khafile.write(add_assets(ammojs_wasm_path, rel_path=rel_path)) elif state.target == "html5" or state.target == "node": ammojs_path = sdk_path + "/lib/haxebullet/ammo/ammo.js" ammojs_path = ammojs_path.replace("\\", "/").replace("//", "/") khafile.write(add_assets(ammojs_path, rel_path=rel_path)) elif wrd.arm_physics_engine == "Oimo": assets.add_khafile_def("arm_oimo") if not os.path.exists("Libraries/oimo"): khafile.write( add_armory_library( sdk_path + "/lib/", "oimo", rel_path=rel_path ) ) if export_navigation: assets.add_khafile_def("arm_navigation") if not os.path.exists("Libraries/haxerecast"): khafile.write( add_armory_library( sdk_path + "/lib/", "haxerecast", rel_path=rel_path ) ) if state.target.startswith("krom") or state.target == "html5": recastjs_path = sdk_path + "/lib/haxerecast/js/recast/recast.js" recastjs_path = recastjs_path.replace("\\", "/").replace("//", "/") khafile.write(add_assets(recastjs_path, rel_path=rel_path)) if is_publish: assets.add_khafile_def("arm_published") if wrd.arm_asset_compression: assets.add_khafile_def("arm_compress") else: pass # khafile.write("""project.addParameter("--macro include('armory.trait')");\n""") # khafile.write("""project.addParameter("--macro include('armory.trait.internal')");\n""") # if export_physics: # khafile.write("""project.addParameter("--macro include('armory.trait.physics')");\n""") # if wrd.arm_physics_engine == 'Bullet': # khafile.write("""project.addParameter("--macro include('armory.trait.physics.bullet')");\n""") # else: # khafile.write("""project.addParameter("--macro include('armory.trait.physics.oimo')");\n""") # if export_navigation: # khafile.write("""project.addParameter("--macro include('armory.trait.navigation')");\n""") # if import_logicnodes: # Live patching for logic nodes # khafile.write("""project.addParameter("--macro include('armory.logicnode')");\n""") if not wrd.arm_compiler_inline: khafile.write("project.addParameter('--no-inline');\n") if enable_dce: khafile.write("project.addParameter('-dce full');\n") live_patch = wrd.arm_live_patch and state.target == "krom" if wrd.arm_debug_console or live_patch: import_traits.append("armory.trait.internal.Bridge") if live_patch: assets.add_khafile_def("arm_patch") import_traits = list(set(import_traits)) for i in range(0, len(import_traits)): khafile.write("project.addParameter('" + import_traits[i] + "');\n") khafile.write( """project.addParameter("--macro keep('""" + import_traits[i] + """')");\n""" ) noembed = wrd.arm_cache_build and not is_publish and state.target == "krom" if noembed: # Load shaders manually assets.add_khafile_def("arm_noembed") noembed = False # TODO: always embed shaders for now, check compatibility with haxe compile server shaders_path = arm.utils.build_dir() + "/compiled/Shaders/*.glsl" if rel_path: shaders_path = os.path.relpath(shaders_path, arm.utils.get_fp()).replace( "\\", "/" ) khafile.write( 'project.addShaders("' + shaders_path + '", { noembed: ' + str(noembed).lower() + "});\n" ) if arm.utils.get_gapi() == "direct3d11": # noprocessing flag - gets renamed to .d3d11 shaders_path = arm.utils.build_dir() + "/compiled/Hlsl/*.glsl" if rel_path: shaders_path = os.path.relpath( shaders_path, arm.utils.get_fp() ).replace("\\", "/") khafile.write( 'project.addShaders("' + shaders_path + '", { noprocessing: true, noembed: ' + str(noembed).lower() + " });\n" ) # Move assets for published game to /data folder use_data_dir = is_publish and ( state.target == "krom-windows" or state.target == "krom-linux" or state.target == "windows-hl" or state.target == "linux-hl" ) if use_data_dir: assets.add_khafile_def("arm_data_dir") ext = "arm" if wrd.arm_minimize else "json" assets_path = arm.utils.build_dir() + "/compiled/Assets/**" assets_path_sh = arm.utils.build_dir() + "/compiled/Shaders/*." + ext if rel_path: assets_path = os.path.relpath(assets_path, arm.utils.get_fp()).replace( "\\", "/" ) assets_path_sh = os.path.relpath( assets_path_sh, arm.utils.get_fp() ).replace("\\", "/") dest = "" if use_data_dir: dest += ', destination: "data/{name}"' khafile.write( 'project.addAssets("' + assets_path + '", { notinlist: true ' + dest + "});\n" ) khafile.write( 'project.addAssets("' + assets_path_sh + '", { notinlist: true ' + dest + "});\n" ) shader_data_references = sorted(list(set(assets.shader_datas))) for ref in shader_data_references: ref = ref.replace("\\", "/").replace("//", "/") if "/compiled/" in ref: # Asset already included continue khafile.write(add_assets(ref, use_data_dir=use_data_dir, rel_path=rel_path)) asset_references = sorted(list(set(assets.assets))) for ref in asset_references: ref = ref.replace("\\", "/").replace("//", "/") if "/compiled/" in ref: # Asset already included continue quality = 1.0 s = ref.lower() if s.endswith(".wav"): quality = wrd.arm_sound_quality elif s.endswith(".png") or s.endswith(".jpg"): quality = wrd.arm_texture_quality khafile.write( add_assets( ref, quality=quality, use_data_dir=use_data_dir, rel_path=rel_path ) ) if wrd.arm_sound_quality < 1.0 or state.target == "html5": assets.add_khafile_def("arm_soundcompress") if wrd.arm_texture_quality < 1.0: assets.add_khafile_def("arm_texcompress") if wrd.arm_debug_console: assets.add_khafile_def("arm_debug") khafile.write( add_shaders( sdk_path + "/armory/Shaders/debug_draw/**", rel_path=rel_path ) ) if wrd.arm_verbose_output: khafile.write("project.addParameter('--times');\n") if export_ui: if not os.path.exists("Libraries/zui"): khafile.write( add_armory_library(sdk_path, "lib/zui", rel_path=rel_path) ) p = sdk_path + "/armory/Assets/font_default.ttf" p = p.replace("//", "/") khafile.write( add_assets( p.replace("\\", "/"), use_data_dir=use_data_dir, rel_path=rel_path ) ) assets.add_khafile_def("arm_ui") if wrd.arm_minimize == False: assets.add_khafile_def("arm_json") if wrd.arm_deinterleaved_buffers == True: assets.add_khafile_def("arm_deinterleaved") if wrd.arm_batch_meshes == True: assets.add_khafile_def("arm_batch") if wrd.arm_stream_scene: assets.add_khafile_def("arm_stream") rpdat = arm.utils.get_rp() if rpdat.arm_skin != "Off": assets.add_khafile_def("arm_skin") if rpdat.arm_particles != "Off": assets.add_khafile_def("arm_particles") if rpdat.rp_draw_order == "Shader": assets.add_khafile_def("arm_draworder_shader") if arm.utils.get_viewport_controls() == "azerty": assets.add_khafile_def("arm_azerty") if os.path.exists(arm.utils.get_fp() + "/Bundled/config.arm"): assets.add_khafile_def("arm_config") if is_publish and wrd.arm_loadscreen: assets.add_khafile_def("arm_loadscreen") if wrd.arm_winresize or state.target == "html5": assets.add_khafile_def("arm_resizable") # if bpy.data.scenes[0].unit_settings.system_rotation == 'DEGREES': # assets.add_khafile_def('arm_degrees') for d in assets.khafile_defs: khafile.write("project.addDefine('" + d + "');\n") for p in assets.khafile_params: khafile.write("project.addParameter('" + p + "');\n") if wrd.arm_khafile != None: khafile.write(wrd.arm_khafile.as_string()) if state.target.startswith("android"): bundle = ( "org.armory3d." + wrd.arm_project_package if wrd.arm_project_bundle == "" else wrd.arm_project_bundle ) khafile.write( "project.targetOptions.android_native.package = '{0}';\n".format( arm.utils.safestr(bundle) ) ) if wrd.arm_winorient != "Multi": khafile.write( "project.targetOptions.android_native.screenOrientation = '{0}';\n".format( wrd.arm_winorient.lower() ) ) # Android SDK Versions khafile.write( "project.targetOptions.android_native.compileSdkVersion = '{0}';\n".format( wrd.arm_project_android_sdk_compile ) ) khafile.write( "project.targetOptions.android_native.minSdkVersion = '{0}';\n".format( wrd.arm_project_android_sdk_min ) ) khafile.write( "project.targetOptions.android_native.targetSdkVersion = '{0}';\n".format( wrd.arm_project_android_sdk_target ) ) # Permissions if len(wrd.arm_exporter_android_permission_list) > 0: perms = "" for item in wrd.arm_exporter_android_permission_list: perm = "'android.permission." + item.arm_android_permissions + "'" # Checking In if perms.find(perm) == -1: if len(perms) > 0: perms = perms + ", " + perm else: perms = perm if len(perms) > 0: khafile.write( "project.targetOptions.android_native.permissions = [{0}];\n".format( perms ) ) # Android ABI Filters if len(wrd.arm_exporter_android_abi_list) > 0: abis = "" for item in wrd.arm_exporter_android_abi_list: abi = "'" + item.arm_android_abi + "'" # Checking In if abis.find(abi) == -1: if len(abis) > 0: abis = abis + ", " + abi else: abis = abi if len(abis) > 0: khafile.write( "project.targetOptions.android_native.abiFilters = [{0}];\n".format( abis ) ) elif state.target.startswith("ios"): bundle = ( "org.armory3d." + wrd.arm_project_package if wrd.arm_project_bundle == "" else wrd.arm_project_bundle ) khafile.write( "project.targetOptions.ios.bundle = '{0}';\n".format( arm.utils.safestr(bundle) ) ) if wrd.arm_project_icon != "": shutil.copy( bpy.path.abspath(wrd.arm_project_icon), arm.utils.get_fp() + "/icon.png" ) khafile.write("\n\nresolve(project);\n")
https://github.com/armory3d/armory/issues/1519
location: <unknown location>:-1 Error: Traceback (most recent call last): File "C:\Users\nobody\Documents\ArmorySDK//armory/blender\arm\props_ui.py", line 457, in execute make.play() File "C:\Users\nobody\Documents\ArmorySDK//armory/blender\arm\make.py", line 462, in play build(target=runtime_to_target(), is_play=True) File "C:\Users\nobody\Documents\ArmorySDK//armory/blender\arm\make.py", line 346, in build export_data(fp, sdk_path) File "C:\Users\nobody\Documents\ArmorySDK//armory/blender\arm\make.py", line 155, in export_data write_data.write_compiledglsl(defs + cdefs, make_variants=has_config) File "C:\Users\nobody\Documents\ArmorySDK//armory/blender\arm\write_data.py", line 440, in write_compiledglsl with open(arm.utils.build_dir() + '/compiled/Shaders/compiled.inc', 'w') as f: FileNotFoundError: [Errno 2] No such file or directory: 'build_0untitled/compiled/Shaders/compiled.inc' location: <unknown location>:-1
FileNotFoundError
def write_config(resx, resy): wrd = bpy.data.worlds["Arm"] p = os.path.join(arm.utils.get_fp(), "Bundled") if not os.path.exists(p): os.makedirs(p) rpdat = arm.utils.get_rp() rp_shadowmap_cube = int(rpdat.rp_shadowmap_cube) if rpdat.rp_shadows else 0 rp_shadowmap_cascade = arm.utils.get_cascade_size(rpdat) if rpdat.rp_shadows else 0 output = { "window_mode": get_winmode(wrd.arm_winmode), "window_w": int(resx), "window_h": int(resy), "window_resizable": wrd.arm_winresize, "window_maximizable": wrd.arm_winresize and wrd.arm_winmaximize, "window_minimizable": wrd.arm_winminimize, "window_vsync": wrd.arm_vsync, "window_msaa": int(rpdat.arm_samples_per_pixel), "window_scale": 1.0, "rp_supersample": float(rpdat.rp_supersampling), "rp_shadowmap_cube": rp_shadowmap_cube, "rp_shadowmap_cascade": rp_shadowmap_cascade, "rp_ssgi": rpdat.rp_ssgi != "Off", "rp_ssr": rpdat.rp_ssr != "Off", "rp_bloom": rpdat.rp_bloom != "Off", "rp_motionblur": rpdat.rp_motionblur != "Off", "rp_gi": rpdat.rp_voxelao, "rp_dynres": rpdat.rp_dynres, } with open(os.path.join(p, "config.arm"), "w") as configfile: configfile.write(json.dumps(output, sort_keys=True, indent=4))
def write_config(resx, resy): wrd = bpy.data.worlds["Arm"] p = arm.utils.get_fp() + "/Bundled" if not os.path.exists(p): os.makedirs(p) output = {} output["window_mode"] = get_winmode(wrd.arm_winmode) output["window_w"] = int(resx) output["window_h"] = int(resy) output["window_resizable"] = wrd.arm_winresize output["window_maximizable"] = wrd.arm_winresize and wrd.arm_winmaximize output["window_minimizable"] = wrd.arm_winminimize output["window_vsync"] = wrd.arm_vsync rpdat = arm.utils.get_rp() output["window_msaa"] = int(rpdat.arm_samples_per_pixel) output["window_scale"] = 1.0 output["rp_supersample"] = float(rpdat.rp_supersampling) rp_shadowmap_cube = int(rpdat.rp_shadowmap_cube) if rpdat.rp_shadows else 0 output["rp_shadowmap_cube"] = rp_shadowmap_cube rp_shadowmap_cascade = arm.utils.get_cascade_size(rpdat) if rpdat.rp_shadows else 0 output["rp_shadowmap_cascade"] = rp_shadowmap_cascade output["rp_ssgi"] = rpdat.rp_ssgi != "Off" output["rp_ssr"] = rpdat.rp_ssr != "Off" output["rp_bloom"] = rpdat.rp_bloom != "Off" output["rp_motionblur"] = rpdat.rp_motionblur != "Off" output["rp_gi"] = rpdat.rp_voxelao output["rp_dynres"] = rpdat.rp_dynres with open(p + "/config.arm", "w") as f: f.write(json.dumps(output, sort_keys=True, indent=4))
https://github.com/armory3d/armory/issues/1519
location: <unknown location>:-1 Error: Traceback (most recent call last): File "C:\Users\nobody\Documents\ArmorySDK//armory/blender\arm\props_ui.py", line 457, in execute make.play() File "C:\Users\nobody\Documents\ArmorySDK//armory/blender\arm\make.py", line 462, in play build(target=runtime_to_target(), is_play=True) File "C:\Users\nobody\Documents\ArmorySDK//armory/blender\arm\make.py", line 346, in build export_data(fp, sdk_path) File "C:\Users\nobody\Documents\ArmorySDK//armory/blender\arm\make.py", line 155, in export_data write_data.write_compiledglsl(defs + cdefs, make_variants=has_config) File "C:\Users\nobody\Documents\ArmorySDK//armory/blender\arm\write_data.py", line 440, in write_compiledglsl with open(arm.utils.build_dir() + '/compiled/Shaders/compiled.inc', 'w') as f: FileNotFoundError: [Errno 2] No such file or directory: 'build_0untitled/compiled/Shaders/compiled.inc' location: <unknown location>:-1
FileNotFoundError
def build_default_node(inp: bpy.types.NodeSocket): """Creates a new node to give a not connected input socket a value""" is_custom_socket = isinstance(inp, arm.logicnode.arm_sockets.ArmCustomSocket) if is_custom_socket: # ArmCustomSockets need to implement get_default_value() default_value = inp.get_default_value() if isinstance(default_value, str): default_value = '"{:s}"'.format(default_value.replace('"', '\\"')) inp_type = inp.arm_socket_type # any custom socket's `type` is "VALUE". might as well have valuable type information for custom nodes as well. else: if hasattr(inp, "default_value"): default_value = inp.default_value else: default_value = None if isinstance(default_value, str): default_value = '"{:s}"'.format(default_value.replace('"', '\\"')) inp_type = inp.type # Don't write 'None' into the Haxe code if default_value is None: default_value = "null" if inp_type == "VECTOR": return f"new armory.logicnode.VectorNode(this, {default_value[0]}, {default_value[1]}, {default_value[2]})" elif inp_type == "RGBA": return f"new armory.logicnode.ColorNode(this, {default_value[0]}, {default_value[1]}, {default_value[2]}, {default_value[3]})" elif inp_type == "RGB": return f"new armory.logicnode.ColorNode(this, {default_value[0]}, {default_value[1]}, {default_value[2]})" elif inp_type == "VALUE": return f"new armory.logicnode.FloatNode(this, {default_value})" elif inp_type == "INT": return f"new armory.logicnode.IntegerNode(this, {default_value})" elif inp_type == "BOOLEAN": return f"new armory.logicnode.BooleanNode(this, {str(default_value).lower()})" elif inp_type == "STRING": return f"new armory.logicnode.StringNode(this, {default_value})" elif inp_type == "NONE": return "new armory.logicnode.NullNode(this)" elif inp_type == "OBJECT": return f"new armory.logicnode.ObjectNode(this, {default_value})" elif is_custom_socket: return f"new armory.logicnode.DynamicNode(this, {default_value})" else: return "new armory.logicnode.NullNode(this)"
def build_default_node(inp: bpy.types.NodeSocket): """Creates a new node to give a not connected input socket a value""" is_custom_socket = isinstance(inp, arm.logicnode.arm_sockets.ArmCustomSocket) if is_custom_socket: # ArmCustomSockets need to implement get_default_value() default_value = inp.get_default_value() if isinstance(default_value, str): default_value = '"{:s}"'.format(default_value.replace('"', '\\"')) inp_type = inp.arm_socket_type # any custom socket's `type` is "VALUE". might as well have valuable type information for custom nodes as well. else: default_value = inp.default_value if isinstance(default_value, str): default_value = '"{:s}"'.format(default_value.replace('"', '\\"')) inp_type = inp.type # Don't write 'None' into the Haxe code if default_value is None: default_value = "null" if inp_type == "VECTOR": return f"new armory.logicnode.VectorNode(this, {default_value[0]}, {default_value[1]}, {default_value[2]})" elif inp_type == "RGBA": return f"new armory.logicnode.ColorNode(this, {default_value[0]}, {default_value[1]}, {default_value[2]}, {default_value[3]})" elif inp_type == "RGB": return f"new armory.logicnode.ColorNode(this, {default_value[0]}, {default_value[1]}, {default_value[2]})" elif inp_type == "VALUE": return f"new armory.logicnode.FloatNode(this, {default_value})" elif inp_type == "INT": return f"new armory.logicnode.IntegerNode(this, {default_value})" elif inp_type == "BOOLEAN": return f"new armory.logicnode.BooleanNode(this, {str(default_value).lower()})" elif inp_type == "STRING": return f"new armory.logicnode.StringNode(this, {default_value})" elif inp_type == "NONE": return "new armory.logicnode.NullNode(this)" elif inp_type == "OBJECT": return f"new armory.logicnode.ObjectNode(this, {default_value})" elif is_custom_socket: return f"new armory.logicnode.DynamicNode(this, {default_value})" else: return "new armory.logicnode.NullNode(this)"
https://github.com/armory3d/armory/issues/1870
Error: Traceback (most recent call last): File "D:\Armory\ArmorySDK//armory/blender\arm\props_ui.py", line 543, in execute make.play() File "D:\Armory\ArmorySDK//armory/blender\arm\make.py", line 482, in play build(target=runtime_to_target(), is_play=True) File "D:\Armory\ArmorySDK//armory/blender\arm\make.py", line 370, in build export_data(fp, sdk_path) File "D:\Armory\ArmorySDK//armory/blender\arm\make.py", line 94, in export_data make_logic.build() File "D:\Armory\ArmorySDK//armory/blender\arm\make_logic.py", line 32, in build build_node_tree(tree) File "D:\Armory\ArmorySDK//armory/blender\arm\make_logic.py", line 80, in build_node_tree build_node(node, f) File "D:\Armory\ArmorySDK//armory/blender\arm\make_logic.py", line 184, in build_node inp_name = build_default_node(inp) File "D:\Armory\ArmorySDK//armory/blender\arm\make_logic.py", line 259, in build_default_node default_value = inp.default_value AttributeError: 'NodeSocketShader' object has no attribute 'default_value'
AttributeError
def property0(self): return ( arm.utils.safesrc(bpy.data.worlds["Arm"].arm_project_package) + ".node." + arm.utils.safesrc(self.property0_.name) )
def property0(self): return ( arm.utils.safesrc(bpy.data.worlds["Arm"].arm_project_package) + ".node." + arm.utils.safesrc(self.property0_) )
https://github.com/armory3d/armory/issues/1576
Traceback (most recent call last): File "/home/dzynek/Armory3D/ArmorySDK2002/ArmorySDK//armory/blender/arm/props_ui.py", line 457, in execute make.play() File "/home/dzynek/Armory3D/ArmorySDK2002/ArmorySDK//armory/blender/arm/make.py", line 474, in play build(target=runtime_to_target(), is_play=True) File "/home/dzynek/Armory3D/ArmorySDK2002/ArmorySDK//armory/blender/arm/make.py", line 358, in build export_data(fp, sdk_path) File "/home/dzynek/Armory3D/ArmorySDK2002/ArmorySDK//armory/blender/arm/make.py", line 93, in export_data make_logic.build() File "/home/dzynek/Armory3D/ArmorySDK2002/ArmorySDK//armory/blender/arm/make_logic.py", line 32, in build build_node_tree(tree) File "/home/dzynek/Armory3D/ArmorySDK2002/ArmorySDK//armory/blender/arm/make_logic.py", line 59, in build_node_tree prop = getattr(node, 'property0') File "/home/dzynek/Armory3D/ArmorySDK2002/ArmorySDK//armory/blender/arm/logicnode/action_call_group.py", line 15, in property0 return arm.utils.safesrc(bpy.data.worlds['Arm'].arm_project_package) + '.node.' + arm.utils.safesrc(self.property0_) File "/home/dzynek/Armory3D/ArmorySDK2002/ArmorySDK//armory/blender/arm/utils.py", line 524, in safesrc s = safestr(s).replace('.', '_').replace('-', '_').replace(' ', '') File "/home/dzynek/Armory3D/ArmorySDK2002/ArmorySDK//armory/blender/arm/utils.py", line 531, in safestr s = s.replace(c, '_') AttributeError: 'ArmLogicTree' object has no attribute 'replace' location: <unknown location>:-1 location: <unknown location>:-1 Error: Traceback (most recent call last): File "/home/dzynek/Armory3D/ArmorySDK2002/ArmorySDK//armory/blender/arm/props_ui.py", line 457, in execute make.play() File "/home/dzynek/Armory3D/ArmorySDK2002/ArmorySDK//armory/blender/arm/make.py", line 474, in play build(target=runtime_to_target(), is_play=True) File "/home/dzynek/Armory3D/ArmorySDK2002/ArmorySDK//armory/blender/arm/make.py", line 358, in build export_data(fp, sdk_path) File "/home/dzynek/Armory3D/ArmorySDK2002/ArmorySDK//armory/blender/arm/make.py", line 93, in export_data make_logic.build() File "/home/dzynek/Armory3D/ArmorySDK2002/ArmorySDK//armory/blender/arm/make_logic.py", line 32, in build build_node_tree(tree) File "/home/dzynek/Armory3D/ArmorySDK2002/ArmorySDK//armory/blender/arm/make_logic.py", line 59, in build_node_tree prop = getattr(node, 'property0') File "/home/dzynek/Armory3D/ArmorySDK2002/ArmorySDK//armory/blender/arm/logicnode/action_call_group.py", line 15, in property0 return arm.utils.safesrc(bpy.data.worlds['Arm'].arm_project_package) + '.node.' + arm.utils.safesrc(self.property0_) File "/home/dzynek/Armory3D/ArmorySDK2002/ArmorySDK//armory/blender/arm/utils.py", line 524, in safesrc s = safestr(s).replace('.', '_').replace('-', '_').replace(' ', '') File "/home/dzynek/Armory3D/ArmorySDK2002/ArmorySDK//armory/blender/arm/utils.py", line 531, in safestr s = s.replace(c, '_') AttributeError: 'ArmLogicTree' object has no attribute 'replace' location: <unknown location>:-1
AttributeError
def get_files_number(self, filter_info=None): from funcy import ilen if not self.use_cache or not self.hash_info: return 0 if not self.hash_info.isdir: return 1 if not filter_info or filter_info == self.path_info: return self.hash_info.nfiles or 0 if not self.hash_info.dir_info: return 0 return ilen( filter_info.isin_or_eq(self.path_info.joinpath(*relpath)) for relpath, _ in self.hash_info.dir_info.items() )
def get_files_number(self, filter_info=None): from funcy import ilen if not self.use_cache or not self.hash_info: return 0 if not self.hash_info.isdir: return 1 if not filter_info or filter_info == self.path_info: return self.hash_info.nfiles or 0 if not self.hash_info.dir_info: return 0 return ilen( filter_info.isin_or_eq(self.path_info / relpath) for relpath, _ in self.hash_info.dir_info.items() )
https://github.com/iterative/dvc/issues/5577
$ dvc pull baz/bar -v 2021-03-09 15:17:11,217 DEBUG: Check for update is enabled. 2021-03-09 15:17:11,234 DEBUG: Checking if stage 'baz/bar' is in 'dvc.yaml' 2021-03-09 15:17:12,011 DEBUG: Preparing to download data from 'gs://batuhan-test/' 2021-03-09 15:17:12,012 DEBUG: Preparing to collect status from gs://batuhan-test/ 2021-03-09 15:17:12,012 DEBUG: Collecting information from local cache... 2021-03-09 15:17:12,015 DEBUG: state save (4070797, 1615292181377594880, 200) 53e90b7e63e793997644b8d25ab13618.dir 2021-03-09 15:17:12,020 DEBUG: state save (4070801, 1615292182017608704, 4) 258622b1688250cb619f3c9ccaefb7eb 2021-03-09 15:17:12,021 DEBUG: Checking if stage 'baz/bar' is in 'dvc.yaml' ('bar', 'baz') 2021-03-09 15:17:12,032 ERROR: unexpected error - unsupported operand type(s) for /: 'PosixPathInfo' and 'tuple' ------------------------------------------------------------ Traceback (most recent call last): File "/home/isidentical/dvc/dvc/main.py", line 50, in main ret = cmd.run() File "/home/isidentical/dvc/dvc/command/data_sync.py", line 29, in run stats = self.repo.pull( File "/home/isidentical/dvc/dvc/repo/__init__.py", line 49, in wrapper return f(repo, *args, **kwargs) File "/home/isidentical/dvc/dvc/repo/pull.py", line 40, in pull stats = self.checkout( File "/home/isidentical/dvc/dvc/repo/__init__.py", line 49, in wrapper return f(repo, *args, **kwargs) File "/home/isidentical/dvc/dvc/repo/checkout.py", line 104, in checkout total = get_all_files_numbers(pairs) File "/home/isidentical/dvc/dvc/repo/checkout.py", line 45, in get_all_files_numbers return sum( File "/home/isidentical/dvc/dvc/repo/checkout.py", line 46, in <genexpr> stage.get_all_files_number(filter_info) for stage, filter_info in pairs File "/home/isidentical/dvc/dvc/stage/__init__.py", line 611, in get_all_files_number return sum( File "/home/isidentical/dvc/dvc/stage/__init__.py", line 612, in <genexpr> out.get_files_number(filter_info) File "/home/isidentical/dvc/dvc/output/base.py", line 477, in get_files_number return ilen( File "/home/isidentical/.venv38/lib/python3.8/site-packages/funcy/seqs.py", line 105, in ilen deque(zip(seq, counter), maxlen=0) # (consume at C speed) File "/home/isidentical/dvc/dvc/output/base.py", line 478, in <genexpr> print(relpath) or filter_info.isin_or_eq(self.path_info / relpath) TypeError: unsupported operand type(s) for /: 'PosixPathInfo' and 'tuple' ------------------------------------------------------------ 2021-03-09 15:17:12,353 DEBUG: Version info for developers: DVC version: 2.0.3+e0a034.mod --------------------------------- Platform: Python 3.8.5+ on Linux-5.4.0-66-generic-x86_64-with-glibc2.29 Supports: All remotes Cache types: hardlink, symlink Cache directory: ext4 on /dev/sda7 Caches: local Remotes: gs Workspace directory: ext4 on /dev/sda7 Repo: dvc, git Having any troubles? Hit us up at https://dvc.org/support, we are always happy to help!
TypeError
def __init__(self, fobj): self.fobj = fobj self.md5 = hashlib.md5() self.is_text_file = None super().__init__()
def __init__(self, fobj): self.md5 = hashlib.md5() self.is_text_file = None self.reader = fobj.read1 if hasattr(fobj, "read1") else fobj.read
https://github.com/iterative/dvc/issues/5506
dvc add --to-remote -o datasets/my-dataset/ --file my-dataset.dvc afile.zip --verbose 2021-02-23 08:28:44,338 DEBUG: Check for update is enabled. Adding... 2021-02-23 08:28:46,408 ERROR: unexpected error - 'HashedStreamReader' object has no attribute 'tell' ------------------------------------------------------------ Traceback (most recent call last): File "/usr/local/anaconda3/lib/python3.7/site-packages/dvc/main.py", line 50, in main ret = cmd.run() File "/usr/local/anaconda3/lib/python3.7/site-packages/dvc/command/add.py", line 32, in run jobs=self.args.jobs, File "/usr/local/anaconda3/lib/python3.7/site-packages/dvc/repo/__init__.py", line 49, in wrapper return f(repo, *args, **kwargs) File "/usr/local/anaconda3/lib/python3.7/site-packages/dvc/repo/scm_context.py", line 14, in run return method(repo, *args, **kw) File "/usr/local/anaconda3/lib/python3.7/site-packages/dvc/repo/add.py", line 131, in add **kwargs, File "/usr/local/anaconda3/lib/python3.7/site-packages/dvc/repo/add.py", line 172, in _process_stages command="add", File "/usr/local/anaconda3/lib/python3.7/site-packages/dvc/data_cloud.py", line 111, in transfer return remote.transfer(from_fs, from_fs.path_info, jobs=jobs) File "/usr/local/anaconda3/lib/python3.7/site-packages/dvc/remote/base.py", line 520, in transfer no_progress_bar=no_progress_bar, File "/usr/local/anaconda3/lib/python3.7/site-packages/dvc/objects/__init__.py", line 312, in transfer tmp_info, hash_info = _transfer_file(odb, from_fs, from_info) File "/usr/local/anaconda3/lib/python3.7/site-packages/dvc/objects/__init__.py", line 254, in _transfer_file desc=from_info.name, File "/usr/local/anaconda3/lib/python3.7/site-packages/dvc/fs/base.py", line 256, in upload_fobj self._upload_fobj(wrapped, to_info) # pylint: disable=no-member File "/usr/local/anaconda3/lib/python3.7/site-packages/dvc/fs/gs.py", line 203, in _upload_fobj _upload_to_bucket(bucket, fobj, to_info) File "/usr/local/anaconda3/lib/python3.7/site-packages/dvc/fs/gs.py", line 38, in wrapper return func(*args, chunk_size=chunk_size, **kwargs) File "/usr/local/anaconda3/lib/python3.7/site-packages/dvc/fs/gs.py", line 50, in _upload_to_bucket blob.upload_from_file(fobj) File "/usr/local/anaconda3/lib/python3.7/site-packages/google/cloud/storage/blob.py", line 1167, in upload_from_file client, file_obj, content_type, size, num_retries, predefined_acl File "/usr/local/anaconda3/lib/python3.7/site-packages/google/cloud/storage/blob.py", line 1077, in _do_upload client, stream, content_type, size, num_retries, predefined_acl File "/usr/local/anaconda3/lib/python3.7/site-packages/google/cloud/storage/blob.py", line 1020, in _do_resumable_upload predefined_acl=predefined_acl, File "/usr/local/anaconda3/lib/python3.7/site-packages/google/cloud/storage/blob.py", line 969, in _initiate_resumable_upload stream_final=False, File "/usr/local/anaconda3/lib/python3.7/site-packages/google/resumable_media/requests/upload.py", line 402, in initiate stream_final=stream_final, File "/usr/local/anaconda3/lib/python3.7/site-packages/google/resumable_media/_upload.py", line 463, in _prepare_initiate_request if stream.tell() != 0: File "/usr/local/anaconda3/lib/python3.7/site-packages/tqdm/utils.py", line 88, in __getattr__ return getattr(self._wrapped, name) AttributeError: 'HashedStreamReader' object has no attribute 'tell' ------------------------------------------------------------ 2021-02-23 08:28:47,265 DEBUG: Version info for developers: DVC version: 2.0.0a0+27c240 --------------------------------- Platform: Python 3.7.3 on Darwin-20.3.0-x86_64-i386-64bit Supports: All remotes Cache types: <https://error.dvc.org/no-dvc-cache> Caches: local Remotes: gs Workspace directory: apfs on /dev/disk1s5s1 Repo: dvc, git Having any troubles? Hit us up at https://dvc.org/support, we are always happy to help! 2021-02-23 08:28:47,267 DEBUG: Analytics is enabled. 2021-02-23 08:28:47,534 DEBUG: Trying to spawn '['daemon', '-q', 'analytics', '/var/folders/vx/n884kynx5ps8hksttp4mwl64010gl8/T/tmpeo2oe0g6']' 2021-02-23 08:28:47,536 DEBUG: Spawned '['daemon', '-q', 'analytics', '/var/folders/vx/n884kynx5ps8hksttp4mwl64010gl8/T/tmpeo2oe0g6']'
AttributeError
def read(self, n=-1): chunk = self._reader(n) if self.is_text_file is None: self.is_text_file = istextblock(chunk) if self.is_text_file: data = dos2unix(chunk) else: data = chunk self.md5.update(data) return chunk
def read(self, n=-1): chunk = self.reader(n) if self.is_text_file is None: self.is_text_file = istextblock(chunk) if self.is_text_file: data = dos2unix(chunk) else: data = chunk self.md5.update(data) return chunk
https://github.com/iterative/dvc/issues/5506
dvc add --to-remote -o datasets/my-dataset/ --file my-dataset.dvc afile.zip --verbose 2021-02-23 08:28:44,338 DEBUG: Check for update is enabled. Adding... 2021-02-23 08:28:46,408 ERROR: unexpected error - 'HashedStreamReader' object has no attribute 'tell' ------------------------------------------------------------ Traceback (most recent call last): File "/usr/local/anaconda3/lib/python3.7/site-packages/dvc/main.py", line 50, in main ret = cmd.run() File "/usr/local/anaconda3/lib/python3.7/site-packages/dvc/command/add.py", line 32, in run jobs=self.args.jobs, File "/usr/local/anaconda3/lib/python3.7/site-packages/dvc/repo/__init__.py", line 49, in wrapper return f(repo, *args, **kwargs) File "/usr/local/anaconda3/lib/python3.7/site-packages/dvc/repo/scm_context.py", line 14, in run return method(repo, *args, **kw) File "/usr/local/anaconda3/lib/python3.7/site-packages/dvc/repo/add.py", line 131, in add **kwargs, File "/usr/local/anaconda3/lib/python3.7/site-packages/dvc/repo/add.py", line 172, in _process_stages command="add", File "/usr/local/anaconda3/lib/python3.7/site-packages/dvc/data_cloud.py", line 111, in transfer return remote.transfer(from_fs, from_fs.path_info, jobs=jobs) File "/usr/local/anaconda3/lib/python3.7/site-packages/dvc/remote/base.py", line 520, in transfer no_progress_bar=no_progress_bar, File "/usr/local/anaconda3/lib/python3.7/site-packages/dvc/objects/__init__.py", line 312, in transfer tmp_info, hash_info = _transfer_file(odb, from_fs, from_info) File "/usr/local/anaconda3/lib/python3.7/site-packages/dvc/objects/__init__.py", line 254, in _transfer_file desc=from_info.name, File "/usr/local/anaconda3/lib/python3.7/site-packages/dvc/fs/base.py", line 256, in upload_fobj self._upload_fobj(wrapped, to_info) # pylint: disable=no-member File "/usr/local/anaconda3/lib/python3.7/site-packages/dvc/fs/gs.py", line 203, in _upload_fobj _upload_to_bucket(bucket, fobj, to_info) File "/usr/local/anaconda3/lib/python3.7/site-packages/dvc/fs/gs.py", line 38, in wrapper return func(*args, chunk_size=chunk_size, **kwargs) File "/usr/local/anaconda3/lib/python3.7/site-packages/dvc/fs/gs.py", line 50, in _upload_to_bucket blob.upload_from_file(fobj) File "/usr/local/anaconda3/lib/python3.7/site-packages/google/cloud/storage/blob.py", line 1167, in upload_from_file client, file_obj, content_type, size, num_retries, predefined_acl File "/usr/local/anaconda3/lib/python3.7/site-packages/google/cloud/storage/blob.py", line 1077, in _do_upload client, stream, content_type, size, num_retries, predefined_acl File "/usr/local/anaconda3/lib/python3.7/site-packages/google/cloud/storage/blob.py", line 1020, in _do_resumable_upload predefined_acl=predefined_acl, File "/usr/local/anaconda3/lib/python3.7/site-packages/google/cloud/storage/blob.py", line 969, in _initiate_resumable_upload stream_final=False, File "/usr/local/anaconda3/lib/python3.7/site-packages/google/resumable_media/requests/upload.py", line 402, in initiate stream_final=stream_final, File "/usr/local/anaconda3/lib/python3.7/site-packages/google/resumable_media/_upload.py", line 463, in _prepare_initiate_request if stream.tell() != 0: File "/usr/local/anaconda3/lib/python3.7/site-packages/tqdm/utils.py", line 88, in __getattr__ return getattr(self._wrapped, name) AttributeError: 'HashedStreamReader' object has no attribute 'tell' ------------------------------------------------------------ 2021-02-23 08:28:47,265 DEBUG: Version info for developers: DVC version: 2.0.0a0+27c240 --------------------------------- Platform: Python 3.7.3 on Darwin-20.3.0-x86_64-i386-64bit Supports: All remotes Cache types: <https://error.dvc.org/no-dvc-cache> Caches: local Remotes: gs Workspace directory: apfs on /dev/disk1s5s1 Repo: dvc, git Having any troubles? Hit us up at https://dvc.org/support, we are always happy to help! 2021-02-23 08:28:47,267 DEBUG: Analytics is enabled. 2021-02-23 08:28:47,534 DEBUG: Trying to spawn '['daemon', '-q', 'analytics', '/var/folders/vx/n884kynx5ps8hksttp4mwl64010gl8/T/tmpeo2oe0g6']' 2021-02-23 08:28:47,536 DEBUG: Spawned '['daemon', '-q', 'analytics', '/var/folders/vx/n884kynx5ps8hksttp4mwl64010gl8/T/tmpeo2oe0g6']'
AttributeError
def matches(pattern, path, is_dir) -> bool: matches_ = bool(pattern.match(path)) if is_dir: matches_ |= bool(pattern.match(f"{path}/")) return matches_
def matches(self, dirname, basename, is_dir=False): path = self._get_normalize_path(dirname, basename) if not path: return False return self.ignore(path, is_dir)
https://github.com/iterative/dvc/issues/4985
dvc status -v 2020-11-28 16:41:28,063 DEBUG: Check for update is enabled. 2020-11-28 16:41:28,069 DEBUG: fetched: [(3,)] 2020-11-28 16:41:28,073 DEBUG: fetched: [(1404595,)] 2020-11-28 16:41:28,154 ERROR: Path 'fms_unit.csv' is ignored by .dvcignore:1:/* ------------------------------------------------------------ Traceback (most recent call last): File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/command/status.py", line 58, in run recursive=self.args.recursive, File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/repo/__init__.py", line 60, in wrapper return f(repo, *args, **kwargs) File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/repo/status.py", line 152, in status self, targets, with_deps=with_deps, recursive=recursive File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/repo/status.py", line 36, in _local_status return _joint_status(pairs) File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/repo/status.py", line 16, in _joint_status for stage, filter_info in pairs: File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/repo/status.py", line 33, in <genexpr> for t in targets File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/repo/__init__.py", line 358, in collect_granular return [(stage, None) for stage in self.stages] File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/funcy/objects.py", line 28, in __get__ res = instance.__dict__[self.fget.__name__] = self.fget(instance) File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/repo/__init__.py", line 493, in stages return self._collect_stages() File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/repo/__init__.py", line 501, in _collect_stages new_stages = self.get_stages(os.path.join(root, file_name)) File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/repo/__init__.py", line 290, in get_stages return list(dvcfile.stages.values()) File "/usr/lib/python3.7/_collections_abc.py", line 762, in __iter__ yield self._mapping[key] File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/stage/loader.py", line 153, in __getitem__ self.dvcfile, deepcopy(self.stage_data), self.stage_text File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/stage/loader.py", line 164, in load_stage stage.outs = output.loadd_from(stage, d.get(Stage.PARAM_OUTS) or []) File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/output/__init__.py", line 150, in loadd_from desc=desc, File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/output/__init__.py", line 126, in _get desc=desc, File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/output/local.py", line 24, in __init__ super().__init__(stage, path, *args, **kwargs) File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/output/base.py", line 109, in __init__ self._validate_output_path(path, stage) File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/output/base.py", line 535, in _validate_output_path raise cls.IsIgnoredError(check) dvc.output.base.OutputIsIgnoredError: Path 'fms_unit.csv' is ignored by .dvcignore:1:/* ------------------------------------------------------------ 2020-11-28 16:41:28,214 DEBUG: Analytics is enabled. 2020-11-28 16:41:28,251 DEBUG: Trying to spawn '['daemon', '-q', 'analytics', '/tmp/tmp0m393p29']' 2020-11-28 16:41:28,252 DEBUG: Spawned '['daemon', '-q', 'analytics', '/tmp/tmp0m393p29']'
dvc.output.base.OutputIsIgnoredError
def ignore(self, path, is_dir): def matches(pattern, path, is_dir) -> bool: matches_ = bool(pattern.match(path)) if is_dir: matches_ |= bool(pattern.match(f"{path}/")) return matches_ result = False for ignore, pattern in self.ignore_spec[::-1]: if matches(pattern, path, is_dir): result = ignore break return result
def ignore(self, path, is_dir): result = False if is_dir: path_dir = f"{path}/" for ignore, pattern in self.ignore_spec: if pattern.match(path) or pattern.match(path_dir): result = ignore else: for ignore, pattern in self.ignore_spec: if pattern.match(path): result = ignore return result
https://github.com/iterative/dvc/issues/4985
dvc status -v 2020-11-28 16:41:28,063 DEBUG: Check for update is enabled. 2020-11-28 16:41:28,069 DEBUG: fetched: [(3,)] 2020-11-28 16:41:28,073 DEBUG: fetched: [(1404595,)] 2020-11-28 16:41:28,154 ERROR: Path 'fms_unit.csv' is ignored by .dvcignore:1:/* ------------------------------------------------------------ Traceback (most recent call last): File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/command/status.py", line 58, in run recursive=self.args.recursive, File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/repo/__init__.py", line 60, in wrapper return f(repo, *args, **kwargs) File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/repo/status.py", line 152, in status self, targets, with_deps=with_deps, recursive=recursive File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/repo/status.py", line 36, in _local_status return _joint_status(pairs) File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/repo/status.py", line 16, in _joint_status for stage, filter_info in pairs: File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/repo/status.py", line 33, in <genexpr> for t in targets File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/repo/__init__.py", line 358, in collect_granular return [(stage, None) for stage in self.stages] File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/funcy/objects.py", line 28, in __get__ res = instance.__dict__[self.fget.__name__] = self.fget(instance) File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/repo/__init__.py", line 493, in stages return self._collect_stages() File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/repo/__init__.py", line 501, in _collect_stages new_stages = self.get_stages(os.path.join(root, file_name)) File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/repo/__init__.py", line 290, in get_stages return list(dvcfile.stages.values()) File "/usr/lib/python3.7/_collections_abc.py", line 762, in __iter__ yield self._mapping[key] File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/stage/loader.py", line 153, in __getitem__ self.dvcfile, deepcopy(self.stage_data), self.stage_text File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/stage/loader.py", line 164, in load_stage stage.outs = output.loadd_from(stage, d.get(Stage.PARAM_OUTS) or []) File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/output/__init__.py", line 150, in loadd_from desc=desc, File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/output/__init__.py", line 126, in _get desc=desc, File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/output/local.py", line 24, in __init__ super().__init__(stage, path, *args, **kwargs) File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/output/base.py", line 109, in __init__ self._validate_output_path(path, stage) File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/output/base.py", line 535, in _validate_output_path raise cls.IsIgnoredError(check) dvc.output.base.OutputIsIgnoredError: Path 'fms_unit.csv' is ignored by .dvcignore:1:/* ------------------------------------------------------------ 2020-11-28 16:41:28,214 DEBUG: Analytics is enabled. 2020-11-28 16:41:28,251 DEBUG: Trying to spawn '['daemon', '-q', 'analytics', '/tmp/tmp0m393p29']' 2020-11-28 16:41:28,252 DEBUG: Spawned '['daemon', '-q', 'analytics', '/tmp/tmp0m393p29']'
dvc.output.base.OutputIsIgnoredError
def _ignore_details(self, path, is_dir: bool): result = [] for (regex, _), pattern_info in list( zip(self.regex_pattern_list, self.pattern_list) ): # skip system pattern if not pattern_info.file_info: continue regex = re.compile(regex) matches = bool(regex.match(path)) if is_dir: matches |= bool(regex.match(f"{path}/")) if matches: result.append(pattern_info.file_info) return result
def _ignore_details(self, path, is_dir): result = [] for ignore, pattern in zip(self.regex_pattern_list, self.pattern_list): regex = re.compile(ignore[0]) # skip system pattern if not pattern.file_info: continue if is_dir: path_dir = f"{path}/" if regex.match(path) or regex.match(path_dir): result.append(pattern.file_info) else: if regex.match(path): result.append(pattern.file_info) return result
https://github.com/iterative/dvc/issues/4985
dvc status -v 2020-11-28 16:41:28,063 DEBUG: Check for update is enabled. 2020-11-28 16:41:28,069 DEBUG: fetched: [(3,)] 2020-11-28 16:41:28,073 DEBUG: fetched: [(1404595,)] 2020-11-28 16:41:28,154 ERROR: Path 'fms_unit.csv' is ignored by .dvcignore:1:/* ------------------------------------------------------------ Traceback (most recent call last): File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/command/status.py", line 58, in run recursive=self.args.recursive, File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/repo/__init__.py", line 60, in wrapper return f(repo, *args, **kwargs) File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/repo/status.py", line 152, in status self, targets, with_deps=with_deps, recursive=recursive File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/repo/status.py", line 36, in _local_status return _joint_status(pairs) File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/repo/status.py", line 16, in _joint_status for stage, filter_info in pairs: File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/repo/status.py", line 33, in <genexpr> for t in targets File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/repo/__init__.py", line 358, in collect_granular return [(stage, None) for stage in self.stages] File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/funcy/objects.py", line 28, in __get__ res = instance.__dict__[self.fget.__name__] = self.fget(instance) File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/repo/__init__.py", line 493, in stages return self._collect_stages() File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/repo/__init__.py", line 501, in _collect_stages new_stages = self.get_stages(os.path.join(root, file_name)) File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/repo/__init__.py", line 290, in get_stages return list(dvcfile.stages.values()) File "/usr/lib/python3.7/_collections_abc.py", line 762, in __iter__ yield self._mapping[key] File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/stage/loader.py", line 153, in __getitem__ self.dvcfile, deepcopy(self.stage_data), self.stage_text File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/stage/loader.py", line 164, in load_stage stage.outs = output.loadd_from(stage, d.get(Stage.PARAM_OUTS) or []) File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/output/__init__.py", line 150, in loadd_from desc=desc, File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/output/__init__.py", line 126, in _get desc=desc, File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/output/local.py", line 24, in __init__ super().__init__(stage, path, *args, **kwargs) File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/output/base.py", line 109, in __init__ self._validate_output_path(path, stage) File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/output/base.py", line 535, in _validate_output_path raise cls.IsIgnoredError(check) dvc.output.base.OutputIsIgnoredError: Path 'fms_unit.csv' is ignored by .dvcignore:1:/* ------------------------------------------------------------ 2020-11-28 16:41:28,214 DEBUG: Analytics is enabled. 2020-11-28 16:41:28,251 DEBUG: Trying to spawn '['daemon', '-q', 'analytics', '/tmp/tmp0m393p29']' 2020-11-28 16:41:28,252 DEBUG: Spawned '['daemon', '-q', 'analytics', '/tmp/tmp0m393p29']'
dvc.output.base.OutputIsIgnoredError
def check_ignore(self, target): # NOTE: can only be used in `dvc check-ignore`, see # https://github.com/iterative/dvc/issues/5046 full_target = os.path.abspath(target) if not self._outside_repo(full_target): dirname, basename = os.path.split(os.path.normpath(full_target)) pattern = self._get_trie_pattern(dirname) if pattern: matches = pattern.matches( dirname, basename, os.path.isdir(full_target), True, ) if matches: return CheckIgnoreResult(target, True, matches) return _no_match(target)
def check_ignore(self, target): full_target = os.path.abspath(target) if not self._outside_repo(full_target): dirname, basename = os.path.split(os.path.normpath(full_target)) pattern = self._get_trie_pattern(dirname) if pattern: matches = pattern.match_details( dirname, basename, os.path.isdir(full_target) ) if matches: return CheckIgnoreResult(target, True, matches) return _no_match(target)
https://github.com/iterative/dvc/issues/4985
dvc status -v 2020-11-28 16:41:28,063 DEBUG: Check for update is enabled. 2020-11-28 16:41:28,069 DEBUG: fetched: [(3,)] 2020-11-28 16:41:28,073 DEBUG: fetched: [(1404595,)] 2020-11-28 16:41:28,154 ERROR: Path 'fms_unit.csv' is ignored by .dvcignore:1:/* ------------------------------------------------------------ Traceback (most recent call last): File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/command/status.py", line 58, in run recursive=self.args.recursive, File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/repo/__init__.py", line 60, in wrapper return f(repo, *args, **kwargs) File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/repo/status.py", line 152, in status self, targets, with_deps=with_deps, recursive=recursive File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/repo/status.py", line 36, in _local_status return _joint_status(pairs) File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/repo/status.py", line 16, in _joint_status for stage, filter_info in pairs: File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/repo/status.py", line 33, in <genexpr> for t in targets File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/repo/__init__.py", line 358, in collect_granular return [(stage, None) for stage in self.stages] File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/funcy/objects.py", line 28, in __get__ res = instance.__dict__[self.fget.__name__] = self.fget(instance) File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/repo/__init__.py", line 493, in stages return self._collect_stages() File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/repo/__init__.py", line 501, in _collect_stages new_stages = self.get_stages(os.path.join(root, file_name)) File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/repo/__init__.py", line 290, in get_stages return list(dvcfile.stages.values()) File "/usr/lib/python3.7/_collections_abc.py", line 762, in __iter__ yield self._mapping[key] File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/stage/loader.py", line 153, in __getitem__ self.dvcfile, deepcopy(self.stage_data), self.stage_text File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/stage/loader.py", line 164, in load_stage stage.outs = output.loadd_from(stage, d.get(Stage.PARAM_OUTS) or []) File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/output/__init__.py", line 150, in loadd_from desc=desc, File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/output/__init__.py", line 126, in _get desc=desc, File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/output/local.py", line 24, in __init__ super().__init__(stage, path, *args, **kwargs) File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/output/base.py", line 109, in __init__ self._validate_output_path(path, stage) File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/output/base.py", line 535, in _validate_output_path raise cls.IsIgnoredError(check) dvc.output.base.OutputIsIgnoredError: Path 'fms_unit.csv' is ignored by .dvcignore:1:/* ------------------------------------------------------------ 2020-11-28 16:41:28,214 DEBUG: Analytics is enabled. 2020-11-28 16:41:28,251 DEBUG: Trying to spawn '['daemon', '-q', 'analytics', '/tmp/tmp0m393p29']' 2020-11-28 16:41:28,252 DEBUG: Spawned '['daemon', '-q', 'analytics', '/tmp/tmp0m393p29']'
dvc.output.base.OutputIsIgnoredError
def is_ignored(self, path): # NOTE: can't use self.check_ignore(path).match for now, see # https://github.com/iterative/dvc/issues/4555 if os.path.isfile(path): return self.is_ignored_file(path) if os.path.isdir(path): return self.is_ignored_dir(path) return self.is_ignored_file(path) or self.is_ignored_dir(path)
def is_ignored(self, path): # NOTE: can't use self.check_ignore(path).match for now, see # https://github.com/iterative/dvc/issues/4555 return self.is_ignored_dir(path) or self.is_ignored_file(path)
https://github.com/iterative/dvc/issues/4985
dvc status -v 2020-11-28 16:41:28,063 DEBUG: Check for update is enabled. 2020-11-28 16:41:28,069 DEBUG: fetched: [(3,)] 2020-11-28 16:41:28,073 DEBUG: fetched: [(1404595,)] 2020-11-28 16:41:28,154 ERROR: Path 'fms_unit.csv' is ignored by .dvcignore:1:/* ------------------------------------------------------------ Traceback (most recent call last): File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/command/status.py", line 58, in run recursive=self.args.recursive, File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/repo/__init__.py", line 60, in wrapper return f(repo, *args, **kwargs) File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/repo/status.py", line 152, in status self, targets, with_deps=with_deps, recursive=recursive File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/repo/status.py", line 36, in _local_status return _joint_status(pairs) File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/repo/status.py", line 16, in _joint_status for stage, filter_info in pairs: File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/repo/status.py", line 33, in <genexpr> for t in targets File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/repo/__init__.py", line 358, in collect_granular return [(stage, None) for stage in self.stages] File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/funcy/objects.py", line 28, in __get__ res = instance.__dict__[self.fget.__name__] = self.fget(instance) File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/repo/__init__.py", line 493, in stages return self._collect_stages() File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/repo/__init__.py", line 501, in _collect_stages new_stages = self.get_stages(os.path.join(root, file_name)) File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/repo/__init__.py", line 290, in get_stages return list(dvcfile.stages.values()) File "/usr/lib/python3.7/_collections_abc.py", line 762, in __iter__ yield self._mapping[key] File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/stage/loader.py", line 153, in __getitem__ self.dvcfile, deepcopy(self.stage_data), self.stage_text File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/stage/loader.py", line 164, in load_stage stage.outs = output.loadd_from(stage, d.get(Stage.PARAM_OUTS) or []) File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/output/__init__.py", line 150, in loadd_from desc=desc, File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/output/__init__.py", line 126, in _get desc=desc, File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/output/local.py", line 24, in __init__ super().__init__(stage, path, *args, **kwargs) File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/output/base.py", line 109, in __init__ self._validate_output_path(path, stage) File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/output/base.py", line 535, in _validate_output_path raise cls.IsIgnoredError(check) dvc.output.base.OutputIsIgnoredError: Path 'fms_unit.csv' is ignored by .dvcignore:1:/* ------------------------------------------------------------ 2020-11-28 16:41:28,214 DEBUG: Analytics is enabled. 2020-11-28 16:41:28,251 DEBUG: Trying to spawn '['daemon', '-q', 'analytics', '/tmp/tmp0m393p29']' 2020-11-28 16:41:28,252 DEBUG: Spawned '['daemon', '-q', 'analytics', '/tmp/tmp0m393p29']'
dvc.output.base.OutputIsIgnoredError
def _validate_output_path(cls, path, stage=None): from dvc.dvcfile import is_valid_filename if is_valid_filename(path): raise cls.IsStageFileError(path) if stage: abs_path = os.path.join(stage.wdir, path) if stage.repo.tree.dvcignore.is_ignored(abs_path): check = stage.repo.tree.dvcignore.check_ignore(abs_path) raise cls.IsIgnoredError(check)
def _validate_output_path(cls, path, stage=None): from dvc.dvcfile import is_valid_filename if is_valid_filename(path): raise cls.IsStageFileError(path) if stage: check = stage.repo.tree.dvcignore.check_ignore(path) if check.match: raise cls.IsIgnoredError(check)
https://github.com/iterative/dvc/issues/4985
dvc status -v 2020-11-28 16:41:28,063 DEBUG: Check for update is enabled. 2020-11-28 16:41:28,069 DEBUG: fetched: [(3,)] 2020-11-28 16:41:28,073 DEBUG: fetched: [(1404595,)] 2020-11-28 16:41:28,154 ERROR: Path 'fms_unit.csv' is ignored by .dvcignore:1:/* ------------------------------------------------------------ Traceback (most recent call last): File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/command/status.py", line 58, in run recursive=self.args.recursive, File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/repo/__init__.py", line 60, in wrapper return f(repo, *args, **kwargs) File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/repo/status.py", line 152, in status self, targets, with_deps=with_deps, recursive=recursive File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/repo/status.py", line 36, in _local_status return _joint_status(pairs) File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/repo/status.py", line 16, in _joint_status for stage, filter_info in pairs: File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/repo/status.py", line 33, in <genexpr> for t in targets File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/repo/__init__.py", line 358, in collect_granular return [(stage, None) for stage in self.stages] File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/funcy/objects.py", line 28, in __get__ res = instance.__dict__[self.fget.__name__] = self.fget(instance) File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/repo/__init__.py", line 493, in stages return self._collect_stages() File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/repo/__init__.py", line 501, in _collect_stages new_stages = self.get_stages(os.path.join(root, file_name)) File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/repo/__init__.py", line 290, in get_stages return list(dvcfile.stages.values()) File "/usr/lib/python3.7/_collections_abc.py", line 762, in __iter__ yield self._mapping[key] File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/stage/loader.py", line 153, in __getitem__ self.dvcfile, deepcopy(self.stage_data), self.stage_text File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/stage/loader.py", line 164, in load_stage stage.outs = output.loadd_from(stage, d.get(Stage.PARAM_OUTS) or []) File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/output/__init__.py", line 150, in loadd_from desc=desc, File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/output/__init__.py", line 126, in _get desc=desc, File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/output/local.py", line 24, in __init__ super().__init__(stage, path, *args, **kwargs) File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/output/base.py", line 109, in __init__ self._validate_output_path(path, stage) File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/output/base.py", line 535, in _validate_output_path raise cls.IsIgnoredError(check) dvc.output.base.OutputIsIgnoredError: Path 'fms_unit.csv' is ignored by .dvcignore:1:/* ------------------------------------------------------------ 2020-11-28 16:41:28,214 DEBUG: Analytics is enabled. 2020-11-28 16:41:28,251 DEBUG: Trying to spawn '['daemon', '-q', 'analytics', '/tmp/tmp0m393p29']' 2020-11-28 16:41:28,252 DEBUG: Spawned '['daemon', '-q', 'analytics', '/tmp/tmp0m393p29']'
dvc.output.base.OutputIsIgnoredError
def _filter_missing(repo, paths): repo_tree = RepoTree(repo, stream=True) for path in paths: try: metadata = repo_tree.metadata(path) if metadata.is_dvc: out = metadata.outs[0] if out.status().get(str(out)) == "not in cache": yield path except FileNotFoundError: pass
def _filter_missing(repo, paths): repo_tree = RepoTree(repo, stream=True) for path in paths: metadata = repo_tree.metadata(path) if metadata.is_dvc: out = metadata.outs[0] if out.status().get(str(out)) == "not in cache": yield path
https://github.com/iterative/dvc/issues/5170
$ git status ⏎ On branch master Changes not staged for commit: deleted: .gitignore deleted: foo.txt.dvc no changes added to commit $ dvc diff -v 2020-12-28 15:43:46,270 DEBUG: Check for update is enabled. 2020-12-28 15:43:46,584 ERROR: unexpected error ------------------------------------------------------------ Traceback (most recent call last): File "/Users/pmrowla/git/dvc/dvc/main.py", line 90, in main ret = cmd.run() File "/Users/pmrowla/git/dvc/dvc/command/diff.py", line 131, in run diff = self.repo.diff( File "/Users/pmrowla/git/dvc/dvc/repo/__init__.py", line 53, in wrapper return f(repo, *args, **kwargs) File "/Users/pmrowla/git/dvc/dvc/repo/diff.py", line 60, in diff missing = sorted(_filter_missing(self, deleted_or_missing)) File "/Users/pmrowla/git/dvc/dvc/repo/diff.py", line 151, in _filter_missing metadata = repo_tree.metadata(path) File "/Users/pmrowla/git/dvc/dvc/tree/repo.py", line 446, in metadata raise FileNotFoundError FileNotFoundError ------------------------------------------------------------
FileNotFoundError
def __init__(self, iterator): # pylint: disable=super-init-not-called self.iterator = iterator self.leftover = b""
def __init__(self, iterator): # pylint: disable=super-init-not-called self.iterator = iterator self.leftover = None
https://github.com/iterative/dvc/issues/5021
with dvc.api.open("model.save", mode="rb") as f: ...: x = joblib.load(f) ...: --------------------------------------------------------------------------- UnsupportedOperation Traceback (most recent call last) <ipython-input-36-5d9cb3fe0cb1> in <module> 1 with dvc.api.open("model.save", mode="rb") as f: ----> 2 x = joblib.load(f) 3 ~/repos/iterative/dvc/.env/env38/lib/python3.8/site-packages/joblib/numpy_pickle.py in load(filename, mmap_mode) 572 fobj = filename 573 filename = getattr(fobj, 'name', '') --> 574 with _read_fileobject(fobj, filename, mmap_mode) as fobj: 575 obj = _unpickle(fobj) 576 else: /usr/lib/python3.8/contextlib.py in __enter__(self) 111 del self.args, self.kwds, self.func 112 try: --> 113 return next(self.gen) 114 except StopIteration: 115 raise RuntimeError("generator didn't yield") from None ~/repos/iterative/dvc/.env/env38/lib/python3.8/site-packages/joblib/numpy_pickle_utils.py in _read_fileobject(fileobj, filename, mmap_mode) 122 """ 123 # Detect if the fileobj contains compressed data. --> 124 compressor = _detect_compressor(fileobj) 125 126 if compressor == "compat": ~/repos/iterative/dvc/.env/env38/lib/python3.8/site-packages/joblib/numpy_pickle_utils.py in _detect_compressor(fileobj) 71 # Fallback to seek if the fileobject is not peekable. 72 first_bytes = fileobj.read(max_prefix_len) ---> 73 fileobj.seek(0) 74 75 if first_bytes.startswith(_ZFILE_PREFIX): UnsupportedOperation: seek
RuntimeError
def read1(self, n=-1): try: chunk = self.leftover or next(self.iterator) except StopIteration: return b"" # Return an arbitrary number or bytes if n <= 0: self.leftover = b"" return chunk output, self.leftover = chunk[:n], chunk[n:] return output
def read1(self, n=-1): try: chunk = self.leftover or next(self.iterator) except StopIteration: return b"" # Return an arbitrary number or bytes if n <= 0: self.leftover = None return chunk output, self.leftover = chunk[:n], chunk[n:] return output
https://github.com/iterative/dvc/issues/5021
with dvc.api.open("model.save", mode="rb") as f: ...: x = joblib.load(f) ...: --------------------------------------------------------------------------- UnsupportedOperation Traceback (most recent call last) <ipython-input-36-5d9cb3fe0cb1> in <module> 1 with dvc.api.open("model.save", mode="rb") as f: ----> 2 x = joblib.load(f) 3 ~/repos/iterative/dvc/.env/env38/lib/python3.8/site-packages/joblib/numpy_pickle.py in load(filename, mmap_mode) 572 fobj = filename 573 filename = getattr(fobj, 'name', '') --> 574 with _read_fileobject(fobj, filename, mmap_mode) as fobj: 575 obj = _unpickle(fobj) 576 else: /usr/lib/python3.8/contextlib.py in __enter__(self) 111 del self.args, self.kwds, self.func 112 try: --> 113 return next(self.gen) 114 except StopIteration: 115 raise RuntimeError("generator didn't yield") from None ~/repos/iterative/dvc/.env/env38/lib/python3.8/site-packages/joblib/numpy_pickle_utils.py in _read_fileobject(fileobj, filename, mmap_mode) 122 """ 123 # Detect if the fileobj contains compressed data. --> 124 compressor = _detect_compressor(fileobj) 125 126 if compressor == "compat": ~/repos/iterative/dvc/.env/env38/lib/python3.8/site-packages/joblib/numpy_pickle_utils.py in _detect_compressor(fileobj) 71 # Fallback to seek if the fileobject is not peekable. 72 first_bytes = fileobj.read(max_prefix_len) ---> 73 fileobj.seek(0) 74 75 if first_bytes.startswith(_ZFILE_PREFIX): UnsupportedOperation: seek
RuntimeError
def commit( cls, scm: "Git", exp_hash: str, exp_name: Optional[str] = None, force: bool = False, checkpoint: bool = False, ): """Commit stages as an experiment and return the commit SHA.""" rev = scm.get_rev() if not scm.is_dirty(untracked_files=True): logger.debug("No changes to commit") raise UnchangedExperimentError(rev) branch = scm.get_ref(EXEC_BRANCH, follow=False) if branch: old_ref = rev logger.debug("Commit to current experiment branch '%s'", branch) else: baseline_rev = scm.get_ref(EXEC_BASELINE) name = exp_name if exp_name else f"exp-{exp_hash[:5]}" ref_info = ExpRefInfo(baseline_rev, name) branch = str(ref_info) old_ref = None if not force and scm.get_ref(branch): if checkpoint: raise CheckpointExistsError(ref_info.name) raise ExperimentExistsError(ref_info.name) logger.debug("Commit to new experiment branch '%s'", branch) scm.gitpython.repo.git.add(update=True) scm.commit(f"dvc: commit experiment {exp_hash}", no_verify=True) new_rev = scm.get_rev() scm.set_ref(branch, new_rev, old_ref=old_ref) scm.set_ref(EXEC_BRANCH, branch, symbolic=True) if checkpoint: scm.set_ref(EXEC_CHECKPOINT, new_rev) return new_rev
def commit( cls, scm: "Git", exp_hash: str, exp_name: Optional[str] = None, force: bool = False, checkpoint: bool = False, ): """Commit stages as an experiment and return the commit SHA.""" rev = scm.get_rev() if not scm.is_dirty(untracked_files=True): logger.debug("No changes to commit") raise UnchangedExperimentError(rev) branch = scm.get_ref(EXEC_BRANCH, follow=False) if branch: old_ref = rev logger.debug("Commit to current experiment branch '%s'", branch) else: baseline_rev = scm.get_ref(EXEC_BASELINE) name = exp_name if exp_name else f"exp-{exp_hash[:5]}" ref_info = ExpRefInfo(baseline_rev, name) branch = str(ref_info) old_ref = None if not force and scm.get_ref(branch): if checkpoint: raise CheckpointExistsError(ref_info.name) raise ExperimentExistsError(ref_info.name) logger.debug("Commit to new experiment branch '%s'", branch) scm.gitpython.repo.git.add(update=True) scm.commit(f"dvc: commit experiment {exp_hash}") new_rev = scm.get_rev() scm.set_ref(branch, new_rev, old_ref=old_ref) scm.set_ref(EXEC_BRANCH, branch, symbolic=True) if checkpoint: scm.set_ref(EXEC_CHECKPOINT, new_rev) return new_rev
https://github.com/iterative/dvc/issues/5076
Traceback (most recent call last): File "/usr/lib64/python3.7/concurrent/futures/process.py", line 205, in _sendback_result exception=exception)) File "/usr/lib64/python3.7/multiprocessing/queues.py", line 358, in put obj = _ForkingPickler.dumps(obj) File "/usr/lib64/python3.7/multiprocessing/reduction.py", line 51, in dumps cls(buf, protocol).dump(obj) AttributeError: Can't pickle local object 'CommitMsgShellHook.__init__.<locals>.prepare_msg'
AttributeError
def commit(self, msg: str, no_verify: bool = False): pass
def commit(self, msg: str): pass
https://github.com/iterative/dvc/issues/5076
Traceback (most recent call last): File "/usr/lib64/python3.7/concurrent/futures/process.py", line 205, in _sendback_result exception=exception)) File "/usr/lib64/python3.7/multiprocessing/queues.py", line 358, in put obj = _ForkingPickler.dumps(obj) File "/usr/lib64/python3.7/multiprocessing/reduction.py", line 51, in dumps cls(buf, protocol).dump(obj) AttributeError: Can't pickle local object 'CommitMsgShellHook.__init__.<locals>.prepare_msg'
AttributeError
def commit(self, msg: str, no_verify: bool = False): from dulwich.errors import CommitError from dulwich.porcelain import commit try: commit(self.root_dir, message=msg, no_verify=no_verify) except CommitError as exc: raise SCMError("Git commit failed") from exc
def commit(self, msg: str): from dulwich.porcelain import commit commit(self.root_dir, message=msg)
https://github.com/iterative/dvc/issues/5076
Traceback (most recent call last): File "/usr/lib64/python3.7/concurrent/futures/process.py", line 205, in _sendback_result exception=exception)) File "/usr/lib64/python3.7/multiprocessing/queues.py", line 358, in put obj = _ForkingPickler.dumps(obj) File "/usr/lib64/python3.7/multiprocessing/reduction.py", line 51, in dumps cls(buf, protocol).dump(obj) AttributeError: Can't pickle local object 'CommitMsgShellHook.__init__.<locals>.prepare_msg'
AttributeError
def commit(self, msg: str, no_verify: bool = False): from git.exc import HookExecutionError try: self.repo.index.commit(msg, skip_hooks=no_verify) except HookExecutionError as exc: raise SCMError("Git pre-commit hook failed") from exc
def commit(self, msg: str): self.repo.index.commit(msg)
https://github.com/iterative/dvc/issues/5076
Traceback (most recent call last): File "/usr/lib64/python3.7/concurrent/futures/process.py", line 205, in _sendback_result exception=exception)) File "/usr/lib64/python3.7/multiprocessing/queues.py", line 358, in put obj = _ForkingPickler.dumps(obj) File "/usr/lib64/python3.7/multiprocessing/reduction.py", line 51, in dumps cls(buf, protocol).dump(obj) AttributeError: Can't pickle local object 'CommitMsgShellHook.__init__.<locals>.prepare_msg'
AttributeError
def commit(self, msg: str, no_verify: bool = False): raise NotImplementedError
def commit(self, msg: str): raise NotImplementedError
https://github.com/iterative/dvc/issues/5076
Traceback (most recent call last): File "/usr/lib64/python3.7/concurrent/futures/process.py", line 205, in _sendback_result exception=exception)) File "/usr/lib64/python3.7/multiprocessing/queues.py", line 358, in put obj = _ForkingPickler.dumps(obj) File "/usr/lib64/python3.7/multiprocessing/reduction.py", line 51, in dumps cls(buf, protocol).dump(obj) AttributeError: Can't pickle local object 'CommitMsgShellHook.__init__.<locals>.prepare_msg'
AttributeError
def get_url(url, out=None): out = resolve_output(url, out) if os.path.exists(url): url = os.path.abspath(url) out = os.path.abspath(out) (dep,) = dependency.loads_from(None, [url]) (out,) = output.loads_from(None, [out], use_cache=False) if not dep.exists: raise dep.DoesNotExistError(dep) dep.download(out)
def get_url(url, out=None): out = resolve_output(url, out) if os.path.exists(url): url = os.path.abspath(url) out = os.path.abspath(out) (dep,) = dependency.loads_from(None, [url]) (out,) = output.loads_from(None, [out], use_cache=False) if not dep.exists: raise dep.DoesNotExistError(dep) dep.download(out) out.save()
https://github.com/iterative/dvc/issues/5069
2020-12-09 12:24:32,622 DEBUG: Downloading 's3://dvc-temp/ivan/docs/README' to 'docs/docs/README' 2020-12-09 12:24:32,624 DEBUG: Downloading 's3://dvc-temp/ivan/docs/build/doctrees/filelist.doctree' to 'docs/docs/build/doctrees/filelist.doctree' 2020-12-09 12:24:32,624 DEBUG: Downloading 's3://dvc-temp/ivan/docs/build/doctrees/filemanagement.doctree' to 'docs/docs/build/doctrees/filemanagement.doctree' 2020-12-09 12:24:32,624 DEBUG: Downloading 's3://dvc-temp/ivan/docs/build/doctrees/oauth.doctree' to 'docs/docs/build/doctrees/oauth.doctree' 2020-12-09 12:24:32,629 DEBUG: Downloading 's3://dvc-temp/ivan/docs/build/doctrees/quickstart.doctree' to 'docs/docs/build/doctrees/quickstart.doctree' 2020-12-09 12:24:32,629 DEBUG: Downloading 's3://dvc-temp/ivan/docs/build/doctrees/environment.pickle' to 'docs/docs/build/doctrees/environment.pickle' 2020-12-09 12:24:32,630 DEBUG: Downloading 's3://dvc-temp/ivan/docs/build/html/.buildinfo' to 'docs/docs/build/html/.buildinfo' 2020-12-09 12:24:32,630 DEBUG: Downloading 's3://dvc-temp/ivan/docs/build/doctrees/pydrive2.doctree' to 'docs/docs/build/doctrees/pydrive2.doctree' 2020-12-09 12:24:32,630 DEBUG: Downloading 's3://dvc-temp/ivan/docs/build/doctrees/index.doctree' to 'docs/docs/build/doctrees/index.doctree' 2020-12-09 12:24:32,635 DEBUG: Downloading 's3://dvc-temp/ivan/docs/build/html/_sources/filelist.rst.txt' to 'docs/docs/build/html/_sources/filelist.rst.txt' 2020-12-09 12:24:32,635 DEBUG: Downloading 's3://dvc-temp/ivan/docs/build/html/_sources/index.rst.txt' to 'docs/docs/build/html/_sources/index.rst.txt' 2020-12-09 12:24:32,635 DEBUG: Downloading 's3://dvc-temp/ivan/docs/build/html/_sources/filemanagement.rst.txt' to 'docs/docs/build/html/_sources/filemanagement.rst.txt' 2020-12-09 12:24:32,635 DEBUG: Downloading 's3://dvc-temp/ivan/docs/build/html/_sources/oauth.rst.txt' to 'docs/docs/build/html/_sources/oauth.rst.txt' 2020-12-09 12:24:32,641 DEBUG: Downloading 's3://dvc-temp/ivan/docs/build/html/_sources/pydrive2.rst.txt' to 'docs/docs/build/html/_sources/pydrive2.rst.txt' 2020-12-09 12:24:32,641 DEBUG: Downloading 's3://dvc-temp/ivan/docs/build/html/_sources/quickstart.rst.txt' to 'docs/docs/build/html/_sources/quickstart.rst.txt' 2020-12-09 12:24:32,641 DEBUG: Downloading 's3://dvc-temp/ivan/docs/build/html/_static/basic.css' to 'docs/docs/build/html/_static/basic.css' 2020-12-09 12:24:32,643 DEBUG: Downloading 's3://dvc-temp/ivan/docs/build/html/_static/css/badge_only.css' to 'docs/docs/build/html/_static/css/badge_only.css' 2020-12-09 12:24:32,643 DEBUG: Downloading 's3://dvc-temp/ivan/docs/build/html/_static/css/fonts/Roboto-Slab-Bold.woff' to 'docs/docs/build/html/_static/css/fonts/Roboto-Slab-Bold.woff' 2020-12-09 12:24:32,648 DEBUG: Downloading 's3://dvc-temp/ivan/docs/build/html/_static/css/fonts/Roboto-Slab-Bold.woff2' to 'docs/docs/build/html/_static/css/fonts/Roboto-Slab-Bold.woff2' 2020-12-09 12:24:32,648 DEBUG: Downloading 's3://dvc-temp/ivan/docs/build/html/_static/css/fonts/Roboto-Slab-Regular.woff' to 'docs/docs/build/html/_static/css/fonts/Roboto-Slab-Regular.woff' 2020-12-09 12:24:32,649 DEBUG: Downloading 's3://dvc-temp/ivan/docs/build/html/_static/css/fonts/Roboto-Slab-Regular.woff2' to 'docs/docs/build/html/_static/css/fonts/Roboto-Slab-Regular.woff2' 2020-12-09 12:24:32,653 DEBUG: Downloading 's3://dvc-temp/ivan/docs/build/html/_static/css/fonts/fontawesome-webfont.eot' to 'docs/docs/build/html/_static/css/fonts/fontawesome-webfont.eot' 2020-12-09 12:24:32,653 DEBUG: Downloading 's3://dvc-temp/ivan/docs/build/html/_static/css/fonts/fontawesome-webfont.svg' to 'docs/docs/build/html/_static/css/fonts/fontawesome-webfont.svg' 2020-12-09 12:24:32,654 DEBUG: Downloading 's3://dvc-temp/ivan/docs/build/html/_static/css/fonts/fontawesome-webfont.ttf' to 'docs/docs/build/html/_static/css/fonts/fontawesome-webfont.ttf' 2020-12-09 12:24:32,658 DEBUG: Downloading 's3://dvc-temp/ivan/docs/build/html/_static/css/fonts/fontawesome-webfont.woff2' to 'docs/docs/build/html/_static/css/fonts/fontawesome-webfont.woff2' 2020-12-09 12:24:32,658 DEBUG: Downloading 's3://dvc-temp/ivan/docs/build/html/_static/css/fonts/fontawesome-webfont.woff' to 'docs/docs/build/html/_static/css/fonts/fontawesome-webfont.woff' 2020-12-09 12:24:32,659 DEBUG: Downloading 's3://dvc-temp/ivan/docs/build/html/_static/css/fonts/lato-bold-italic.woff2' to 'docs/docs/build/html/_static/css/fonts/lato-bold-italic.woff2' 2020-12-09 12:24:32,659 DEBUG: Downloading 's3://dvc-temp/ivan/docs/build/html/_static/css/fonts/lato-bold-italic.woff' to 'docs/docs/build/html/_static/css/fonts/lato-bold-italic.woff' 2020-12-09 12:24:32,663 DEBUG: Downloading 's3://dvc-temp/ivan/docs/build/html/_static/css/fonts/lato-bold.woff' to 'docs/docs/build/html/_static/css/fonts/lato-bold.woff' 2020-12-09 12:24:32,664 DEBUG: Downloading 's3://dvc-temp/ivan/docs/build/html/_static/css/fonts/lato-bold.woff2' to 'docs/docs/build/html/_static/css/fonts/lato-bold.woff2' 2020-12-09 12:24:32,672 DEBUG: Downloading 's3://dvc-temp/ivan/docs/build/html/_static/css/fonts/lato-normal-italic.woff' to 'docs/docs/build/html/_static/css/fonts/lato-normal-italic.woff' 2020-12-09 12:24:32,672 DEBUG: Downloading 's3://dvc-temp/ivan/docs/build/html/_static/css/fonts/lato-normal-italic.woff2' to 'docs/docs/build/html/_static/css/fonts/lato-normal-italic.woff2' 2020-12-09 12:24:33,019 DEBUG: Downloading 's3://dvc-temp/ivan/docs/build/html/_static/css/fonts/lato-normal.woff' to 'docs/docs/build/html/_static/css/fonts/lato-normal.woff' 2020-12-09 12:24:33,034 DEBUG: Downloading 's3://dvc-temp/ivan/docs/build/html/_static/css/fonts/lato-normal.woff2' to 'docs/docs/build/html/_static/css/fonts/lato-normal.woff2' 2020-12-09 12:24:33,061 DEBUG: Downloading 's3://dvc-temp/ivan/docs/build/html/_static/css/theme.css' to 'docs/docs/build/html/_static/css/theme.css' 2020-12-09 12:24:33,066 DEBUG: Downloading 's3://dvc-temp/ivan/docs/build/html/_static/doctools.js' to 'docs/docs/build/html/_static/doctools.js' 2020-12-09 12:24:33,076 DEBUG: Downloading 's3://dvc-temp/ivan/docs/build/html/_static/documentation_options.js' to 'docs/docs/build/html/_static/documentation_options.js' 2020-12-09 12:24:33,077 DEBUG: Downloading 's3://dvc-temp/ivan/docs/build/html/_static/fonts/FontAwesome.otf' to 'docs/docs/build/html/_static/fonts/FontAwesome.otf' 2020-12-09 12:24:33,077 DEBUG: Downloading 's3://dvc-temp/ivan/docs/build/html/_static/file.png' to 'docs/docs/build/html/_static/file.png' 2020-12-09 12:24:33,086 DEBUG: Downloading 's3://dvc-temp/ivan/docs/build/html/_static/fonts/Lato/lato-bold.woff2' to 'docs/docs/build/html/_static/fonts/Lato/lato-bold.woff2' 2020-12-09 12:24:33,087 DEBUG: Downloading 's3://dvc-temp/ivan/docs/build/html/_static/fonts/Lato/lato-bolditalic.eot' to 'docs/docs/build/html/_static/fonts/Lato/lato-bolditalic.eot' 2020-12-09 12:24:33,090 DEBUG: Downloading 's3://dvc-temp/ivan/docs/build/html/_static/fonts/Lato/lato-bold.ttf' to 'docs/docs/build/html/_static/fonts/Lato/lato-bold.ttf' 2020-12-09 12:24:33,090 DEBUG: Downloading 's3://dvc-temp/ivan/docs/build/html/_static/fonts/Lato/lato-bold.eot' to 'docs/docs/build/html/_static/fonts/Lato/lato-bold.eot' 2020-12-09 12:24:33,090 DEBUG: Downloading 's3://dvc-temp/ivan/docs/build/html/_static/fonts/Lato/lato-bold.woff' to 'docs/docs/build/html/_static/fonts/Lato/lato-bold.woff' 2020-12-09 12:24:33,096 DEBUG: Downloading 's3://dvc-temp/ivan/docs/build/html/_static/fonts/Lato/lato-bolditalic.ttf' to 'docs/docs/build/html/_static/fonts/Lato/lato-bolditalic.ttf' 2020-12-09 12:24:33,112 DEBUG: Downloading 's3://dvc-temp/ivan/docs/build/html/_static/fonts/Lato/lato-bolditalic.woff' to 'docs/docs/build/html/_static/fonts/Lato/lato-bolditalic.woff' 2020-12-09 12:24:33,112 DEBUG: Downloading 's3://dvc-temp/ivan/docs/build/html/_static/fonts/Lato/lato-bolditalic.woff2' to 'docs/docs/build/html/_static/fonts/Lato/lato-bolditalic.woff2' 2020-12-09 12:24:33,128 DEBUG: Downloading 's3://dvc-temp/ivan/docs/build/html/_static/fonts/Lato/lato-italic.eot' to 'docs/docs/build/html/_static/fonts/Lato/lato-italic.eot' 2020-12-09 12:24:33,155 DEBUG: Downloading 's3://dvc-temp/ivan/docs/build/html/_static/fonts/Lato/lato-italic.ttf' to 'docs/docs/build/html/_static/fonts/Lato/lato-italic.ttf' 2020-12-09 12:24:33,171 DEBUG: Downloading 's3://dvc-temp/ivan/docs/build/html/_static/fonts/Lato/lato-italic.woff' to 'docs/docs/build/html/_static/fonts/Lato/lato-italic.woff' 2020-12-09 12:24:33,180 DEBUG: Downloading 's3://dvc-temp/ivan/docs/build/html/_static/fonts/Lato/lato-regular.eot' to 'docs/docs/build/html/_static/fonts/Lato/lato-regular.eot' 2020-12-09 12:24:33,180 DEBUG: Downloading 's3://dvc-temp/ivan/docs/build/html/_static/fonts/Lato/lato-regular.ttf' to 'docs/docs/build/html/_static/fonts/Lato/lato-regular.ttf' 2020-12-09 12:24:33,180 DEBUG: Downloading 's3://dvc-temp/ivan/docs/build/html/_static/fonts/Lato/lato-italic.woff2' to 'docs/docs/build/html/_static/fonts/Lato/lato-italic.woff2' 2020-12-09 12:24:33,187 DEBUG: Downloading 's3://dvc-temp/ivan/docs/build/html/_static/fonts/Lato/lato-regular.woff' to 'docs/docs/build/html/_static/fonts/Lato/lato-regular.woff' 2020-12-09 12:24:33,198 DEBUG: Downloading 's3://dvc-temp/ivan/docs/build/html/_static/fonts/Lato/lato-regular.woff2' to 'docs/docs/build/html/_static/fonts/Lato/lato-regular.woff2' 2020-12-09 12:24:33,224 DEBUG: Downloading 's3://dvc-temp/ivan/docs/build/html/_static/fonts/Roboto-Slab-Bold.woff' to 'docs/docs/build/html/_static/fonts/Roboto-Slab-Bold.woff' 2020-12-09 12:24:33,231 DEBUG: Downloading 's3://dvc-temp/ivan/docs/build/html/_static/fonts/Roboto-Slab-Bold.woff2' to 'docs/docs/build/html/_static/fonts/Roboto-Slab-Bold.woff2' 2020-12-09 12:24:33,234 DEBUG: Downloading 's3://dvc-temp/ivan/docs/build/html/_static/fonts/Roboto-Slab-Light.woff' to 'docs/docs/build/html/_static/fonts/Roboto-Slab-Light.woff' 2020-12-09 12:24:33,247 DEBUG: Downloading 's3://dvc-temp/ivan/docs/build/html/_static/fonts/Roboto-Slab-Light.woff2' to 'docs/docs/build/html/_static/fonts/Roboto-Slab-Light.woff2' 2020-12-09 12:24:33,270 DEBUG: Downloading 's3://dvc-temp/ivan/docs/build/html/_static/fonts/Roboto-Slab-Regular.woff' to 'docs/docs/build/html/_static/fonts/Roboto-Slab-Regular.woff' 2020-12-09 12:24:33,296 DEBUG: Downloading 's3://dvc-temp/ivan/docs/build/html/_static/fonts/Roboto-Slab-Regular.woff2' to 'docs/docs/build/html/_static/fonts/Roboto-Slab-Regular.woff2' 2020-12-09 12:24:33,313 DEBUG: Downloading 's3://dvc-temp/ivan/docs/build/html/_static/fonts/Roboto-Slab-Thin.woff' to 'docs/docs/build/html/_static/fonts/Roboto-Slab-Thin.woff' 2020-12-09 12:24:33,319 DEBUG: Downloading 's3://dvc-temp/ivan/docs/build/html/_static/fonts/Roboto-Slab-Thin.woff2' to 'docs/docs/build/html/_static/fonts/Roboto-Slab-Thin.woff2' 2020-12-09 12:24:33,321 DEBUG: Downloading 's3://dvc-temp/ivan/docs/build/html/_static/fonts/RobotoSlab/roboto-slab-v7-bold.eot' to 'docs/docs/build/html/_static/fonts/RobotoSlab/roboto-slab-v7-bold.eot' 2020-12-09 12:24:33,341 DEBUG: Downloading 's3://dvc-temp/ivan/docs/build/html/_static/fonts/RobotoSlab/roboto-slab-v7-bold.ttf' to 'docs/docs/build/html/_static/fonts/RobotoSlab/roboto-slab-v7-bold.ttf' 2020-12-09 12:24:33,342 DEBUG: Downloading 's3://dvc-temp/ivan/docs/build/html/_static/fonts/RobotoSlab/roboto-slab-v7-bold.woff' to 'docs/docs/build/html/_static/fonts/RobotoSlab/roboto-slab-v7-bold.woff' 2020-12-09 12:24:33,350 DEBUG: Downloading 's3://dvc-temp/ivan/docs/build/html/_static/fonts/RobotoSlab/roboto-slab-v7-bold.woff2' to 'docs/docs/build/html/_static/fonts/RobotoSlab/roboto-slab-v7-bold.woff2' 2020-12-09 12:24:33,366 DEBUG: Downloading 's3://dvc-temp/ivan/docs/build/html/_static/fonts/RobotoSlab/roboto-slab-v7-regular.ttf' to 'docs/docs/build/html/_static/fonts/RobotoSlab/roboto-slab-v7-regular.ttf' 2020-12-09 12:24:33,366 DEBUG: Downloading 's3://dvc-temp/ivan/docs/build/html/_static/fonts/RobotoSlab/roboto-slab-v7-regular.eot' to 'docs/docs/build/html/_static/fonts/RobotoSlab/roboto-slab-v7-regular.eot' 2020-12-09 12:24:33,389 DEBUG: Downloading 's3://dvc-temp/ivan/docs/build/html/_static/fonts/RobotoSlab/roboto-slab-v7-regular.woff' to 'docs/docs/build/html/_static/fonts/RobotoSlab/roboto-slab-v7-regular.woff' 2020-12-09 12:24:33,425 DEBUG: Downloading 's3://dvc-temp/ivan/docs/build/html/_static/fonts/RobotoSlab/roboto-slab-v7-regular.woff2' to 'docs/docs/build/html/_static/fonts/RobotoSlab/roboto-slab-v7-regular.woff2' 2020-12-09 12:24:33,433 DEBUG: Downloading 's3://dvc-temp/ivan/docs/build/html/_static/fonts/fontawesome-webfont.eot' to 'docs/docs/build/html/_static/fonts/fontawesome-webfont.eot' 2020-12-09 12:24:33,460 DEBUG: Downloading 's3://dvc-temp/ivan/docs/build/html/_static/fonts/fontawesome-webfont.svg' to 'docs/docs/build/html/_static/fonts/fontawesome-webfont.svg' 2020-12-09 12:24:33,464 DEBUG: Downloading 's3://dvc-temp/ivan/docs/build/html/_static/fonts/fontawesome-webfont.ttf' to 'docs/docs/build/html/_static/fonts/fontawesome-webfont.ttf' 2020-12-09 12:24:33,471 DEBUG: Downloading 's3://dvc-temp/ivan/docs/build/html/_static/fonts/fontawesome-webfont.woff' to 'docs/docs/build/html/_static/fonts/fontawesome-webfont.woff' 2020-12-09 12:24:33,553 DEBUG: Downloading 's3://dvc-temp/ivan/docs/build/html/_static/fonts/fontawesome-webfont.woff2' to 'docs/docs/build/html/_static/fonts/fontawesome-webfont.woff2' 2020-12-09 12:24:33,556 DEBUG: Downloading 's3://dvc-temp/ivan/docs/build/html/_static/fonts/lato-bold-italic.woff' to 'docs/docs/build/html/_static/fonts/lato-bold-italic.woff' 2020-12-09 12:24:33,557 DEBUG: Downloading 's3://dvc-temp/ivan/docs/build/html/_static/fonts/lato-bold-italic.woff2' to 'docs/docs/build/html/_static/fonts/lato-bold-italic.woff2' 2020-12-09 12:24:33,561 DEBUG: Downloading 's3://dvc-temp/ivan/docs/build/html/_static/fonts/lato-bold.woff' to 'docs/docs/build/html/_static/fonts/lato-bold.woff' 2020-12-09 12:24:33,574 DEBUG: Downloading 's3://dvc-temp/ivan/docs/build/html/_static/fonts/lato-bold.woff2' to 'docs/docs/build/html/_static/fonts/lato-bold.woff2' 2020-12-09 12:24:33,575 DEBUG: Downloading 's3://dvc-temp/ivan/docs/build/html/_static/fonts/lato-normal-italic.woff2' to 'docs/docs/build/html/_static/fonts/lato-normal-italic.woff2' 2020-12-09 12:24:33,575 DEBUG: Downloading 's3://dvc-temp/ivan/docs/build/html/_static/fonts/lato-normal-italic.woff' to 'docs/docs/build/html/_static/fonts/lato-normal-italic.woff' 2020-12-09 12:24:33,585 DEBUG: Downloading 's3://dvc-temp/ivan/docs/build/html/_static/fonts/lato-normal.woff' to 'docs/docs/build/html/_static/fonts/lato-normal.woff' 2020-12-09 12:24:33,585 DEBUG: Downloading 's3://dvc-temp/ivan/docs/build/html/_static/fonts/lato-normal.woff2' to 'docs/docs/build/html/_static/fonts/lato-normal.woff2' 2020-12-09 12:24:33,587 DEBUG: Downloading 's3://dvc-temp/ivan/docs/build/html/_static/jquery-3.5.1.js' to 'docs/docs/build/html/_static/jquery-3.5.1.js' 2020-12-09 12:24:33,588 DEBUG: Downloading 's3://dvc-temp/ivan/docs/build/html/_static/jquery.js' to 'docs/docs/build/html/_static/jquery.js' 2020-12-09 12:24:33,590 DEBUG: Downloading 's3://dvc-temp/ivan/docs/build/html/_static/js/badge_only.js' to 'docs/docs/build/html/_static/js/badge_only.js' 2020-12-09 12:24:33,590 DEBUG: Downloading 's3://dvc-temp/ivan/docs/build/html/_static/js/html5shiv.min.js' to 'docs/docs/build/html/_static/js/html5shiv.min.js' 2020-12-09 12:24:33,590 DEBUG: Downloading 's3://dvc-temp/ivan/docs/build/html/_static/js/html5shiv-printshiv.min.js' to 'docs/docs/build/html/_static/js/html5shiv-printshiv.min.js' 2020-12-09 12:24:33,591 DEBUG: Downloading 's3://dvc-temp/ivan/docs/build/html/_static/js/modernizr.min.js' to 'docs/docs/build/html/_static/js/modernizr.min.js' 2020-12-09 12:24:33,729 DEBUG: Downloading 's3://dvc-temp/ivan/docs/build/html/_static/js/theme.js' to 'docs/docs/build/html/_static/js/theme.js' 2020-12-09 12:24:33,748 DEBUG: Downloading 's3://dvc-temp/ivan/docs/build/html/_static/minus.png' to 'docs/docs/build/html/_static/minus.png' 2020-12-09 12:24:33,748 DEBUG: Downloading 's3://dvc-temp/ivan/docs/build/html/_static/language_data.js' to 'docs/docs/build/html/_static/language_data.js' 2020-12-09 12:24:33,750 DEBUG: Downloading 's3://dvc-temp/ivan/docs/build/html/_static/pygments.css' to 'docs/docs/build/html/_static/pygments.css' 2020-12-09 12:24:33,754 DEBUG: Downloading 's3://dvc-temp/ivan/docs/build/html/_static/plus.png' to 'docs/docs/build/html/_static/plus.png' 2020-12-09 12:24:33,756 DEBUG: Downloading 's3://dvc-temp/ivan/docs/build/html/_static/searchtools.js' to 'docs/docs/build/html/_static/searchtools.js' 2020-12-09 12:24:33,758 DEBUG: Downloading 's3://dvc-temp/ivan/docs/build/html/_static/underscore-1.3.1.js' to 'docs/docs/build/html/_static/underscore-1.3.1.js' 2020-12-09 12:24:33,758 DEBUG: Downloading 's3://dvc-temp/ivan/docs/build/html/_static/underscore.js' to 'docs/docs/build/html/_static/underscore.js' 2020-12-09 12:24:33,770 DEBUG: Downloading 's3://dvc-temp/ivan/docs/build/html/filelist.html' to 'docs/docs/build/html/filelist.html' 2020-12-09 12:24:33,784 DEBUG: Downloading 's3://dvc-temp/ivan/docs/build/html/genindex.html' to 'docs/docs/build/html/genindex.html' 2020-12-09 12:24:33,784 DEBUG: Downloading 's3://dvc-temp/ivan/docs/build/html/filemanagement.html' to 'docs/docs/build/html/filemanagement.html' 2020-12-09 12:24:33,790 DEBUG: Downloading 's3://dvc-temp/ivan/docs/build/html/index.html' to 'docs/docs/build/html/index.html' 2020-12-09 12:24:33,807 DEBUG: Downloading 's3://dvc-temp/ivan/docs/build/html/oauth.html' to 'docs/docs/build/html/oauth.html' 2020-12-09 12:24:33,811 DEBUG: Downloading 's3://dvc-temp/ivan/docs/build/html/objects.inv' to 'docs/docs/build/html/objects.inv' 2020-12-09 12:24:33,833 DEBUG: Downloading 's3://dvc-temp/ivan/docs/build/html/py-modindex.html' to 'docs/docs/build/html/py-modindex.html' 2020-12-09 12:24:33,841 DEBUG: Downloading 's3://dvc-temp/ivan/docs/build/html/pydrive2.html' to 'docs/docs/build/html/pydrive2.html' 2020-12-09 12:24:33,920 DEBUG: Downloading 's3://dvc-temp/ivan/docs/build/html/quickstart.html' to 'docs/docs/build/html/quickstart.html' 2020-12-09 12:24:33,921 DEBUG: Downloading 's3://dvc-temp/ivan/docs/build/html/searchindex.js' to 'docs/docs/build/html/searchindex.js' 2020-12-09 12:24:33,921 DEBUG: Downloading 's3://dvc-temp/ivan/docs/build/html/search.html' to 'docs/docs/build/html/search.html' 2020-12-09 12:24:33,936 DEBUG: Downloading 's3://dvc-temp/ivan/docs/conf.py' to 'docs/docs/conf.py' 2020-12-09 12:24:33,959 DEBUG: Downloading 's3://dvc-temp/ivan/docs/filemanagement.rst' to 'docs/docs/filemanagement.rst' 2020-12-09 12:24:33,959 DEBUG: Downloading 's3://dvc-temp/ivan/docs/filelist.rst' to 'docs/docs/filelist.rst' 2020-12-09 12:24:33,990 DEBUG: Downloading 's3://dvc-temp/ivan/docs/index.rst' to 'docs/docs/index.rst' 2020-12-09 12:24:33,999 DEBUG: Downloading 's3://dvc-temp/ivan/docs/pydrive2.rst' to 'docs/docs/pydrive2.rst' 2020-12-09 12:24:33,999 DEBUG: Downloading 's3://dvc-temp/ivan/docs/oauth.rst' to 'docs/docs/oauth.rst' 2020-12-09 12:24:34,006 DEBUG: Downloading 's3://dvc-temp/ivan/docs/quickstart.rst' to 'docs/docs/quickstart.rst' 2020-12-09 12:24:34,324 ERROR: unexpected error - 'NoneType' object has no attribute 'cache' ------------------------------------------------------------ Traceback (most recent call last): File "/Users/ivan/Projects/dvc/dvc/main.py", line 90, in main ret = cmd.run() File "/Users/ivan/Projects/dvc/dvc/command/get_url.py", line 17, in run Repo.get_url(self.args.url, out=self.args.out) File "/Users/ivan/Projects/dvc/dvc/repo/get_url.py", line 21, in get_url out.save() File "/Users/ivan/Projects/dvc/dvc/output/base.py", line 276, in save self.hash_info = self.get_hash() File "/Users/ivan/Projects/dvc/dvc/output/base.py", line 186, in get_hash return self.tree.get_hash(self.path_info) File "/Users/ivan/Projects/dvc/.env/lib/python3.8/site-packages/funcy/decorators.py", line 39, in wrapper return deco(call, *dargs, **dkwargs) File "/Users/ivan/Projects/dvc/dvc/tree/base.py", line 45, in use_state return call() File "/Users/ivan/Projects/dvc/.env/lib/python3.8/site-packages/funcy/decorators.py", line 60, in __call__ return self._func(*self._args, **self._kwargs) File "/Users/ivan/Projects/dvc/dvc/tree/base.py", line 292, in get_hash hash_info = self.get_dir_hash(path_info, **kwargs) File "/Users/ivan/Projects/dvc/.env/lib/python3.8/site-packages/funcy/decorators.py", line 39, in wrapper return deco(call, *dargs, **dkwargs) File "/Users/ivan/Projects/dvc/dvc/tree/base.py", line 45, in use_state return call() File "/Users/ivan/Projects/dvc/.env/lib/python3.8/site-packages/funcy/decorators.py", line 60, in __call__ return self._func(*self._args, **self._kwargs) File "/Users/ivan/Projects/dvc/dvc/tree/base.py", line 352, in get_dir_hash hash_info = self.repo.cache.local.save_dir_info(dir_info) AttributeError: 'NoneType' object has no attribute 'cache' ------------------------------------------------------------ 2020-12-09 12:24:40,727 DEBUG: Version info for developers: DVC version: 1.11.0+13bb56 --------------------------------- Platform: Python 3.8.6 on macOS-10.15.6-x86_64-i386-64bit Supports: All remotes
AttributeError
def reproduce( self: "Repo", targets=None, recursive=False, pipeline=False, all_pipelines=False, **kwargs, ): glob = kwargs.pop("glob", False) accept_group = not glob if isinstance(targets, str): targets = [targets] if not all_pipelines and not targets: from dvc.dvcfile import PIPELINE_FILE targets = [PIPELINE_FILE] interactive = kwargs.get("interactive", False) if not interactive: kwargs["interactive"] = self.config["core"].get("interactive", False) stages = set() if pipeline or all_pipelines: pipelines = get_pipelines(self.graph) if all_pipelines: used_pipelines = pipelines else: used_pipelines = [] for target in targets: stage = self.stage.get_target(target) used_pipelines.append(get_pipeline(pipelines, stage)) for pline in used_pipelines: for stage in pline: if pline.in_degree(stage) == 0: stages.add(stage) else: for target in targets: stages.update( self.stage.collect( target, recursive=recursive, accept_group=accept_group, glob=glob, ) ) return _reproduce_stages(self.graph, list(stages), **kwargs)
def reproduce( self: "Repo", targets=None, recursive=False, pipeline=False, all_pipelines=False, **kwargs, ): glob = kwargs.pop("glob", False) accept_group = not glob if isinstance(targets, str): targets = [targets] if not all_pipelines and targets is None: from dvc.dvcfile import PIPELINE_FILE targets = [PIPELINE_FILE] interactive = kwargs.get("interactive", False) if not interactive: kwargs["interactive"] = self.config["core"].get("interactive", False) active_graph = _get_active_graph(self.graph) active_pipelines = get_pipelines(active_graph) stages = set() if pipeline or all_pipelines: if all_pipelines: pipelines = active_pipelines else: pipelines = [] for target in targets: stage = self.stage.get_target(target) pipelines.append(get_pipeline(active_pipelines, stage)) for pipeline in pipelines: for stage in pipeline: if pipeline.in_degree(stage) == 0: stages.add(stage) else: for target in targets: stages.update( self.stage.collect( target, recursive=recursive, graph=active_graph, accept_group=accept_group, glob=glob, ) ) return _reproduce_stages(active_graph, list(stages), **kwargs)
https://github.com/iterative/dvc/issues/4893
2020-11-12 19:17:45,465 DEBUG: No lock entry found for 'bash_projects/TDNNF_child_EN/dvc.yaml:create_hires_feats_train' 2020-11-12 19:17:45,974 DEBUG: fetched: [(412119,)] 2020-11-12 19:17:45,978 ERROR: unexpected error - nbunch is not a node or a sequence of nodes. ------------------------------------------------------------ Traceback (most recent call last): File "/home/ubuntu/.local/share/virtualenvs/speech-api-EI_ft4iY/lib/python3.7/site-packages/networkx/classes/graph.py", line 1874, in bunch_iter for n in nlist: TypeError: 'PipelineStage' object is not iterable During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/ubuntu/.local/share/virtualenvs/speech-api-EI_ft4iY/lib/python3.7/site-packages/dvc/main.py", line 76, in main ret = cmd.run() File "/home/ubuntu/.local/share/virtualenvs/speech-api-EI_ft4iY/lib/python3.7/site-packages/dvc/command/repro.py", line 29, in run stages = self.repo.reproduce(target, **self._repro_kwargs) File "/home/ubuntu/.local/share/virtualenvs/speech-api-EI_ft4iY/lib/python3.7/site-packages/dvc/repo/__init__.py", line 54, in wrapper return f(repo, *args, **kwargs) File "/home/ubuntu/.local/share/virtualenvs/speech-api-EI_ft4iY/lib/python3.7/site-packages/dvc/repo/scm_context.py", line 4, in run result = method(repo, *args, **kw) File "/home/ubuntu/.local/share/virtualenvs/speech-api-EI_ft4iY/lib/python3.7/site-packages/dvc/repo/reproduce.py", line 89, in reproduce active_graph = _get_active_graph(self.graph) File "/home/ubuntu/.local/share/virtualenvs/speech-api-EI_ft4iY/lib/python3.7/site-packages/dvc/repo/reproduce.py", line 58, in _get_active_graph if not active.in_degree(node): File "/home/ubuntu/.local/share/virtualenvs/speech-api-EI_ft4iY/lib/python3.7/site-packages/networkx/classes/reportviews.py", line 354, in __call__ return self.__class__(self._graph, nbunch, weight) File "/home/ubuntu/.local/share/virtualenvs/speech-api-EI_ft4iY/lib/python3.7/site-packages/networkx/classes/reportviews.py", line 339, in __init__ else list(G.nbunch_iter(nbunch)) File "/home/ubuntu/.local/share/virtualenvs/speech-api-EI_ft4iY/lib/python3.7/site-packages/networkx/classes/graph.py", line 1882, in bunch_iter raise NetworkXError(msg) networkx.exception.NetworkXError: nbunch is not a node or a sequence of nodes. ------------------------------------------------------------ 2020-11-12 19:17:46,119 DEBUG: Version info for developers: DVC version: 1.9.1 (pip) --------------------------------- Platform: Python 3.7.3 on Linux-5.4.0-1029-aws-x86_64-with-debian-buster-sid Supports: http, https, s3 Cache types: hardlink, symlink Cache directory: ext4 on /dev/nvme0n1p1 Workspace directory: ext4 on /dev/nvme0n1p1 Repo: dvc, git
TypeError
def _reproduce_stages( G, stages, downstream=False, single_item=False, on_unchanged=None, **kwargs ): r"""Derive the evaluation of the given node for the given graph. When you _reproduce a stage_, you want to _evaluate the descendants_ to know if it make sense to _recompute_ it. A post-ordered search will give us an order list of the nodes we want. For example, let's say that we have the following pipeline: E / \ D F / \ \ B C G \ / A The derived evaluation of D would be: [A, B, C, D] In case that `downstream` option is specified, the desired effect is to derive the evaluation starting from the given stage up to the ancestors. However, the `networkx.ancestors` returns a set, without any guarantee of any order, so we are going to reverse the graph and use a reverse post-ordered search using the given stage as a starting point. E A / \ / \ D F B C G / \ \ --- reverse --> \ / / B C G D F \ / \ / A E The derived evaluation of _downstream_ B would be: [B, D, E] """ steps = _get_steps(G, stages, downstream, single_item) force_downstream = kwargs.pop("force_downstream", False) result = [] unchanged = [] # `ret` is used to add a cosmetic newline. ret = [] checkpoint_func = kwargs.pop("checkpoint_func", None) for stage in steps: if ret: logger.info("") if checkpoint_func: kwargs["checkpoint_func"] = partial( _repro_callback, checkpoint_func, unchanged ) try: ret = _reproduce_stage(stage, **kwargs) if len(ret) == 0: unchanged.extend([stage]) elif force_downstream: # NOTE: we are walking our pipeline from the top to the # bottom. If one stage is changed, it will be reproduced, # which tells us that we should force reproducing all of # the other stages down below, even if their direct # dependencies didn't change. kwargs["force"] = True if ret: result.extend(ret) except CheckpointKilledError: raise except Exception as exc: raise ReproductionError(stage.relpath) from exc if on_unchanged is not None: on_unchanged(unchanged) return result
def _reproduce_stages( G, stages, downstream=False, single_item=False, on_unchanged=None, **kwargs ): r"""Derive the evaluation of the given node for the given graph. When you _reproduce a stage_, you want to _evaluate the descendants_ to know if it make sense to _recompute_ it. A post-ordered search will give us an order list of the nodes we want. For example, let's say that we have the following pipeline: E / \ D F / \ \ B C G \ / A The derived evaluation of D would be: [A, B, C, D] In case that `downstream` option is specified, the desired effect is to derive the evaluation starting from the given stage up to the ancestors. However, the `networkx.ancestors` returns a set, without any guarantee of any order, so we are going to reverse the graph and use a reverse post-ordered search using the given stage as a starting point. E A / \ / \ D F B C G / \ \ --- reverse --> \ / / B C G D F \ / \ / A E The derived evaluation of _downstream_ B would be: [B, D, E] """ pipeline = _get_pipeline(G, stages, downstream, single_item) force_downstream = kwargs.pop("force_downstream", False) result = [] unchanged = [] # `ret` is used to add a cosmetic newline. ret = [] checkpoint_func = kwargs.pop("checkpoint_func", None) for stage in pipeline: if ret: logger.info("") if checkpoint_func: kwargs["checkpoint_func"] = partial( _repro_callback, checkpoint_func, unchanged ) try: ret = _reproduce_stage(stage, **kwargs) if len(ret) == 0: unchanged.extend([stage]) elif force_downstream: # NOTE: we are walking our pipeline from the top to the # bottom. If one stage is changed, it will be reproduced, # which tells us that we should force reproducing all of # the other stages down below, even if their direct # dependencies didn't change. kwargs["force"] = True if ret: result.extend(ret) except CheckpointKilledError: raise except Exception as exc: raise ReproductionError(stage.relpath) from exc if on_unchanged is not None: on_unchanged(unchanged) return result
https://github.com/iterative/dvc/issues/4893
2020-11-12 19:17:45,465 DEBUG: No lock entry found for 'bash_projects/TDNNF_child_EN/dvc.yaml:create_hires_feats_train' 2020-11-12 19:17:45,974 DEBUG: fetched: [(412119,)] 2020-11-12 19:17:45,978 ERROR: unexpected error - nbunch is not a node or a sequence of nodes. ------------------------------------------------------------ Traceback (most recent call last): File "/home/ubuntu/.local/share/virtualenvs/speech-api-EI_ft4iY/lib/python3.7/site-packages/networkx/classes/graph.py", line 1874, in bunch_iter for n in nlist: TypeError: 'PipelineStage' object is not iterable During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/ubuntu/.local/share/virtualenvs/speech-api-EI_ft4iY/lib/python3.7/site-packages/dvc/main.py", line 76, in main ret = cmd.run() File "/home/ubuntu/.local/share/virtualenvs/speech-api-EI_ft4iY/lib/python3.7/site-packages/dvc/command/repro.py", line 29, in run stages = self.repo.reproduce(target, **self._repro_kwargs) File "/home/ubuntu/.local/share/virtualenvs/speech-api-EI_ft4iY/lib/python3.7/site-packages/dvc/repo/__init__.py", line 54, in wrapper return f(repo, *args, **kwargs) File "/home/ubuntu/.local/share/virtualenvs/speech-api-EI_ft4iY/lib/python3.7/site-packages/dvc/repo/scm_context.py", line 4, in run result = method(repo, *args, **kw) File "/home/ubuntu/.local/share/virtualenvs/speech-api-EI_ft4iY/lib/python3.7/site-packages/dvc/repo/reproduce.py", line 89, in reproduce active_graph = _get_active_graph(self.graph) File "/home/ubuntu/.local/share/virtualenvs/speech-api-EI_ft4iY/lib/python3.7/site-packages/dvc/repo/reproduce.py", line 58, in _get_active_graph if not active.in_degree(node): File "/home/ubuntu/.local/share/virtualenvs/speech-api-EI_ft4iY/lib/python3.7/site-packages/networkx/classes/reportviews.py", line 354, in __call__ return self.__class__(self._graph, nbunch, weight) File "/home/ubuntu/.local/share/virtualenvs/speech-api-EI_ft4iY/lib/python3.7/site-packages/networkx/classes/reportviews.py", line 339, in __init__ else list(G.nbunch_iter(nbunch)) File "/home/ubuntu/.local/share/virtualenvs/speech-api-EI_ft4iY/lib/python3.7/site-packages/networkx/classes/graph.py", line 1882, in bunch_iter raise NetworkXError(msg) networkx.exception.NetworkXError: nbunch is not a node or a sequence of nodes. ------------------------------------------------------------ 2020-11-12 19:17:46,119 DEBUG: Version info for developers: DVC version: 1.9.1 (pip) --------------------------------- Platform: Python 3.7.3 on Linux-5.4.0-1029-aws-x86_64-with-debian-buster-sid Supports: http, https, s3 Cache types: hardlink, symlink Cache directory: ext4 on /dev/nvme0n1p1 Workspace directory: ext4 on /dev/nvme0n1p1 Repo: dvc, git
TypeError
def _update_params(self, params: dict): """Update experiment params files with the specified values.""" from benedict import benedict from dvc.utils.serialize import MODIFIERS logger.debug("Using experiment params '%s'", params) for params_fname in params: path = PathInfo(params_fname) suffix = path.suffix.lower() modify_data = MODIFIERS[suffix] with modify_data(path, tree=self.repo.tree) as data: benedict(data).merge(params[params_fname], overwrite=True) # Force params file changes to be staged in git # Otherwise in certain situations the changes to params file may be # ignored when we `git stash` them since mtime is used to determine # whether the file is dirty self.scm.add(list(params.keys()))
def _update_params(self, params: dict): """Update experiment params files with the specified values.""" from benedict import benedict from dvc.utils.serialize import MODIFIERS logger.debug("Using experiment params '%s'", params) for params_fname in params: path = PathInfo(self.repo.root_dir) / params_fname suffix = path.suffix.lower() modify_data = MODIFIERS[suffix] with modify_data(path, tree=self.repo.tree) as data: benedict(data).merge(params[params_fname], overwrite=True) # Force params file changes to be staged in git # Otherwise in certain situations the changes to params file may be # ignored when we `git stash` them since mtime is used to determine # whether the file is dirty self.scm.add(list(params.keys()))
https://github.com/iterative/dvc/issues/4969
Adding '.dvc/config.local' to '.dvc/.gitignore'. Adding '.dvc/tmp' to '.dvc/.gitignore'. Adding '.dvc/experiments' to '.dvc/.gitignore'. Adding '.dvc/cache' to '.dvc/.gitignore'. Check for update is enabled. assuming default target 'dvc.yaml'. fetched: [(3,)] Checking out experiment commit 'e6a4d8123aebe35a19b9e4544e21ac542a10as66' Patching experiment workspace Removing '/tmp/tmp8e9_4d6f' Adding '.dvc/experiments/src/ai/training/.dvc/config.local' to '.dvc/experiments/src/ai/training/.dvc/.gitignore'. Adding '.dvc/experiments/src/ai/training/.dvc/tmp' to '.dvc/experiments/src/ai/training/.dvc/.gitignore'. Adding '.dvc/experiments/src/ai/training/.dvc/experiments' to '.dvc/experiments/src/ai/training/.dvc/.gitignore'. Stashed experiment 'f951c9d' for future execution. Reproducing experiment revs 'f951c9d' Checking out experiment commit 'e6a4d8123aebe35a19b9e4544e21ac542a10s166' Writing '/tmp/tmpmml3mawm/.dvc/config'. Init local executor in dir '<TemporaryDirectory '/tmp/tmpmml3mawm'>' with baseline 'e6a4d81'. Writing experiments local config '/tmp/tmpmml3mawm/src/ai/training/.dvc/config.local' fetched: [(7583,)] unexpected error - [Errno 2] No such file or directory: '/tmp/tmpmml3mawm/src/ai/training/.dvc/config.local' FileNotFoundError: [Errno 2] No such file or directory: '/tmp/tmpmml3mawm/src/ai/training/.dvc/config.local' ------------------------------------------------------------ Traceback (most recent call last): File "/home/elena/anaconda3/envs/myenv/lib/python3.6/site-packages/dvc/main.py", line 90, in main ret = cmd.run() File "/home/elena/anaconda3/envs/myenv/lib/python3.6/site-packages/dvc/command/experiments.py", line 469, in run **self._repro_kwargs, File "/home/elena/anaconda3/envs/myenv/lib/python3.6/site-packages/dvc/repo/experiments/__init__.py", line 988, in run return run(self.repo, *args, **kwargs) File "/home/elena/anaconda3/envs/myenv/lib/python3.6/site-packages/dvc/repo/__init__.py", line 60, in wrapper return f(repo, *args, **kwargs) File "/home/elena/anaconda3/envs/myenv/lib/python3.6/site-packages/dvc/repo/experiments/run.py", line 62, in run target=target, params=params, **kwargs File "/home/elena/anaconda3/envs/myenv/lib/python3.6/site-packages/dvc/repo/experiments/__init__.py", line 418, in reproduce_one results = self.reproduce([stash_rev], keep_stash=False) File "/home/elena/anaconda3/envs/myenv/lib/python3.6/site-packages/dvc/repo/experiments/__init__.py", line 38, in wrapper return f(exp, *args, **kwargs) File "/home/elena/anaconda3/envs/myenv/lib/python3.6/site-packages/dvc/repo/experiments/__init__.py", line 593, in reproduce checkpoint_reset=checkpoint_reset, File "/home/elena/anaconda3/envs/myenv/lib/python3.6/site-packages/dvc/repo/experiments/executor.py", line 116, in __init__ self._config(cache_dir) File "/home/elena/anaconda3/envs/myenv/lib/python3.6/site-packages/dvc/repo/experiments/executor.py", line 127, in _config with open(local_config, "w") as fobj: FileNotFoundError: [Errno 2] No such file or directory: '/tmp/tmpmml3mawm/src/ai/training/.dvc/config.local' ------------------------------------------------------------ Adding '.dvc/config.local' to '.dvc/.gitignore'. Adding '.dvc/tmp' to '.dvc/.gitignore'. Adding '.dvc/experiments' to '.dvc/.gitignore'. Adding '.dvc/cache' to '.dvc/.gitignore'. Version info for developers: DVC version: 1.10.2 (pip) --------------------------------- Platform: Python 3.6.12 on Linux-5.4.0-48-generic-x86_64-with-debian-buster-sid Supports: gs, http, https Cache types: hardlink, symlink Cache directory: ext4 on /dev/nvme0n1p2 Caches: local Remotes: local Workspace directory: ext4 on /dev/nvme0n1p2 Repo: dvc (subdir), git
FileNotFoundError
def _reproduce( self, executors: dict, jobs: Optional[int] = 1 ) -> Mapping[str, Mapping[str, str]]: """Run dvc repro for the specified BaseExecutors in parallel. Returns: dict mapping stash revs to the successfully executed experiments for each stash rev. """ result: Dict[str, Dict[str, str]] = defaultdict(dict) manager = Manager() pid_q = manager.Queue() rel_cwd = relpath(os.getcwd(), self.repo.root_dir) with ProcessPoolExecutor(max_workers=jobs) as workers: futures = {} for rev, executor in executors.items(): future = workers.submit( executor.reproduce, executor.dvc_dir, pid_q, rev, name=executor.name, rel_cwd=rel_cwd, log_level=logger.getEffectiveLevel(), ) futures[future] = (rev, executor) try: wait(futures) except KeyboardInterrupt: # forward SIGINT to any running executor processes and # cancel any remaining futures pids = {} while not pid_q.empty(): rev, pid = pid_q.get() pids[rev] = pid for future, (rev, _) in futures.items(): if future.running(): os.kill(pids[rev], signal.SIGINT) elif not future.done(): future.cancel() for future, (rev, executor) in futures.items(): rev, executor = futures[future] exc = future.exception() try: if exc is None: exp_hash, force = future.result() result[rev].update( self._collect_executor(executor, exp_hash, force) ) else: # Checkpoint errors have already been logged if not isinstance(exc, CheckpointKilledError): logger.exception( "Failed to reproduce experiment '%s'", rev[:7], exc_info=exc, ) except CancelledError: logger.error( "Cancelled before attempting to reproduce experiment '%s'", rev[:7], ) finally: executor.cleanup() return result
def _reproduce( self, executors: dict, jobs: Optional[int] = 1 ) -> Mapping[str, Mapping[str, str]]: """Run dvc repro for the specified BaseExecutors in parallel. Returns: dict mapping stash revs to the successfully executed experiments for each stash rev. """ result: Dict[str, Dict[str, str]] = defaultdict(dict) manager = Manager() pid_q = manager.Queue() with ProcessPoolExecutor(max_workers=jobs) as workers: futures = {} for rev, executor in executors.items(): future = workers.submit( executor.reproduce, executor.dvc_dir, pid_q, rev, name=executor.name, ) futures[future] = (rev, executor) try: wait(futures) except KeyboardInterrupt: # forward SIGINT to any running executor processes and # cancel any remaining futures pids = {} while not pid_q.empty(): rev, pid = pid_q.get() pids[rev] = pid for future, (rev, _) in futures.items(): if future.running(): os.kill(pids[rev], signal.SIGINT) elif not future.done(): future.cancel() for future, (rev, executor) in futures.items(): rev, executor = futures[future] exc = future.exception() try: if exc is None: exp_hash, force = future.result() result[rev].update( self._collect_executor(executor, exp_hash, force) ) else: # Checkpoint errors have already been logged if not isinstance(exc, CheckpointKilledError): logger.exception( "Failed to reproduce experiment '%s'", rev[:7], exc_info=exc, ) except CancelledError: logger.error( "Cancelled before attempting to reproduce experiment '%s'", rev[:7], ) finally: executor.cleanup() return result
https://github.com/iterative/dvc/issues/4969
Adding '.dvc/config.local' to '.dvc/.gitignore'. Adding '.dvc/tmp' to '.dvc/.gitignore'. Adding '.dvc/experiments' to '.dvc/.gitignore'. Adding '.dvc/cache' to '.dvc/.gitignore'. Check for update is enabled. assuming default target 'dvc.yaml'. fetched: [(3,)] Checking out experiment commit 'e6a4d8123aebe35a19b9e4544e21ac542a10as66' Patching experiment workspace Removing '/tmp/tmp8e9_4d6f' Adding '.dvc/experiments/src/ai/training/.dvc/config.local' to '.dvc/experiments/src/ai/training/.dvc/.gitignore'. Adding '.dvc/experiments/src/ai/training/.dvc/tmp' to '.dvc/experiments/src/ai/training/.dvc/.gitignore'. Adding '.dvc/experiments/src/ai/training/.dvc/experiments' to '.dvc/experiments/src/ai/training/.dvc/.gitignore'. Stashed experiment 'f951c9d' for future execution. Reproducing experiment revs 'f951c9d' Checking out experiment commit 'e6a4d8123aebe35a19b9e4544e21ac542a10s166' Writing '/tmp/tmpmml3mawm/.dvc/config'. Init local executor in dir '<TemporaryDirectory '/tmp/tmpmml3mawm'>' with baseline 'e6a4d81'. Writing experiments local config '/tmp/tmpmml3mawm/src/ai/training/.dvc/config.local' fetched: [(7583,)] unexpected error - [Errno 2] No such file or directory: '/tmp/tmpmml3mawm/src/ai/training/.dvc/config.local' FileNotFoundError: [Errno 2] No such file or directory: '/tmp/tmpmml3mawm/src/ai/training/.dvc/config.local' ------------------------------------------------------------ Traceback (most recent call last): File "/home/elena/anaconda3/envs/myenv/lib/python3.6/site-packages/dvc/main.py", line 90, in main ret = cmd.run() File "/home/elena/anaconda3/envs/myenv/lib/python3.6/site-packages/dvc/command/experiments.py", line 469, in run **self._repro_kwargs, File "/home/elena/anaconda3/envs/myenv/lib/python3.6/site-packages/dvc/repo/experiments/__init__.py", line 988, in run return run(self.repo, *args, **kwargs) File "/home/elena/anaconda3/envs/myenv/lib/python3.6/site-packages/dvc/repo/__init__.py", line 60, in wrapper return f(repo, *args, **kwargs) File "/home/elena/anaconda3/envs/myenv/lib/python3.6/site-packages/dvc/repo/experiments/run.py", line 62, in run target=target, params=params, **kwargs File "/home/elena/anaconda3/envs/myenv/lib/python3.6/site-packages/dvc/repo/experiments/__init__.py", line 418, in reproduce_one results = self.reproduce([stash_rev], keep_stash=False) File "/home/elena/anaconda3/envs/myenv/lib/python3.6/site-packages/dvc/repo/experiments/__init__.py", line 38, in wrapper return f(exp, *args, **kwargs) File "/home/elena/anaconda3/envs/myenv/lib/python3.6/site-packages/dvc/repo/experiments/__init__.py", line 593, in reproduce checkpoint_reset=checkpoint_reset, File "/home/elena/anaconda3/envs/myenv/lib/python3.6/site-packages/dvc/repo/experiments/executor.py", line 116, in __init__ self._config(cache_dir) File "/home/elena/anaconda3/envs/myenv/lib/python3.6/site-packages/dvc/repo/experiments/executor.py", line 127, in _config with open(local_config, "w") as fobj: FileNotFoundError: [Errno 2] No such file or directory: '/tmp/tmpmml3mawm/src/ai/training/.dvc/config.local' ------------------------------------------------------------ Adding '.dvc/config.local' to '.dvc/.gitignore'. Adding '.dvc/tmp' to '.dvc/.gitignore'. Adding '.dvc/experiments' to '.dvc/.gitignore'. Adding '.dvc/cache' to '.dvc/.gitignore'. Version info for developers: DVC version: 1.10.2 (pip) --------------------------------- Platform: Python 3.6.12 on Linux-5.4.0-48-generic-x86_64-with-debian-buster-sid Supports: gs, http, https Cache types: hardlink, symlink Cache directory: ext4 on /dev/nvme0n1p2 Caches: local Remotes: local Workspace directory: ext4 on /dev/nvme0n1p2 Repo: dvc (subdir), git
FileNotFoundError
def reproduce( cls, dvc_dir: str, queue: "Queue", rev: str, rel_cwd: Optional[str] = None, name: Optional[str] = None, log_level: Optional[int] = None, ) -> Tuple[Optional[str], bool]: """Run dvc repro and return the result. Returns tuple of (exp_hash, force) where exp_hash is the experiment hash (or None on error) and force is a bool specifying whether or not this experiment should force overwrite any existing duplicates. """ from dvc.repo.checkout import checkout as dvc_checkout from dvc.repo.reproduce import reproduce as dvc_reproduce unchanged = [] queue.put((rev, os.getpid())) cls._set_log_level(log_level) def filter_pipeline(stages): unchanged.extend( [stage for stage in stages if isinstance(stage, PipelineStage)] ) result: Optional[str] = None repro_force: bool = False try: dvc = Repo(dvc_dir) old_cwd = os.getcwd() if rel_cwd: os.chdir(os.path.join(dvc.root_dir, rel_cwd)) else: os.chdir(dvc.root_dir) logger.debug("Running repro in '%s'", os.getcwd()) args_path = os.path.join(dvc.tmp_dir, BaseExecutor.PACKED_ARGS_FILE) if os.path.exists(args_path): args, kwargs = BaseExecutor.unpack_repro_args(args_path) remove(args_path) else: args = [] kwargs = {} repro_force = kwargs.get("force", False) # NOTE: for checkpoint experiments we handle persist outs slightly # differently than normal: # # - checkpoint out may not yet exist if this is the first time this # experiment has been run, this is not an error condition for # experiments # - at the start of a repro run, we need to remove the persist out # and restore it to its last known (committed) state (which may # be removed/does not yet exist) so that our executor workspace # is not polluted with the (persistent) out from an unrelated # experiment run dvc_checkout(dvc, force=True, quiet=True) checkpoint_func = partial(cls.checkpoint_callback, dvc.scm, name) stages = dvc_reproduce( dvc, *args, on_unchanged=filter_pipeline, checkpoint_func=checkpoint_func, **kwargs, ) exp_hash = cls.hash_exp(stages) result = exp_hash exp_rev = cls.commit(dvc.scm, exp_hash, exp_name=name) if dvc.scm.get_ref(EXEC_CHECKPOINT): dvc.scm.set_ref(EXEC_CHECKPOINT, exp_rev) except UnchangedExperimentError: pass finally: if dvc: dvc.scm.close() if old_cwd: os.chdir(old_cwd) # ideally we would return stages here like a normal repro() call, but # stages is not currently picklable and cannot be returned across # multiprocessing calls return result, repro_force
def reproduce( cls, dvc_dir: str, queue: "Queue", rev: str, cwd: Optional[str] = None, name: Optional[str] = None, ) -> Tuple[Optional[str], bool]: """Run dvc repro and return the result. Returns tuple of (exp_hash, force) where exp_hash is the experiment hash (or None on error) and force is a bool specifying whether or not this experiment should force overwrite any existing duplicates. """ from dvc.repo.checkout import checkout as dvc_checkout from dvc.repo.reproduce import reproduce as dvc_reproduce unchanged = [] queue.put((rev, os.getpid())) def filter_pipeline(stages): unchanged.extend( [stage for stage in stages if isinstance(stage, PipelineStage)] ) result: Optional[str] = None repro_force: bool = False try: dvc = Repo(dvc_dir) old_cwd = os.getcwd() new_cwd = cwd if cwd else dvc.root_dir os.chdir(new_cwd) logger.debug("Running repro in '%s'", cwd) args_path = os.path.join(dvc.tmp_dir, BaseExecutor.PACKED_ARGS_FILE) if os.path.exists(args_path): args, kwargs = BaseExecutor.unpack_repro_args(args_path) remove(args_path) else: args = [] kwargs = {} repro_force = kwargs.get("force", False) # NOTE: for checkpoint experiments we handle persist outs slightly # differently than normal: # # - checkpoint out may not yet exist if this is the first time this # experiment has been run, this is not an error condition for # experiments # - at the start of a repro run, we need to remove the persist out # and restore it to its last known (committed) state (which may # be removed/does not yet exist) so that our executor workspace # is not polluted with the (persistent) out from an unrelated # experiment run dvc_checkout(dvc, force=True, quiet=True) checkpoint_func = partial(cls.checkpoint_callback, dvc.scm, name) stages = dvc_reproduce( dvc, *args, on_unchanged=filter_pipeline, checkpoint_func=checkpoint_func, **kwargs, ) exp_hash = cls.hash_exp(stages) result = exp_hash exp_rev = cls.commit(dvc.scm, exp_hash, exp_name=name) if dvc.scm.get_ref(EXEC_CHECKPOINT): dvc.scm.set_ref(EXEC_CHECKPOINT, exp_rev) except UnchangedExperimentError: pass finally: if dvc: dvc.scm.close() if old_cwd: os.chdir(old_cwd) # ideally we would return stages here like a normal repro() call, but # stages is not currently picklable and cannot be returned across # multiprocessing calls return result, repro_force
https://github.com/iterative/dvc/issues/4969
Adding '.dvc/config.local' to '.dvc/.gitignore'. Adding '.dvc/tmp' to '.dvc/.gitignore'. Adding '.dvc/experiments' to '.dvc/.gitignore'. Adding '.dvc/cache' to '.dvc/.gitignore'. Check for update is enabled. assuming default target 'dvc.yaml'. fetched: [(3,)] Checking out experiment commit 'e6a4d8123aebe35a19b9e4544e21ac542a10as66' Patching experiment workspace Removing '/tmp/tmp8e9_4d6f' Adding '.dvc/experiments/src/ai/training/.dvc/config.local' to '.dvc/experiments/src/ai/training/.dvc/.gitignore'. Adding '.dvc/experiments/src/ai/training/.dvc/tmp' to '.dvc/experiments/src/ai/training/.dvc/.gitignore'. Adding '.dvc/experiments/src/ai/training/.dvc/experiments' to '.dvc/experiments/src/ai/training/.dvc/.gitignore'. Stashed experiment 'f951c9d' for future execution. Reproducing experiment revs 'f951c9d' Checking out experiment commit 'e6a4d8123aebe35a19b9e4544e21ac542a10s166' Writing '/tmp/tmpmml3mawm/.dvc/config'. Init local executor in dir '<TemporaryDirectory '/tmp/tmpmml3mawm'>' with baseline 'e6a4d81'. Writing experiments local config '/tmp/tmpmml3mawm/src/ai/training/.dvc/config.local' fetched: [(7583,)] unexpected error - [Errno 2] No such file or directory: '/tmp/tmpmml3mawm/src/ai/training/.dvc/config.local' FileNotFoundError: [Errno 2] No such file or directory: '/tmp/tmpmml3mawm/src/ai/training/.dvc/config.local' ------------------------------------------------------------ Traceback (most recent call last): File "/home/elena/anaconda3/envs/myenv/lib/python3.6/site-packages/dvc/main.py", line 90, in main ret = cmd.run() File "/home/elena/anaconda3/envs/myenv/lib/python3.6/site-packages/dvc/command/experiments.py", line 469, in run **self._repro_kwargs, File "/home/elena/anaconda3/envs/myenv/lib/python3.6/site-packages/dvc/repo/experiments/__init__.py", line 988, in run return run(self.repo, *args, **kwargs) File "/home/elena/anaconda3/envs/myenv/lib/python3.6/site-packages/dvc/repo/__init__.py", line 60, in wrapper return f(repo, *args, **kwargs) File "/home/elena/anaconda3/envs/myenv/lib/python3.6/site-packages/dvc/repo/experiments/run.py", line 62, in run target=target, params=params, **kwargs File "/home/elena/anaconda3/envs/myenv/lib/python3.6/site-packages/dvc/repo/experiments/__init__.py", line 418, in reproduce_one results = self.reproduce([stash_rev], keep_stash=False) File "/home/elena/anaconda3/envs/myenv/lib/python3.6/site-packages/dvc/repo/experiments/__init__.py", line 38, in wrapper return f(exp, *args, **kwargs) File "/home/elena/anaconda3/envs/myenv/lib/python3.6/site-packages/dvc/repo/experiments/__init__.py", line 593, in reproduce checkpoint_reset=checkpoint_reset, File "/home/elena/anaconda3/envs/myenv/lib/python3.6/site-packages/dvc/repo/experiments/executor.py", line 116, in __init__ self._config(cache_dir) File "/home/elena/anaconda3/envs/myenv/lib/python3.6/site-packages/dvc/repo/experiments/executor.py", line 127, in _config with open(local_config, "w") as fobj: FileNotFoundError: [Errno 2] No such file or directory: '/tmp/tmpmml3mawm/src/ai/training/.dvc/config.local' ------------------------------------------------------------ Adding '.dvc/config.local' to '.dvc/.gitignore'. Adding '.dvc/tmp' to '.dvc/.gitignore'. Adding '.dvc/experiments' to '.dvc/.gitignore'. Adding '.dvc/cache' to '.dvc/.gitignore'. Version info for developers: DVC version: 1.10.2 (pip) --------------------------------- Platform: Python 3.6.12 on Linux-5.4.0-48-generic-x86_64-with-debian-buster-sid Supports: gs, http, https Cache types: hardlink, symlink Cache directory: ext4 on /dev/nvme0n1p2 Caches: local Remotes: local Workspace directory: ext4 on /dev/nvme0n1p2 Repo: dvc (subdir), git
FileNotFoundError
def _reproduce_stage(stage, **kwargs): def _run_callback(repro_callback): _dump_stage(stage) _track_stage(stage) repro_callback([stage]) checkpoint_func = kwargs.pop("checkpoint_func", None) if stage.is_checkpoint: if checkpoint_func: kwargs["checkpoint_func"] = partial(_run_callback, checkpoint_func) else: logger.warning( "Checkpoint stages are not fully supported in 'dvc repro'. " "Checkpoint stages should be reproduced with 'dvc exp run' " "or 'dvc exp resume'." ) if stage.frozen and not stage.is_import: logger.warning( "{} is frozen. Its dependencies are not going to be reproduced.".format( stage ) ) stage = stage.reproduce(**kwargs) if not stage: return [] if not kwargs.get("dry", False): track = checkpoint_func is not None _dump_stage(stage) if track: _track_stage(stage) return [stage]
def _reproduce_stage(stage, **kwargs): def _run_callback(repro_callback): _dump_stage(stage) repro_callback([stage]) checkpoint_func = kwargs.pop("checkpoint_func", None) if stage.is_checkpoint: if checkpoint_func: kwargs["checkpoint_func"] = partial(_run_callback, checkpoint_func) else: logger.warning( "Checkpoint stages are not fully supported in 'dvc repro'. " "Checkpoint stages should be reproduced with 'dvc exp run' " "or 'dvc exp resume'." ) if stage.frozen and not stage.is_import: logger.warning( "{} is frozen. Its dependencies are not going to be reproduced.".format( stage ) ) stage = stage.reproduce(**kwargs) if not stage: return [] if not kwargs.get("dry", False): _dump_stage(stage) return [stage]
https://github.com/iterative/dvc/issues/4969
Adding '.dvc/config.local' to '.dvc/.gitignore'. Adding '.dvc/tmp' to '.dvc/.gitignore'. Adding '.dvc/experiments' to '.dvc/.gitignore'. Adding '.dvc/cache' to '.dvc/.gitignore'. Check for update is enabled. assuming default target 'dvc.yaml'. fetched: [(3,)] Checking out experiment commit 'e6a4d8123aebe35a19b9e4544e21ac542a10as66' Patching experiment workspace Removing '/tmp/tmp8e9_4d6f' Adding '.dvc/experiments/src/ai/training/.dvc/config.local' to '.dvc/experiments/src/ai/training/.dvc/.gitignore'. Adding '.dvc/experiments/src/ai/training/.dvc/tmp' to '.dvc/experiments/src/ai/training/.dvc/.gitignore'. Adding '.dvc/experiments/src/ai/training/.dvc/experiments' to '.dvc/experiments/src/ai/training/.dvc/.gitignore'. Stashed experiment 'f951c9d' for future execution. Reproducing experiment revs 'f951c9d' Checking out experiment commit 'e6a4d8123aebe35a19b9e4544e21ac542a10s166' Writing '/tmp/tmpmml3mawm/.dvc/config'. Init local executor in dir '<TemporaryDirectory '/tmp/tmpmml3mawm'>' with baseline 'e6a4d81'. Writing experiments local config '/tmp/tmpmml3mawm/src/ai/training/.dvc/config.local' fetched: [(7583,)] unexpected error - [Errno 2] No such file or directory: '/tmp/tmpmml3mawm/src/ai/training/.dvc/config.local' FileNotFoundError: [Errno 2] No such file or directory: '/tmp/tmpmml3mawm/src/ai/training/.dvc/config.local' ------------------------------------------------------------ Traceback (most recent call last): File "/home/elena/anaconda3/envs/myenv/lib/python3.6/site-packages/dvc/main.py", line 90, in main ret = cmd.run() File "/home/elena/anaconda3/envs/myenv/lib/python3.6/site-packages/dvc/command/experiments.py", line 469, in run **self._repro_kwargs, File "/home/elena/anaconda3/envs/myenv/lib/python3.6/site-packages/dvc/repo/experiments/__init__.py", line 988, in run return run(self.repo, *args, **kwargs) File "/home/elena/anaconda3/envs/myenv/lib/python3.6/site-packages/dvc/repo/__init__.py", line 60, in wrapper return f(repo, *args, **kwargs) File "/home/elena/anaconda3/envs/myenv/lib/python3.6/site-packages/dvc/repo/experiments/run.py", line 62, in run target=target, params=params, **kwargs File "/home/elena/anaconda3/envs/myenv/lib/python3.6/site-packages/dvc/repo/experiments/__init__.py", line 418, in reproduce_one results = self.reproduce([stash_rev], keep_stash=False) File "/home/elena/anaconda3/envs/myenv/lib/python3.6/site-packages/dvc/repo/experiments/__init__.py", line 38, in wrapper return f(exp, *args, **kwargs) File "/home/elena/anaconda3/envs/myenv/lib/python3.6/site-packages/dvc/repo/experiments/__init__.py", line 593, in reproduce checkpoint_reset=checkpoint_reset, File "/home/elena/anaconda3/envs/myenv/lib/python3.6/site-packages/dvc/repo/experiments/executor.py", line 116, in __init__ self._config(cache_dir) File "/home/elena/anaconda3/envs/myenv/lib/python3.6/site-packages/dvc/repo/experiments/executor.py", line 127, in _config with open(local_config, "w") as fobj: FileNotFoundError: [Errno 2] No such file or directory: '/tmp/tmpmml3mawm/src/ai/training/.dvc/config.local' ------------------------------------------------------------ Adding '.dvc/config.local' to '.dvc/.gitignore'. Adding '.dvc/tmp' to '.dvc/.gitignore'. Adding '.dvc/experiments' to '.dvc/.gitignore'. Adding '.dvc/cache' to '.dvc/.gitignore'. Version info for developers: DVC version: 1.10.2 (pip) --------------------------------- Platform: Python 3.6.12 on Linux-5.4.0-48-generic-x86_64-with-debian-buster-sid Supports: gs, http, https Cache types: hardlink, symlink Cache directory: ext4 on /dev/nvme0n1p2 Caches: local Remotes: local Workspace directory: ext4 on /dev/nvme0n1p2 Repo: dvc (subdir), git
FileNotFoundError
def _run_callback(repro_callback): _dump_stage(stage) _track_stage(stage) repro_callback([stage])
def _run_callback(repro_callback): _dump_stage(stage) repro_callback([stage])
https://github.com/iterative/dvc/issues/4969
Adding '.dvc/config.local' to '.dvc/.gitignore'. Adding '.dvc/tmp' to '.dvc/.gitignore'. Adding '.dvc/experiments' to '.dvc/.gitignore'. Adding '.dvc/cache' to '.dvc/.gitignore'. Check for update is enabled. assuming default target 'dvc.yaml'. fetched: [(3,)] Checking out experiment commit 'e6a4d8123aebe35a19b9e4544e21ac542a10as66' Patching experiment workspace Removing '/tmp/tmp8e9_4d6f' Adding '.dvc/experiments/src/ai/training/.dvc/config.local' to '.dvc/experiments/src/ai/training/.dvc/.gitignore'. Adding '.dvc/experiments/src/ai/training/.dvc/tmp' to '.dvc/experiments/src/ai/training/.dvc/.gitignore'. Adding '.dvc/experiments/src/ai/training/.dvc/experiments' to '.dvc/experiments/src/ai/training/.dvc/.gitignore'. Stashed experiment 'f951c9d' for future execution. Reproducing experiment revs 'f951c9d' Checking out experiment commit 'e6a4d8123aebe35a19b9e4544e21ac542a10s166' Writing '/tmp/tmpmml3mawm/.dvc/config'. Init local executor in dir '<TemporaryDirectory '/tmp/tmpmml3mawm'>' with baseline 'e6a4d81'. Writing experiments local config '/tmp/tmpmml3mawm/src/ai/training/.dvc/config.local' fetched: [(7583,)] unexpected error - [Errno 2] No such file or directory: '/tmp/tmpmml3mawm/src/ai/training/.dvc/config.local' FileNotFoundError: [Errno 2] No such file or directory: '/tmp/tmpmml3mawm/src/ai/training/.dvc/config.local' ------------------------------------------------------------ Traceback (most recent call last): File "/home/elena/anaconda3/envs/myenv/lib/python3.6/site-packages/dvc/main.py", line 90, in main ret = cmd.run() File "/home/elena/anaconda3/envs/myenv/lib/python3.6/site-packages/dvc/command/experiments.py", line 469, in run **self._repro_kwargs, File "/home/elena/anaconda3/envs/myenv/lib/python3.6/site-packages/dvc/repo/experiments/__init__.py", line 988, in run return run(self.repo, *args, **kwargs) File "/home/elena/anaconda3/envs/myenv/lib/python3.6/site-packages/dvc/repo/__init__.py", line 60, in wrapper return f(repo, *args, **kwargs) File "/home/elena/anaconda3/envs/myenv/lib/python3.6/site-packages/dvc/repo/experiments/run.py", line 62, in run target=target, params=params, **kwargs File "/home/elena/anaconda3/envs/myenv/lib/python3.6/site-packages/dvc/repo/experiments/__init__.py", line 418, in reproduce_one results = self.reproduce([stash_rev], keep_stash=False) File "/home/elena/anaconda3/envs/myenv/lib/python3.6/site-packages/dvc/repo/experiments/__init__.py", line 38, in wrapper return f(exp, *args, **kwargs) File "/home/elena/anaconda3/envs/myenv/lib/python3.6/site-packages/dvc/repo/experiments/__init__.py", line 593, in reproduce checkpoint_reset=checkpoint_reset, File "/home/elena/anaconda3/envs/myenv/lib/python3.6/site-packages/dvc/repo/experiments/executor.py", line 116, in __init__ self._config(cache_dir) File "/home/elena/anaconda3/envs/myenv/lib/python3.6/site-packages/dvc/repo/experiments/executor.py", line 127, in _config with open(local_config, "w") as fobj: FileNotFoundError: [Errno 2] No such file or directory: '/tmp/tmpmml3mawm/src/ai/training/.dvc/config.local' ------------------------------------------------------------ Adding '.dvc/config.local' to '.dvc/.gitignore'. Adding '.dvc/tmp' to '.dvc/.gitignore'. Adding '.dvc/experiments' to '.dvc/.gitignore'. Adding '.dvc/cache' to '.dvc/.gitignore'. Version info for developers: DVC version: 1.10.2 (pip) --------------------------------- Platform: Python 3.6.12 on Linux-5.4.0-48-generic-x86_64-with-debian-buster-sid Supports: gs, http, https Cache types: hardlink, symlink Cache directory: ext4 on /dev/nvme0n1p2 Caches: local Remotes: local Workspace directory: ext4 on /dev/nvme0n1p2 Repo: dvc (subdir), git
FileNotFoundError
def __init__( # pylint:disable=W0231 self, root_dir=os.curdir, search_parent_directories=True ): from dulwich.errors import NotGitRepository from dulwich.repo import Repo try: if search_parent_directories: self.repo = Repo.discover(start=root_dir) else: self.repo = Repo(root_dir) except NotGitRepository as exc: raise SCMError(f"{root_dir} is not a git repository") from exc self._submodules: Dict[str, "PathInfo"] = self._find_submodules() self._stashes: dict = {}
def __init__( # pylint:disable=W0231 self, root_dir=os.curdir, search_parent_directories=True ): from dulwich.errors import NotGitRepository from dulwich.repo import Repo try: if search_parent_directories: self.repo = Repo.discover(start=root_dir) else: self.repo = Repo(root_dir) except NotGitRepository as exc: raise SCMError(f"{root_dir} is not a git repository") from exc self._stashes: dict = {}
https://github.com/iterative/dvc/issues/4969
Adding '.dvc/config.local' to '.dvc/.gitignore'. Adding '.dvc/tmp' to '.dvc/.gitignore'. Adding '.dvc/experiments' to '.dvc/.gitignore'. Adding '.dvc/cache' to '.dvc/.gitignore'. Check for update is enabled. assuming default target 'dvc.yaml'. fetched: [(3,)] Checking out experiment commit 'e6a4d8123aebe35a19b9e4544e21ac542a10as66' Patching experiment workspace Removing '/tmp/tmp8e9_4d6f' Adding '.dvc/experiments/src/ai/training/.dvc/config.local' to '.dvc/experiments/src/ai/training/.dvc/.gitignore'. Adding '.dvc/experiments/src/ai/training/.dvc/tmp' to '.dvc/experiments/src/ai/training/.dvc/.gitignore'. Adding '.dvc/experiments/src/ai/training/.dvc/experiments' to '.dvc/experiments/src/ai/training/.dvc/.gitignore'. Stashed experiment 'f951c9d' for future execution. Reproducing experiment revs 'f951c9d' Checking out experiment commit 'e6a4d8123aebe35a19b9e4544e21ac542a10s166' Writing '/tmp/tmpmml3mawm/.dvc/config'. Init local executor in dir '<TemporaryDirectory '/tmp/tmpmml3mawm'>' with baseline 'e6a4d81'. Writing experiments local config '/tmp/tmpmml3mawm/src/ai/training/.dvc/config.local' fetched: [(7583,)] unexpected error - [Errno 2] No such file or directory: '/tmp/tmpmml3mawm/src/ai/training/.dvc/config.local' FileNotFoundError: [Errno 2] No such file or directory: '/tmp/tmpmml3mawm/src/ai/training/.dvc/config.local' ------------------------------------------------------------ Traceback (most recent call last): File "/home/elena/anaconda3/envs/myenv/lib/python3.6/site-packages/dvc/main.py", line 90, in main ret = cmd.run() File "/home/elena/anaconda3/envs/myenv/lib/python3.6/site-packages/dvc/command/experiments.py", line 469, in run **self._repro_kwargs, File "/home/elena/anaconda3/envs/myenv/lib/python3.6/site-packages/dvc/repo/experiments/__init__.py", line 988, in run return run(self.repo, *args, **kwargs) File "/home/elena/anaconda3/envs/myenv/lib/python3.6/site-packages/dvc/repo/__init__.py", line 60, in wrapper return f(repo, *args, **kwargs) File "/home/elena/anaconda3/envs/myenv/lib/python3.6/site-packages/dvc/repo/experiments/run.py", line 62, in run target=target, params=params, **kwargs File "/home/elena/anaconda3/envs/myenv/lib/python3.6/site-packages/dvc/repo/experiments/__init__.py", line 418, in reproduce_one results = self.reproduce([stash_rev], keep_stash=False) File "/home/elena/anaconda3/envs/myenv/lib/python3.6/site-packages/dvc/repo/experiments/__init__.py", line 38, in wrapper return f(exp, *args, **kwargs) File "/home/elena/anaconda3/envs/myenv/lib/python3.6/site-packages/dvc/repo/experiments/__init__.py", line 593, in reproduce checkpoint_reset=checkpoint_reset, File "/home/elena/anaconda3/envs/myenv/lib/python3.6/site-packages/dvc/repo/experiments/executor.py", line 116, in __init__ self._config(cache_dir) File "/home/elena/anaconda3/envs/myenv/lib/python3.6/site-packages/dvc/repo/experiments/executor.py", line 127, in _config with open(local_config, "w") as fobj: FileNotFoundError: [Errno 2] No such file or directory: '/tmp/tmpmml3mawm/src/ai/training/.dvc/config.local' ------------------------------------------------------------ Adding '.dvc/config.local' to '.dvc/.gitignore'. Adding '.dvc/tmp' to '.dvc/.gitignore'. Adding '.dvc/experiments' to '.dvc/.gitignore'. Adding '.dvc/cache' to '.dvc/.gitignore'. Version info for developers: DVC version: 1.10.2 (pip) --------------------------------- Platform: Python 3.6.12 on Linux-5.4.0-48-generic-x86_64-with-debian-buster-sid Supports: gs, http, https Cache types: hardlink, symlink Cache directory: ext4 on /dev/nvme0n1p2 Caches: local Remotes: local Workspace directory: ext4 on /dev/nvme0n1p2 Repo: dvc (subdir), git
FileNotFoundError
def add(self, paths: Iterable[str]): from dvc.utils.fs import walk_files if isinstance(paths, str): paths = [paths] files = [] for path in paths: if not os.path.isabs(path) and self._submodules: # NOTE: If path is inside a submodule, Dulwich expects the # staged paths to be relative to the submodule root (not the # parent git repo root). We append path to root_dir here so # that the result of relpath(path, root_dir) is actually the # path relative to the submodule root. path_info = PathInfo(path).relative_to(self.root_dir) for sm_path in self._submodules.values(): if path_info.isin(sm_path): path = os.path.join(self.root_dir, path_info.relative_to(sm_path)) break if os.path.isdir(path): files.extend(walk_files(path)) else: files.append(path) for fpath in files: # NOTE: this doesn't check gitignore, same as GitPythonBackend.add self.repo.stage(relpath(fpath, self.root_dir))
def add(self, paths: Iterable[str]): from dvc.utils.fs import walk_files if isinstance(paths, str): paths = [paths] files = [] for path in paths: if not os.path.isabs(path): path = os.path.join(self.root_dir, path) if os.path.isdir(path): files.extend(walk_files(path)) else: files.append(path) for fpath in files: # NOTE: this doesn't check gitignore, same as GitPythonBackend.add self.repo.stage(relpath(fpath, self.root_dir))
https://github.com/iterative/dvc/issues/4969
Adding '.dvc/config.local' to '.dvc/.gitignore'. Adding '.dvc/tmp' to '.dvc/.gitignore'. Adding '.dvc/experiments' to '.dvc/.gitignore'. Adding '.dvc/cache' to '.dvc/.gitignore'. Check for update is enabled. assuming default target 'dvc.yaml'. fetched: [(3,)] Checking out experiment commit 'e6a4d8123aebe35a19b9e4544e21ac542a10as66' Patching experiment workspace Removing '/tmp/tmp8e9_4d6f' Adding '.dvc/experiments/src/ai/training/.dvc/config.local' to '.dvc/experiments/src/ai/training/.dvc/.gitignore'. Adding '.dvc/experiments/src/ai/training/.dvc/tmp' to '.dvc/experiments/src/ai/training/.dvc/.gitignore'. Adding '.dvc/experiments/src/ai/training/.dvc/experiments' to '.dvc/experiments/src/ai/training/.dvc/.gitignore'. Stashed experiment 'f951c9d' for future execution. Reproducing experiment revs 'f951c9d' Checking out experiment commit 'e6a4d8123aebe35a19b9e4544e21ac542a10s166' Writing '/tmp/tmpmml3mawm/.dvc/config'. Init local executor in dir '<TemporaryDirectory '/tmp/tmpmml3mawm'>' with baseline 'e6a4d81'. Writing experiments local config '/tmp/tmpmml3mawm/src/ai/training/.dvc/config.local' fetched: [(7583,)] unexpected error - [Errno 2] No such file or directory: '/tmp/tmpmml3mawm/src/ai/training/.dvc/config.local' FileNotFoundError: [Errno 2] No such file or directory: '/tmp/tmpmml3mawm/src/ai/training/.dvc/config.local' ------------------------------------------------------------ Traceback (most recent call last): File "/home/elena/anaconda3/envs/myenv/lib/python3.6/site-packages/dvc/main.py", line 90, in main ret = cmd.run() File "/home/elena/anaconda3/envs/myenv/lib/python3.6/site-packages/dvc/command/experiments.py", line 469, in run **self._repro_kwargs, File "/home/elena/anaconda3/envs/myenv/lib/python3.6/site-packages/dvc/repo/experiments/__init__.py", line 988, in run return run(self.repo, *args, **kwargs) File "/home/elena/anaconda3/envs/myenv/lib/python3.6/site-packages/dvc/repo/__init__.py", line 60, in wrapper return f(repo, *args, **kwargs) File "/home/elena/anaconda3/envs/myenv/lib/python3.6/site-packages/dvc/repo/experiments/run.py", line 62, in run target=target, params=params, **kwargs File "/home/elena/anaconda3/envs/myenv/lib/python3.6/site-packages/dvc/repo/experiments/__init__.py", line 418, in reproduce_one results = self.reproduce([stash_rev], keep_stash=False) File "/home/elena/anaconda3/envs/myenv/lib/python3.6/site-packages/dvc/repo/experiments/__init__.py", line 38, in wrapper return f(exp, *args, **kwargs) File "/home/elena/anaconda3/envs/myenv/lib/python3.6/site-packages/dvc/repo/experiments/__init__.py", line 593, in reproduce checkpoint_reset=checkpoint_reset, File "/home/elena/anaconda3/envs/myenv/lib/python3.6/site-packages/dvc/repo/experiments/executor.py", line 116, in __init__ self._config(cache_dir) File "/home/elena/anaconda3/envs/myenv/lib/python3.6/site-packages/dvc/repo/experiments/executor.py", line 127, in _config with open(local_config, "w") as fobj: FileNotFoundError: [Errno 2] No such file or directory: '/tmp/tmpmml3mawm/src/ai/training/.dvc/config.local' ------------------------------------------------------------ Adding '.dvc/config.local' to '.dvc/.gitignore'. Adding '.dvc/tmp' to '.dvc/.gitignore'. Adding '.dvc/experiments' to '.dvc/.gitignore'. Adding '.dvc/cache' to '.dvc/.gitignore'. Version info for developers: DVC version: 1.10.2 (pip) --------------------------------- Platform: Python 3.6.12 on Linux-5.4.0-48-generic-x86_64-with-debian-buster-sid Supports: gs, http, https Cache types: hardlink, symlink Cache directory: ext4 on /dev/nvme0n1p2 Caches: local Remotes: local Workspace directory: ext4 on /dev/nvme0n1p2 Repo: dvc (subdir), git
FileNotFoundError
def is_tracked(self, path: str) -> bool: rel = PathInfo(path).relative_to(self.root_dir).as_posix().encode() rel_dir = rel + b"/" for path in self.repo.open_index(): if path == rel or path.startswith(rel_dir): return True return False
def is_tracked(self, path: str) -> bool: from dvc.path_info import PathInfo rel = PathInfo(path).relative_to(self.root_dir).as_posix().encode() rel_dir = rel + b"/" for path in self.repo.open_index(): if path == rel or path.startswith(rel_dir): return True return False
https://github.com/iterative/dvc/issues/4969
Adding '.dvc/config.local' to '.dvc/.gitignore'. Adding '.dvc/tmp' to '.dvc/.gitignore'. Adding '.dvc/experiments' to '.dvc/.gitignore'. Adding '.dvc/cache' to '.dvc/.gitignore'. Check for update is enabled. assuming default target 'dvc.yaml'. fetched: [(3,)] Checking out experiment commit 'e6a4d8123aebe35a19b9e4544e21ac542a10as66' Patching experiment workspace Removing '/tmp/tmp8e9_4d6f' Adding '.dvc/experiments/src/ai/training/.dvc/config.local' to '.dvc/experiments/src/ai/training/.dvc/.gitignore'. Adding '.dvc/experiments/src/ai/training/.dvc/tmp' to '.dvc/experiments/src/ai/training/.dvc/.gitignore'. Adding '.dvc/experiments/src/ai/training/.dvc/experiments' to '.dvc/experiments/src/ai/training/.dvc/.gitignore'. Stashed experiment 'f951c9d' for future execution. Reproducing experiment revs 'f951c9d' Checking out experiment commit 'e6a4d8123aebe35a19b9e4544e21ac542a10s166' Writing '/tmp/tmpmml3mawm/.dvc/config'. Init local executor in dir '<TemporaryDirectory '/tmp/tmpmml3mawm'>' with baseline 'e6a4d81'. Writing experiments local config '/tmp/tmpmml3mawm/src/ai/training/.dvc/config.local' fetched: [(7583,)] unexpected error - [Errno 2] No such file or directory: '/tmp/tmpmml3mawm/src/ai/training/.dvc/config.local' FileNotFoundError: [Errno 2] No such file or directory: '/tmp/tmpmml3mawm/src/ai/training/.dvc/config.local' ------------------------------------------------------------ Traceback (most recent call last): File "/home/elena/anaconda3/envs/myenv/lib/python3.6/site-packages/dvc/main.py", line 90, in main ret = cmd.run() File "/home/elena/anaconda3/envs/myenv/lib/python3.6/site-packages/dvc/command/experiments.py", line 469, in run **self._repro_kwargs, File "/home/elena/anaconda3/envs/myenv/lib/python3.6/site-packages/dvc/repo/experiments/__init__.py", line 988, in run return run(self.repo, *args, **kwargs) File "/home/elena/anaconda3/envs/myenv/lib/python3.6/site-packages/dvc/repo/__init__.py", line 60, in wrapper return f(repo, *args, **kwargs) File "/home/elena/anaconda3/envs/myenv/lib/python3.6/site-packages/dvc/repo/experiments/run.py", line 62, in run target=target, params=params, **kwargs File "/home/elena/anaconda3/envs/myenv/lib/python3.6/site-packages/dvc/repo/experiments/__init__.py", line 418, in reproduce_one results = self.reproduce([stash_rev], keep_stash=False) File "/home/elena/anaconda3/envs/myenv/lib/python3.6/site-packages/dvc/repo/experiments/__init__.py", line 38, in wrapper return f(exp, *args, **kwargs) File "/home/elena/anaconda3/envs/myenv/lib/python3.6/site-packages/dvc/repo/experiments/__init__.py", line 593, in reproduce checkpoint_reset=checkpoint_reset, File "/home/elena/anaconda3/envs/myenv/lib/python3.6/site-packages/dvc/repo/experiments/executor.py", line 116, in __init__ self._config(cache_dir) File "/home/elena/anaconda3/envs/myenv/lib/python3.6/site-packages/dvc/repo/experiments/executor.py", line 127, in _config with open(local_config, "w") as fobj: FileNotFoundError: [Errno 2] No such file or directory: '/tmp/tmpmml3mawm/src/ai/training/.dvc/config.local' ------------------------------------------------------------ Adding '.dvc/config.local' to '.dvc/.gitignore'. Adding '.dvc/tmp' to '.dvc/.gitignore'. Adding '.dvc/experiments' to '.dvc/.gitignore'. Adding '.dvc/cache' to '.dvc/.gitignore'. Version info for developers: DVC version: 1.10.2 (pip) --------------------------------- Platform: Python 3.6.12 on Linux-5.4.0-48-generic-x86_64-with-debian-buster-sid Supports: gs, http, https Cache types: hardlink, symlink Cache directory: ext4 on /dev/nvme0n1p2 Caches: local Remotes: local Workspace directory: ext4 on /dev/nvme0n1p2 Repo: dvc (subdir), git
FileNotFoundError
def _run_callback(stage, callback_func): stage.save(allow_missing=True) stage.commit(allow_missing=True) logger.debug("Running checkpoint callback for stage '%s'", stage) callback_func()
def _run_callback(stage, callback_func): stage.save(allow_missing=True) stage.commit(allow_missing=True) for out in stage.outs: if not out.use_scm_ignore and out.is_in_repo: stage.repo.scm.track_file(os.fspath(out.path_info)) stage.repo.scm.track_changed_files() logger.debug("Running checkpoint callback for stage '%s'", stage) callback_func()
https://github.com/iterative/dvc/issues/4969
Adding '.dvc/config.local' to '.dvc/.gitignore'. Adding '.dvc/tmp' to '.dvc/.gitignore'. Adding '.dvc/experiments' to '.dvc/.gitignore'. Adding '.dvc/cache' to '.dvc/.gitignore'. Check for update is enabled. assuming default target 'dvc.yaml'. fetched: [(3,)] Checking out experiment commit 'e6a4d8123aebe35a19b9e4544e21ac542a10as66' Patching experiment workspace Removing '/tmp/tmp8e9_4d6f' Adding '.dvc/experiments/src/ai/training/.dvc/config.local' to '.dvc/experiments/src/ai/training/.dvc/.gitignore'. Adding '.dvc/experiments/src/ai/training/.dvc/tmp' to '.dvc/experiments/src/ai/training/.dvc/.gitignore'. Adding '.dvc/experiments/src/ai/training/.dvc/experiments' to '.dvc/experiments/src/ai/training/.dvc/.gitignore'. Stashed experiment 'f951c9d' for future execution. Reproducing experiment revs 'f951c9d' Checking out experiment commit 'e6a4d8123aebe35a19b9e4544e21ac542a10s166' Writing '/tmp/tmpmml3mawm/.dvc/config'. Init local executor in dir '<TemporaryDirectory '/tmp/tmpmml3mawm'>' with baseline 'e6a4d81'. Writing experiments local config '/tmp/tmpmml3mawm/src/ai/training/.dvc/config.local' fetched: [(7583,)] unexpected error - [Errno 2] No such file or directory: '/tmp/tmpmml3mawm/src/ai/training/.dvc/config.local' FileNotFoundError: [Errno 2] No such file or directory: '/tmp/tmpmml3mawm/src/ai/training/.dvc/config.local' ------------------------------------------------------------ Traceback (most recent call last): File "/home/elena/anaconda3/envs/myenv/lib/python3.6/site-packages/dvc/main.py", line 90, in main ret = cmd.run() File "/home/elena/anaconda3/envs/myenv/lib/python3.6/site-packages/dvc/command/experiments.py", line 469, in run **self._repro_kwargs, File "/home/elena/anaconda3/envs/myenv/lib/python3.6/site-packages/dvc/repo/experiments/__init__.py", line 988, in run return run(self.repo, *args, **kwargs) File "/home/elena/anaconda3/envs/myenv/lib/python3.6/site-packages/dvc/repo/__init__.py", line 60, in wrapper return f(repo, *args, **kwargs) File "/home/elena/anaconda3/envs/myenv/lib/python3.6/site-packages/dvc/repo/experiments/run.py", line 62, in run target=target, params=params, **kwargs File "/home/elena/anaconda3/envs/myenv/lib/python3.6/site-packages/dvc/repo/experiments/__init__.py", line 418, in reproduce_one results = self.reproduce([stash_rev], keep_stash=False) File "/home/elena/anaconda3/envs/myenv/lib/python3.6/site-packages/dvc/repo/experiments/__init__.py", line 38, in wrapper return f(exp, *args, **kwargs) File "/home/elena/anaconda3/envs/myenv/lib/python3.6/site-packages/dvc/repo/experiments/__init__.py", line 593, in reproduce checkpoint_reset=checkpoint_reset, File "/home/elena/anaconda3/envs/myenv/lib/python3.6/site-packages/dvc/repo/experiments/executor.py", line 116, in __init__ self._config(cache_dir) File "/home/elena/anaconda3/envs/myenv/lib/python3.6/site-packages/dvc/repo/experiments/executor.py", line 127, in _config with open(local_config, "w") as fobj: FileNotFoundError: [Errno 2] No such file or directory: '/tmp/tmpmml3mawm/src/ai/training/.dvc/config.local' ------------------------------------------------------------ Adding '.dvc/config.local' to '.dvc/.gitignore'. Adding '.dvc/tmp' to '.dvc/.gitignore'. Adding '.dvc/experiments' to '.dvc/.gitignore'. Adding '.dvc/cache' to '.dvc/.gitignore'. Version info for developers: DVC version: 1.10.2 (pip) --------------------------------- Platform: Python 3.6.12 on Linux-5.4.0-48-generic-x86_64-with-debian-buster-sid Supports: gs, http, https Cache types: hardlink, symlink Cache directory: ext4 on /dev/nvme0n1p2 Caches: local Remotes: local Workspace directory: ext4 on /dev/nvme0n1p2 Repo: dvc (subdir), git
FileNotFoundError
def _reflink_darwin(src, dst): import ctypes LIBC = "libc.dylib" LIBC_FALLBACK = "/usr/lib/libSystem.dylib" try: clib = ctypes.CDLL(LIBC) except OSError as exc: logger.debug( "unable to access '{}' (errno '{}'). Falling back to '{}'.".format( LIBC, exc.errno, LIBC_FALLBACK ) ) if exc.errno != errno.ENOENT: raise # NOTE: trying to bypass System Integrity Protection (SIP) clib = ctypes.CDLL(LIBC_FALLBACK) if not hasattr(clib, "clonefile"): return -1 clonefile = clib.clonefile clonefile.argtypes = [ctypes.c_char_p, ctypes.c_char_p, ctypes.c_int] clonefile.restype = ctypes.c_int return clonefile( ctypes.c_char_p(os.fsencode(src)), ctypes.c_char_p(os.fsencode(dst)), ctypes.c_int(0), )
def _reflink_darwin(src, dst): import ctypes LIBC = "libc.dylib" LIBC_FALLBACK = "/usr/lib/libSystem.dylib" try: clib = ctypes.CDLL(LIBC) except OSError as exc: logger.debug( "unable to access '{}' (errno '{}'). Falling back to '{}'.".format( LIBC, exc.errno, LIBC_FALLBACK ) ) if exc.errno != errno.ENOENT: raise # NOTE: trying to bypass System Integrity Protection (SIP) clib = ctypes.CDLL(LIBC_FALLBACK) if not hasattr(clib, "clonefile"): return -1 clonefile = clib.clonefile clonefile.argtypes = [ctypes.c_char_p, ctypes.c_char_p, ctypes.c_int] clonefile.restype = ctypes.c_int return clonefile( ctypes.c_char_p(src.encode("utf-8")), ctypes.c_char_p(dst.encode("utf-8")), ctypes.c_int(0), )
https://github.com/iterative/dvc/issues/5083
2020-12-11 16:32:04,319 DEBUG: 'aug_set/annotations/sydney-australia-–-january-–-red-bull-energy-drink-mini-cooper-publicity-car-can-red-bull-drink-behind-used-123644712-0.json' doesn't exist. 2020-12-11 16:32:04,321 DEBUG: fetched: [(92173,)] 4:33 2020-12-11 16:32:04,325 ERROR: unexpected error - 'utf-8' codec can't encode characters in position 103-110: surrogates not allowed ------------------------------------------------------------ Traceback (most recent call last): File "/usr/local/Cellar/dvc/1.10.2/libexec/lib/python3.9/site-packages/dvc/main.py", line 90, in main ret = cmd.run() File "/usr/local/Cellar/dvc/1.10.2/libexec/lib/python3.9/site-packages/dvc/command/data_sync.py", line 26, in run stats = self.repo.pull( File "/usr/local/Cellar/dvc/1.10.2/libexec/lib/python3.9/site-packages/dvc/repo/__init__.py", line 60, in wrapper return f(repo, *args, **kwargs) File "/usr/local/Cellar/dvc/1.10.2/libexec/lib/python3.9/site-packages/dvc/repo/pull.py", line 36, in pull stats = self.checkout( File "/usr/local/Cellar/dvc/1.10.2/libexec/lib/python3.9/site-packages/dvc/repo/__init__.py", line 60, in wrapper return f(repo, *args, **kwargs) File "/usr/local/Cellar/dvc/1.10.2/libexec/lib/python3.9/site-packages/dvc/repo/checkout.py", line 96, in checkout result = stage.checkout( File "/usr/local/Cellar/dvc/1.10.2/libexec/lib/python3.9/site-packages/funcy/decorators.py", line 39, in wrapper return deco(call, *dargs, **dkwargs) File "/usr/local/Cellar/dvc/1.10.2/libexec/lib/python3.9/site-packages/dvc/stage/decorators.py", line 36, in rwlocked return call() File "/usr/local/Cellar/dvc/1.10.2/libexec/lib/python3.9/site-packages/funcy/decorators.py", line 60, in __call__ return self._func(*self._args, **self._kwargs) File "/usr/local/Cellar/dvc/1.10.2/libexec/lib/python3.9/site-packages/dvc/stage/__init__.py", line 502, in checkout key, outs = self._checkout(out, **kwargs) File "/usr/local/Cellar/dvc/1.10.2/libexec/lib/python3.9/site-packages/dvc/stage/__init__.py", line 510, in _checkout result = out.checkout(**kwargs) File "/usr/local/Cellar/dvc/1.10.2/libexec/lib/python3.9/site-packages/dvc/output/base.py", line 356, in checkout return self.cache.checkout( File "/usr/local/Cellar/dvc/1.10.2/libexec/lib/python3.9/site-packages/funcy/decorators.py", line 39, in wrapper return deco(call, *dargs, **dkwargs) File "/usr/local/Cellar/dvc/1.10.2/libexec/lib/python3.9/site-packages/dvc/cache/base.py", line 40, in use_state return call() File "/usr/local/Cellar/dvc/1.10.2/libexec/lib/python3.9/site-packages/funcy/decorators.py", line 60, in __call__ return self._func(*self._args, **self._kwargs) File "/usr/local/Cellar/dvc/1.10.2/libexec/lib/python3.9/site-packages/dvc/cache/base.py", line 555, in checkout return self._checkout( File "/usr/local/Cellar/dvc/1.10.2/libexec/lib/python3.9/site-packages/dvc/cache/base.py", line 578, in _checkout return self._checkout_dir( File "/usr/local/Cellar/dvc/1.10.2/libexec/lib/python3.9/site-packages/dvc/cache/base.py", line 472, in _checkout_dir self.link(entry_cache_info, entry_info) File "/usr/local/Cellar/dvc/1.10.2/libexec/lib/python3.9/site-packages/dvc/cache/base.py", line 141, in link self._link(from_info, to_info, self.cache_types) File "/usr/local/Cellar/dvc/1.10.2/libexec/lib/python3.9/site-packages/dvc/cache/base.py", line 148, in _link self._try_links(from_info, to_info, link_types) File "/usr/local/Cellar/dvc/1.10.2/libexec/lib/python3.9/site-packages/dvc/remote/slow_link_detection.py", line 38, in wrapper result = f(remote, *args, **kwargs) File "/usr/local/Cellar/dvc/1.10.2/libexec/lib/python3.9/site-packages/dvc/cache/base.py", line 166, in _try_links self._do_link(from_info, to_info, link_method) File "/usr/local/Cellar/dvc/1.10.2/libexec/lib/python3.9/site-packages/dvc/cache/base.py", line 182, in _do_link link_method(from_info, to_info) File "/usr/local/Cellar/dvc/1.10.2/libexec/lib/python3.9/site-packages/dvc/tree/local.py", line 240, in reflink System.reflink(from_info, tmp_info) File "/usr/local/Cellar/dvc/1.10.2/libexec/lib/python3.9/site-packages/dvc/system.py", line 108, in reflink ret = System._reflink_darwin(source, link_name) File "/usr/local/Cellar/dvc/1.10.2/libexec/lib/python3.9/site-packages/dvc/system.py", line 75, in _reflink_darwin ctypes.c_char_p(dst.encode("utf-8")), UnicodeEncodeError: 'utf-8' codec can't encode characters in position 103-110: surrogates not allowed ------------------------------------------------------------ 2020-12-11 16:32:04,710 DEBUG: Version info for developers: DVC version: 1.10.2 (brew) --------------------------------- Platform: Python 3.9.0 on macOS-10.15.7-x86_64-i386-64bit Supports: azure, gdrive, gs, http, https, s3, ssh, oss, webdav, webdavs Cache types: reflink, hardlink, symlink Caches: local Remotes: s3 Repo: dvc, git Having any troubles? Hit us up at https://dvc.org/support, we are always happy to help! 2020-12-11 16:32:04,712 DEBUG: Analytics is disabled.
UnicodeEncodeError
def _filter_names( names: Iterable, label: str, include: Optional[Iterable], exclude: Optional[Iterable], ): if include and exclude: intersection = set(include) & set(exclude) if intersection: values = ", ".join(intersection) raise InvalidArgumentError( f"'{values}' specified in both --include-{label} and --exclude-{label}" ) names = [tuple(name.split(".")) for name in names] def _filter(filters, update_func): filters = [tuple(name.split(".")) for name in filters] for length, groups in groupby(filters, len): for group in groups: matches = [name for name in names if name[:length] == group] if not matches: name = ".".join(group) raise InvalidArgumentError( f"'{name}' does not match any known {label}" ) update_func({match: None for match in matches}) if include: ret: OrderedDict = OrderedDict() _filter(include, ret.update) else: ret = OrderedDict({name: None for name in names}) if exclude: to_remove = {} _filter(exclude, to_remove.update) for key in to_remove: if key in ret: del ret[key] return [".".join(name) for name in ret]
def _filter_names( names: Iterable, label: str, include: Optional[Iterable], exclude: Optional[Iterable], ): if include and exclude: intersection = set(include) & set(exclude) if intersection: values = ", ".join(intersection) raise InvalidArgumentError( f"'{values}' specified in both --include-{label} and --exclude-{label}" ) names = [tuple(name.split(".")) for name in names] def _filter(filters, update_func): filters = [tuple(name.split(".")) for name in filters] for length, groups in groupby(filters, len): for group in groups: matches = [name for name in names if name[:length] == group] if not matches: name = ".".join(group) raise InvalidArgumentError( f"'{name}' does not match any known {label}" ) update_func({match: None for match in matches}) if include: ret: OrderedDict = OrderedDict() _filter(include, ret.update) else: ret = OrderedDict({name: None for name in names}) if exclude: _filter(exclude, ret.difference_update) # type: ignore[attr-defined] return [".".join(name) for name in ret]
https://github.com/iterative/dvc/issues/4935
dvc exp show --exclude-metrics train -v 2020-11-22 14:31:39,852 DEBUG: Check for update is enabled. 2020-11-22 14:31:39,880 DEBUG: fetched: [(3,)] 2020-11-22 14:31:41,553 DEBUG: fetched: [(12331,)] 2020-11-22 14:31:42,627 ERROR: unexpected error - 'collections.OrderedDict' object has no attribute 'difference_update' ------------------------------------------------------------ Traceback (most recent call last): File "/home/saugat/repos/iterative/dvc/dvc/main.py", line 90, in main ret = cmd.run() File "/home/saugat/repos/iterative/dvc/dvc/command/experiments.py", line 335, in run _show_experiments( File "/home/saugat/repos/iterative/dvc/dvc/command/experiments.py", line 265, in _show_experiments metric_names, param_names = _collect_names( File "/home/saugat/repos/iterative/dvc/dvc/command/experiments.py", line 84, in _collect_names metric_names = _filter_names( File "/home/saugat/repos/iterative/dvc/dvc/command/experiments.py", line 61, in _filter_names _filter(exclude, ret.difference_update) AttributeError: 'collections.OrderedDict' object has no attribute 'difference_update' ------------------------------------------------------------
AttributeError
def init(root_dir=os.curdir, no_scm=False, force=False, subdir=False): """ Creates an empty repo on the given directory -- basically a `.dvc` directory with subdirectories for configuration and cache. It should be tracked by a SCM or use the `--no-scm` flag. If the given directory is not empty, you must use the `--force` flag to override it. Args: root_dir: Path to repo's root directory. Returns: Repo instance. Raises: KeyError: Raises an exception. """ if no_scm and subdir: raise InvalidArgumentError( "Cannot initialize repo with `--no-scm` and `--subdir`" ) root_dir = os.path.realpath(root_dir) dvc_dir = os.path.join(root_dir, Repo.DVC_DIR) try: scm = SCM(root_dir, search_parent_directories=subdir, no_scm=no_scm) except SCMError: raise InitError( f"{root_dir} is not tracked by any supported SCM tool (e.g. Git). " "Use `--no-scm` if you don't want to use any SCM or " "`--subdir` if initializing inside a subdirectory of a parent SCM " "repository." ) if scm.is_ignored(dvc_dir): raise InitError( f"{dvc_dir} is ignored by your SCM tool. \n" "Make sure that it's tracked, " "for example, by adding '!.dvc' to .gitignore." ) if os.path.isdir(dvc_dir): if not force: raise InitError(f"'{relpath(dvc_dir)}' exists. Use `-f` to force.") remove(dvc_dir) os.mkdir(dvc_dir) config = Config.init(dvc_dir) if no_scm: with config.edit() as conf: conf["core"]["no_scm"] = True dvcignore = init_dvcignore(root_dir) proj = Repo(root_dir) proj.plots.templates.init() scm.add([config.files["repo"], dvcignore, proj.plots.templates.templates_dir]) if scm.ignore_file: scm.add([os.path.join(dvc_dir, scm.ignore_file)]) logger.info("\nYou can now commit the changes to git.\n") return proj
def init(root_dir=os.curdir, no_scm=False, force=False, subdir=False): """ Creates an empty repo on the given directory -- basically a `.dvc` directory with subdirectories for configuration and cache. It should be tracked by a SCM or use the `--no-scm` flag. If the given directory is not empty, you must use the `--force` flag to override it. Args: root_dir: Path to repo's root directory. Returns: Repo instance. Raises: KeyError: Raises an exception. """ if no_scm and subdir: raise InvalidArgumentError( "Cannot initialize repo with `--no-scm` and `--subdir`" ) root_dir = os.path.realpath(root_dir) dvc_dir = os.path.join(root_dir, Repo.DVC_DIR) try: scm = SCM(root_dir, search_parent_directories=subdir, no_scm=no_scm) except SCMError: raise InitError( "{repo} is not tracked by any supported SCM tool (e.g. Git). " "Use `--no-scm` if you don't want to use any SCM or " "`--subdir` if initializing inside a subdirectory of a parent SCM " "repository.".format(repo=root_dir) ) if os.path.isdir(dvc_dir): if not force: raise InitError( "'{repo}' exists. Use `-f` to force.".format(repo=relpath(dvc_dir)) ) remove(dvc_dir) os.mkdir(dvc_dir) config = Config.init(dvc_dir) if no_scm: with config.edit() as conf: conf["core"]["no_scm"] = True dvcignore = init_dvcignore(root_dir) proj = Repo(root_dir) proj.plots.templates.init() scm.add([config.files["repo"], dvcignore, proj.plots.templates.templates_dir]) if scm.ignore_file: scm.add([os.path.join(dvc_dir, scm.ignore_file)]) logger.info("\nYou can now commit the changes to git.\n") return proj
https://github.com/iterative/dvc/issues/3738
Traceback (most recent call last): File "dvc\main.py", line 49, in main File "dvc\command\init.py", line 21, in run File "dvc\repo__init.py", line 155, in init File "dvc\repo\init.py", line 108, in init File "dvc\scm\git__init.py", line 194, in add File "site-packages\git\index\base.py", line 740, in add File "site-packages\git\util.py", line 68, in wrapper File "site-packages\git\index\util.py", line 91, in set_git_working_dir File "site-packages\git\index\base.py", line 626, in _entries_for_paths File "site-packages\git\index\base.py", line 587, in _store_path FileNotFoundError: [WinError 2] Das System kann die angegebene Datei nicht finden: '.dvc\.gitignore'
FileNotFoundError
def ignore(self, path): entry, gitignore = self._get_gitignore(path) if self.is_ignored(path): return msg = "Adding '{}' to '{}'.".format(relpath(path), relpath(gitignore)) logger.debug(msg) self._add_entry_to_gitignore(entry, gitignore) self.track_file(relpath(gitignore)) self.ignored_paths.append(path)
def ignore(self, path): entry, gitignore = self._get_gitignore(path) if self._ignored(path): return msg = "Adding '{}' to '{}'.".format(relpath(path), relpath(gitignore)) logger.debug(msg) self._add_entry_to_gitignore(entry, gitignore) self.track_file(relpath(gitignore)) self.ignored_paths.append(path)
https://github.com/iterative/dvc/issues/3738
Traceback (most recent call last): File "dvc\main.py", line 49, in main File "dvc\command\init.py", line 21, in run File "dvc\repo__init.py", line 155, in init File "dvc\repo\init.py", line 108, in init File "dvc\scm\git__init.py", line 194, in add File "site-packages\git\index\base.py", line 740, in add File "site-packages\git\util.py", line 68, in wrapper File "site-packages\git\index\util.py", line 91, in set_git_working_dir File "site-packages\git\index\base.py", line 626, in _entries_for_paths File "site-packages\git\index\base.py", line 587, in _store_path FileNotFoundError: [WinError 2] Das System kann die angegebene Datei nicht finden: '.dvc\.gitignore'
FileNotFoundError
def checkout( self, path_info, hash_info, force=False, progress_callback=None, relink=False, filter_info=None, quiet=False, ): if path_info.scheme not in ["local", self.tree.scheme]: raise NotImplementedError failed = None skip = False if not hash_info: if not quiet: logger.warning( "No file hash info found for '%s'. It won't be created.", path_info, ) self.safe_remove(path_info, force=force) failed = path_info elif not relink and not self.changed(path_info, hash_info): logger.debug("Data '%s' didn't change.", path_info) skip = True elif self.changed_cache(hash_info, path_info=path_info, filter_info=filter_info): if not quiet: logger.warning( "Cache '%s' not found. File '%s' won't be created.", hash_info, path_info, ) self.safe_remove(path_info, force=force) failed = path_info if failed or skip: if progress_callback: progress_callback( str(path_info), self.get_files_number(self.tree.path_info, hash_info, filter_info), ) if failed: raise CheckoutError([failed]) return logger.debug("Checking out '%s' with cache '%s'.", path_info, hash_info) return self._checkout( path_info, hash_info, force, progress_callback, relink, filter_info, )
def checkout( self, path_info, hash_info, force=False, progress_callback=None, relink=False, filter_info=None, ): if path_info.scheme not in ["local", self.tree.scheme]: raise NotImplementedError failed = None skip = False if not hash_info: logger.warning( "No file hash info found for '%s'. It won't be created.", path_info, ) self.safe_remove(path_info, force=force) failed = path_info elif not relink and not self.changed(path_info, hash_info): logger.debug("Data '%s' didn't change.", path_info) skip = True elif self.changed_cache(hash_info, path_info=path_info, filter_info=filter_info): logger.warning( "Cache '%s' not found. File '%s' won't be created.", hash_info, path_info, ) self.safe_remove(path_info, force=force) failed = path_info if failed or skip: if progress_callback: progress_callback( str(path_info), self.get_files_number(self.tree.path_info, hash_info, filter_info), ) if failed: raise CheckoutError([failed]) return logger.debug("Checking out '%s' with cache '%s'.", path_info, hash_info) return self._checkout( path_info, hash_info, force, progress_callback, relink, filter_info, )
https://github.com/iterative/dvc/issues/4777
❯ dvc exp run --continue -v ... 2020-10-23 16:36:29,034 DEBUG: Commit to current experiment branch 2020-10-23 16:36:29,118 DEBUG: Checking out experiment commit 'd5dbcff520d30b5d92a863049f7259044a145a28' 2020-10-23 16:36:29,148 DEBUG: Patching local workspace 2020-10-23 16:36:29,154 DEBUG: Removing '/var/folders/s_/j8cg24s945dcvlh77c677f080000gn/T/tmpj3mfqijf' 2020-10-23 16:36:29,155 DEBUG: fetched: [(60,)] 2020-10-23 16:36:29,156 ERROR: failed to apply experiment changes. ------------------------------------------------------------ Traceback (most recent call last): File "/Users/pmrowla/git/dvc/dvc/repo/experiments/__init__.py", line 770, in checkout_exp self.repo.scm.repo.git.apply(tmp, reverse=True) File "/Users/pmrowla/.virtualenvs/dvc/lib/python3.8/site-packages/git/cmd.py", line 542, in <lambda> return lambda *args, **kwargs: self._call_process(name, *args, **kwargs) File "/Users/pmrowla/.virtualenvs/dvc/lib/python3.8/site-packages/git/cmd.py", line 1005, in _call_process return self.execute(call, **exec_kwargs) File "/Users/pmrowla/.virtualenvs/dvc/lib/python3.8/site-packages/git/cmd.py", line 822, in execute raise GitCommandError(command, status, stderr_value, stdout_value) git.exc.GitCommandError: Cmd('git') failed due to: exit code(1) cmdline: git apply --reverse /var/folders/s_/j8cg24s945dcvlh77c677f080000gn/T/tmpj3mfqijf stderr: 'error: dvc.lock: already exists in working directory' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/Users/pmrowla/git/dvc/dvc/command/experiments.py", line 456, in run self.repo.experiments.run( File "/Users/pmrowla/git/dvc/dvc/repo/experiments/__init__.py", line 881, in run return run(self.repo, *args, **kwargs) File "/Users/pmrowla/git/dvc/dvc/repo/__init__.py", line 51, in wrapper return f(repo, *args, **kwargs) File "/Users/pmrowla/git/dvc/dvc/repo/experiments/run.py", line 62, in run return repo.experiments.reproduce_one( File "/Users/pmrowla/git/dvc/dvc/repo/experiments/__init__.py", line 398, in reproduce_one self.checkout_exp(exp_rev, allow_missing=checkpoint) File "/Users/pmrowla/git/dvc/dvc/repo/experiments/__init__.py", line 38, in wrapper return f(exp, *args, **kwargs) File "/Users/pmrowla/git/dvc/dvc/repo/experiments/__init__.py", line 775, in checkout_exp raise DvcException("failed to apply experiment changes.") dvc.exceptions.DvcException: failed to apply experiment changes. ------------------------------------------------------------
git.exc.GitCommandError
def checkout( self, force=False, progress_callback=None, relink=False, filter_info=None, allow_missing=False, **kwargs, ): if not self.use_cache: if progress_callback: progress_callback(str(self.path_info), self.get_files_number(filter_info)) return None try: return self.cache.checkout( self.path_info, self.hash_info, force=force, progress_callback=progress_callback, relink=relink, filter_info=filter_info, **kwargs, ) except CheckoutError: if allow_missing: return None raise
def checkout( self, force=False, progress_callback=None, relink=False, filter_info=None, allow_missing=False, ): if not self.use_cache: if progress_callback: progress_callback(str(self.path_info), self.get_files_number(filter_info)) return None try: return self.cache.checkout( self.path_info, self.hash_info, force=force, progress_callback=progress_callback, relink=relink, filter_info=filter_info, ) except CheckoutError: if allow_missing: return None raise
https://github.com/iterative/dvc/issues/4777
❯ dvc exp run --continue -v ... 2020-10-23 16:36:29,034 DEBUG: Commit to current experiment branch 2020-10-23 16:36:29,118 DEBUG: Checking out experiment commit 'd5dbcff520d30b5d92a863049f7259044a145a28' 2020-10-23 16:36:29,148 DEBUG: Patching local workspace 2020-10-23 16:36:29,154 DEBUG: Removing '/var/folders/s_/j8cg24s945dcvlh77c677f080000gn/T/tmpj3mfqijf' 2020-10-23 16:36:29,155 DEBUG: fetched: [(60,)] 2020-10-23 16:36:29,156 ERROR: failed to apply experiment changes. ------------------------------------------------------------ Traceback (most recent call last): File "/Users/pmrowla/git/dvc/dvc/repo/experiments/__init__.py", line 770, in checkout_exp self.repo.scm.repo.git.apply(tmp, reverse=True) File "/Users/pmrowla/.virtualenvs/dvc/lib/python3.8/site-packages/git/cmd.py", line 542, in <lambda> return lambda *args, **kwargs: self._call_process(name, *args, **kwargs) File "/Users/pmrowla/.virtualenvs/dvc/lib/python3.8/site-packages/git/cmd.py", line 1005, in _call_process return self.execute(call, **exec_kwargs) File "/Users/pmrowla/.virtualenvs/dvc/lib/python3.8/site-packages/git/cmd.py", line 822, in execute raise GitCommandError(command, status, stderr_value, stdout_value) git.exc.GitCommandError: Cmd('git') failed due to: exit code(1) cmdline: git apply --reverse /var/folders/s_/j8cg24s945dcvlh77c677f080000gn/T/tmpj3mfqijf stderr: 'error: dvc.lock: already exists in working directory' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/Users/pmrowla/git/dvc/dvc/command/experiments.py", line 456, in run self.repo.experiments.run( File "/Users/pmrowla/git/dvc/dvc/repo/experiments/__init__.py", line 881, in run return run(self.repo, *args, **kwargs) File "/Users/pmrowla/git/dvc/dvc/repo/__init__.py", line 51, in wrapper return f(repo, *args, **kwargs) File "/Users/pmrowla/git/dvc/dvc/repo/experiments/run.py", line 62, in run return repo.experiments.reproduce_one( File "/Users/pmrowla/git/dvc/dvc/repo/experiments/__init__.py", line 398, in reproduce_one self.checkout_exp(exp_rev, allow_missing=checkpoint) File "/Users/pmrowla/git/dvc/dvc/repo/experiments/__init__.py", line 38, in wrapper return f(exp, *args, **kwargs) File "/Users/pmrowla/git/dvc/dvc/repo/experiments/__init__.py", line 775, in checkout_exp raise DvcException("failed to apply experiment changes.") dvc.exceptions.DvcException: failed to apply experiment changes. ------------------------------------------------------------
git.exc.GitCommandError
def checkout( self, targets=None, with_deps=False, force=False, relink=False, recursive=False, allow_missing=False, **kwargs, ): from dvc.stage.exceptions import ( StageFileBadNameError, StageFileDoesNotExistError, ) unused = [] stats = { "added": [], "deleted": [], "modified": [], "failed": [], } if not targets: targets = [None] unused = _get_unused_links(self) stats["deleted"] = [_fspath_dir(u) for u in unused] self.state.remove_links(unused) if isinstance(targets, str): targets = [targets] pairs = set() for target in targets: try: pairs.update( self.collect_granular(target, with_deps=with_deps, recursive=recursive) ) except ( StageFileDoesNotExistError, StageFileBadNameError, NoOutputOrStageError, ) as exc: if not target: raise raise CheckoutErrorSuggestGit(target) from exc total = get_all_files_numbers(pairs) with Tqdm(total=total, unit="file", desc="Checkout", disable=total == 0) as pbar: for stage, filter_info in pairs: result = stage.checkout( force=force, progress_callback=pbar.update_msg, relink=relink, filter_info=filter_info, allow_missing=allow_missing, **kwargs, ) for key, items in result.items(): stats[key].extend(_fspath_dir(path) for path in items) if stats.get("failed"): raise CheckoutError(stats["failed"], stats) del stats["failed"] return stats
def checkout( self, targets=None, with_deps=False, force=False, relink=False, recursive=False, allow_missing=False, ): from dvc.stage.exceptions import ( StageFileBadNameError, StageFileDoesNotExistError, ) unused = [] stats = { "added": [], "deleted": [], "modified": [], "failed": [], } if not targets: targets = [None] unused = _get_unused_links(self) stats["deleted"] = [_fspath_dir(u) for u in unused] self.state.remove_links(unused) if isinstance(targets, str): targets = [targets] pairs = set() for target in targets: try: pairs.update( self.collect_granular(target, with_deps=with_deps, recursive=recursive) ) except ( StageFileDoesNotExistError, StageFileBadNameError, NoOutputOrStageError, ) as exc: if not target: raise raise CheckoutErrorSuggestGit(target) from exc total = get_all_files_numbers(pairs) with Tqdm(total=total, unit="file", desc="Checkout", disable=total == 0) as pbar: for stage, filter_info in pairs: result = stage.checkout( force=force, progress_callback=pbar.update_msg, relink=relink, filter_info=filter_info, allow_missing=allow_missing, ) for key, items in result.items(): stats[key].extend(_fspath_dir(path) for path in items) if stats.get("failed"): raise CheckoutError(stats["failed"], stats) del stats["failed"] return stats
https://github.com/iterative/dvc/issues/4777
❯ dvc exp run --continue -v ... 2020-10-23 16:36:29,034 DEBUG: Commit to current experiment branch 2020-10-23 16:36:29,118 DEBUG: Checking out experiment commit 'd5dbcff520d30b5d92a863049f7259044a145a28' 2020-10-23 16:36:29,148 DEBUG: Patching local workspace 2020-10-23 16:36:29,154 DEBUG: Removing '/var/folders/s_/j8cg24s945dcvlh77c677f080000gn/T/tmpj3mfqijf' 2020-10-23 16:36:29,155 DEBUG: fetched: [(60,)] 2020-10-23 16:36:29,156 ERROR: failed to apply experiment changes. ------------------------------------------------------------ Traceback (most recent call last): File "/Users/pmrowla/git/dvc/dvc/repo/experiments/__init__.py", line 770, in checkout_exp self.repo.scm.repo.git.apply(tmp, reverse=True) File "/Users/pmrowla/.virtualenvs/dvc/lib/python3.8/site-packages/git/cmd.py", line 542, in <lambda> return lambda *args, **kwargs: self._call_process(name, *args, **kwargs) File "/Users/pmrowla/.virtualenvs/dvc/lib/python3.8/site-packages/git/cmd.py", line 1005, in _call_process return self.execute(call, **exec_kwargs) File "/Users/pmrowla/.virtualenvs/dvc/lib/python3.8/site-packages/git/cmd.py", line 822, in execute raise GitCommandError(command, status, stderr_value, stdout_value) git.exc.GitCommandError: Cmd('git') failed due to: exit code(1) cmdline: git apply --reverse /var/folders/s_/j8cg24s945dcvlh77c677f080000gn/T/tmpj3mfqijf stderr: 'error: dvc.lock: already exists in working directory' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/Users/pmrowla/git/dvc/dvc/command/experiments.py", line 456, in run self.repo.experiments.run( File "/Users/pmrowla/git/dvc/dvc/repo/experiments/__init__.py", line 881, in run return run(self.repo, *args, **kwargs) File "/Users/pmrowla/git/dvc/dvc/repo/__init__.py", line 51, in wrapper return f(repo, *args, **kwargs) File "/Users/pmrowla/git/dvc/dvc/repo/experiments/run.py", line 62, in run return repo.experiments.reproduce_one( File "/Users/pmrowla/git/dvc/dvc/repo/experiments/__init__.py", line 398, in reproduce_one self.checkout_exp(exp_rev, allow_missing=checkpoint) File "/Users/pmrowla/git/dvc/dvc/repo/experiments/__init__.py", line 38, in wrapper return f(exp, *args, **kwargs) File "/Users/pmrowla/git/dvc/dvc/repo/experiments/__init__.py", line 775, in checkout_exp raise DvcException("failed to apply experiment changes.") dvc.exceptions.DvcException: failed to apply experiment changes. ------------------------------------------------------------
git.exc.GitCommandError
def reproduce_one(self, queue=False, **kwargs): """Reproduce and checkout a single experiment.""" checkpoint = kwargs.get("checkpoint", False) stash_rev = self.new(**kwargs) if queue: logger.info("Queued experiment '%s' for future execution.", stash_rev[:7]) return [stash_rev] results = self.reproduce([stash_rev], keep_stash=False, checkpoint=checkpoint) exp_rev = first(results) if exp_rev is not None: self.checkout_exp(exp_rev) return results
def reproduce_one(self, queue=False, **kwargs): """Reproduce and checkout a single experiment.""" checkpoint = kwargs.get("checkpoint", False) stash_rev = self.new(**kwargs) if queue: logger.info("Queued experiment '%s' for future execution.", stash_rev[:7]) return [stash_rev] results = self.reproduce([stash_rev], keep_stash=False, checkpoint=checkpoint) exp_rev = first(results) if exp_rev is not None: self.checkout_exp(exp_rev, allow_missing=checkpoint) return results
https://github.com/iterative/dvc/issues/4777
❯ dvc exp run --continue -v ... 2020-10-23 16:36:29,034 DEBUG: Commit to current experiment branch 2020-10-23 16:36:29,118 DEBUG: Checking out experiment commit 'd5dbcff520d30b5d92a863049f7259044a145a28' 2020-10-23 16:36:29,148 DEBUG: Patching local workspace 2020-10-23 16:36:29,154 DEBUG: Removing '/var/folders/s_/j8cg24s945dcvlh77c677f080000gn/T/tmpj3mfqijf' 2020-10-23 16:36:29,155 DEBUG: fetched: [(60,)] 2020-10-23 16:36:29,156 ERROR: failed to apply experiment changes. ------------------------------------------------------------ Traceback (most recent call last): File "/Users/pmrowla/git/dvc/dvc/repo/experiments/__init__.py", line 770, in checkout_exp self.repo.scm.repo.git.apply(tmp, reverse=True) File "/Users/pmrowla/.virtualenvs/dvc/lib/python3.8/site-packages/git/cmd.py", line 542, in <lambda> return lambda *args, **kwargs: self._call_process(name, *args, **kwargs) File "/Users/pmrowla/.virtualenvs/dvc/lib/python3.8/site-packages/git/cmd.py", line 1005, in _call_process return self.execute(call, **exec_kwargs) File "/Users/pmrowla/.virtualenvs/dvc/lib/python3.8/site-packages/git/cmd.py", line 822, in execute raise GitCommandError(command, status, stderr_value, stdout_value) git.exc.GitCommandError: Cmd('git') failed due to: exit code(1) cmdline: git apply --reverse /var/folders/s_/j8cg24s945dcvlh77c677f080000gn/T/tmpj3mfqijf stderr: 'error: dvc.lock: already exists in working directory' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/Users/pmrowla/git/dvc/dvc/command/experiments.py", line 456, in run self.repo.experiments.run( File "/Users/pmrowla/git/dvc/dvc/repo/experiments/__init__.py", line 881, in run return run(self.repo, *args, **kwargs) File "/Users/pmrowla/git/dvc/dvc/repo/__init__.py", line 51, in wrapper return f(repo, *args, **kwargs) File "/Users/pmrowla/git/dvc/dvc/repo/experiments/run.py", line 62, in run return repo.experiments.reproduce_one( File "/Users/pmrowla/git/dvc/dvc/repo/experiments/__init__.py", line 398, in reproduce_one self.checkout_exp(exp_rev, allow_missing=checkpoint) File "/Users/pmrowla/git/dvc/dvc/repo/experiments/__init__.py", line 38, in wrapper return f(exp, *args, **kwargs) File "/Users/pmrowla/git/dvc/dvc/repo/experiments/__init__.py", line 775, in checkout_exp raise DvcException("failed to apply experiment changes.") dvc.exceptions.DvcException: failed to apply experiment changes. ------------------------------------------------------------
git.exc.GitCommandError
def checkout_exp(self, rev, **kwargs): """Checkout an experiment to the user's workspace.""" from git.exc import GitCommandError from dvc.repo.checkout import checkout as dvc_checkout baseline_rev = self._check_baseline(rev) self._scm_checkout(rev) branch = self._get_branch_containing(rev) m = self.BRANCH_RE.match(branch) if m and m.group("checkpoint"): kwargs.update({"allow_missing": True, "quiet": True}) tmp = tempfile.NamedTemporaryFile(delete=False).name self.scm.repo.head.commit.diff( baseline_rev, patch=True, full_index=True, binary=True, output=tmp ) dirty = self.repo.scm.is_dirty(untracked_files=True) if dirty: logger.debug("Stashing workspace changes.") self.repo.scm.repo.git.stash("push", "--include-untracked") try: if os.path.getsize(tmp): logger.debug("Patching local workspace") self.repo.scm.repo.git.apply(tmp, reverse=True) need_checkout = True else: need_checkout = False except GitCommandError: raise DvcException("failed to apply experiment changes.") finally: remove(tmp) if dirty: self._unstash_workspace() if need_checkout: dvc_checkout(self.repo, **kwargs)
def checkout_exp(self, rev, allow_missing=False): """Checkout an experiment to the user's workspace.""" from git.exc import GitCommandError from dvc.repo.checkout import checkout as dvc_checkout baseline_rev = self._check_baseline(rev) self._scm_checkout(rev) tmp = tempfile.NamedTemporaryFile(delete=False).name self.scm.repo.head.commit.diff( baseline_rev, patch=True, full_index=True, binary=True, output=tmp ) dirty = self.repo.scm.is_dirty() if dirty: logger.debug("Stashing workspace changes.") self.repo.scm.repo.git.stash("push", "--include-untracked") try: if os.path.getsize(tmp): logger.debug("Patching local workspace") self.repo.scm.repo.git.apply(tmp, reverse=True) need_checkout = True else: need_checkout = False except GitCommandError: raise DvcException("failed to apply experiment changes.") finally: remove(tmp) if dirty: self._unstash_workspace() if need_checkout: dvc_checkout(self.repo, allow_missing=allow_missing)
https://github.com/iterative/dvc/issues/4777
❯ dvc exp run --continue -v ... 2020-10-23 16:36:29,034 DEBUG: Commit to current experiment branch 2020-10-23 16:36:29,118 DEBUG: Checking out experiment commit 'd5dbcff520d30b5d92a863049f7259044a145a28' 2020-10-23 16:36:29,148 DEBUG: Patching local workspace 2020-10-23 16:36:29,154 DEBUG: Removing '/var/folders/s_/j8cg24s945dcvlh77c677f080000gn/T/tmpj3mfqijf' 2020-10-23 16:36:29,155 DEBUG: fetched: [(60,)] 2020-10-23 16:36:29,156 ERROR: failed to apply experiment changes. ------------------------------------------------------------ Traceback (most recent call last): File "/Users/pmrowla/git/dvc/dvc/repo/experiments/__init__.py", line 770, in checkout_exp self.repo.scm.repo.git.apply(tmp, reverse=True) File "/Users/pmrowla/.virtualenvs/dvc/lib/python3.8/site-packages/git/cmd.py", line 542, in <lambda> return lambda *args, **kwargs: self._call_process(name, *args, **kwargs) File "/Users/pmrowla/.virtualenvs/dvc/lib/python3.8/site-packages/git/cmd.py", line 1005, in _call_process return self.execute(call, **exec_kwargs) File "/Users/pmrowla/.virtualenvs/dvc/lib/python3.8/site-packages/git/cmd.py", line 822, in execute raise GitCommandError(command, status, stderr_value, stdout_value) git.exc.GitCommandError: Cmd('git') failed due to: exit code(1) cmdline: git apply --reverse /var/folders/s_/j8cg24s945dcvlh77c677f080000gn/T/tmpj3mfqijf stderr: 'error: dvc.lock: already exists in working directory' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/Users/pmrowla/git/dvc/dvc/command/experiments.py", line 456, in run self.repo.experiments.run( File "/Users/pmrowla/git/dvc/dvc/repo/experiments/__init__.py", line 881, in run return run(self.repo, *args, **kwargs) File "/Users/pmrowla/git/dvc/dvc/repo/__init__.py", line 51, in wrapper return f(repo, *args, **kwargs) File "/Users/pmrowla/git/dvc/dvc/repo/experiments/run.py", line 62, in run return repo.experiments.reproduce_one( File "/Users/pmrowla/git/dvc/dvc/repo/experiments/__init__.py", line 398, in reproduce_one self.checkout_exp(exp_rev, allow_missing=checkpoint) File "/Users/pmrowla/git/dvc/dvc/repo/experiments/__init__.py", line 38, in wrapper return f(exp, *args, **kwargs) File "/Users/pmrowla/git/dvc/dvc/repo/experiments/__init__.py", line 775, in checkout_exp raise DvcException("failed to apply experiment changes.") dvc.exceptions.DvcException: failed to apply experiment changes. ------------------------------------------------------------
git.exc.GitCommandError
def _get_branch_containing(self, rev): from git.exc import GitCommandError try: names = self.scm.repo.git.branch(contains=rev).strip().splitlines() if ( names and self.scm.repo.head.is_detached and names[0].startswith("* (HEAD detached") ): # Ignore detached head entry if it exists del names[0] if not names: return None if len(names) > 1: raise MultipleBranchError(rev) name = names[0] if name.startswith("*"): name = name[1:] return name.rsplit("/")[-1].strip() except GitCommandError: pass return None
def _get_branch_containing(self, rev): from git.exc import GitCommandError if self.scm.repo.head.is_detached: self._checkout_default_branch() try: names = self.scm.repo.git.branch(contains=rev).strip().splitlines() if not names: return None if len(names) > 1: raise MultipleBranchError(rev) name = names[0] if name.startswith("*"): name = name[1:] return name.rsplit("/")[-1].strip() except GitCommandError: pass return None
https://github.com/iterative/dvc/issues/4777
❯ dvc exp run --continue -v ... 2020-10-23 16:36:29,034 DEBUG: Commit to current experiment branch 2020-10-23 16:36:29,118 DEBUG: Checking out experiment commit 'd5dbcff520d30b5d92a863049f7259044a145a28' 2020-10-23 16:36:29,148 DEBUG: Patching local workspace 2020-10-23 16:36:29,154 DEBUG: Removing '/var/folders/s_/j8cg24s945dcvlh77c677f080000gn/T/tmpj3mfqijf' 2020-10-23 16:36:29,155 DEBUG: fetched: [(60,)] 2020-10-23 16:36:29,156 ERROR: failed to apply experiment changes. ------------------------------------------------------------ Traceback (most recent call last): File "/Users/pmrowla/git/dvc/dvc/repo/experiments/__init__.py", line 770, in checkout_exp self.repo.scm.repo.git.apply(tmp, reverse=True) File "/Users/pmrowla/.virtualenvs/dvc/lib/python3.8/site-packages/git/cmd.py", line 542, in <lambda> return lambda *args, **kwargs: self._call_process(name, *args, **kwargs) File "/Users/pmrowla/.virtualenvs/dvc/lib/python3.8/site-packages/git/cmd.py", line 1005, in _call_process return self.execute(call, **exec_kwargs) File "/Users/pmrowla/.virtualenvs/dvc/lib/python3.8/site-packages/git/cmd.py", line 822, in execute raise GitCommandError(command, status, stderr_value, stdout_value) git.exc.GitCommandError: Cmd('git') failed due to: exit code(1) cmdline: git apply --reverse /var/folders/s_/j8cg24s945dcvlh77c677f080000gn/T/tmpj3mfqijf stderr: 'error: dvc.lock: already exists in working directory' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/Users/pmrowla/git/dvc/dvc/command/experiments.py", line 456, in run self.repo.experiments.run( File "/Users/pmrowla/git/dvc/dvc/repo/experiments/__init__.py", line 881, in run return run(self.repo, *args, **kwargs) File "/Users/pmrowla/git/dvc/dvc/repo/__init__.py", line 51, in wrapper return f(repo, *args, **kwargs) File "/Users/pmrowla/git/dvc/dvc/repo/experiments/run.py", line 62, in run return repo.experiments.reproduce_one( File "/Users/pmrowla/git/dvc/dvc/repo/experiments/__init__.py", line 398, in reproduce_one self.checkout_exp(exp_rev, allow_missing=checkpoint) File "/Users/pmrowla/git/dvc/dvc/repo/experiments/__init__.py", line 38, in wrapper return f(exp, *args, **kwargs) File "/Users/pmrowla/git/dvc/dvc/repo/experiments/__init__.py", line 775, in checkout_exp raise DvcException("failed to apply experiment changes.") dvc.exceptions.DvcException: failed to apply experiment changes. ------------------------------------------------------------
git.exc.GitCommandError
def reproduce(dvc_dir, cwd=None, **kwargs): """Run dvc repro and return the result.""" from dvc.repo import Repo from dvc.repo.experiments import hash_exp unchanged = [] def filter_pipeline(stages): unchanged.extend( [stage for stage in stages if isinstance(stage, PipelineStage)] ) if cwd: old_cwd = os.getcwd() os.chdir(cwd) else: old_cwd = None cwd = os.getcwd() try: logger.debug("Running repro in '%s'", cwd) dvc = Repo(dvc_dir) # NOTE: for checkpoint experiments we handle persist outs slightly # differently than normal: # # - checkpoint out may not yet exist if this is the first time this # experiment has been run, this is not an error condition for # experiments # - at the start of a repro run, we need to remove the persist out # and restore it to its last known (committed) state (which may # be removed/does not yet exist) so that our executor workspace # is not polluted with the (persistent) out from an unrelated # experiment run checkpoint = kwargs.pop("checkpoint", False) dvc.checkout(allow_missing=checkpoint, force=checkpoint, quiet=checkpoint) stages = dvc.reproduce( on_unchanged=filter_pipeline, allow_missing=checkpoint, **kwargs, ) finally: if old_cwd is not None: os.chdir(old_cwd) # ideally we would return stages here like a normal repro() call, but # stages is not currently picklable and cannot be returned across # multiprocessing calls return hash_exp(stages + unchanged)
def reproduce(dvc_dir, cwd=None, **kwargs): """Run dvc repro and return the result.""" from dvc.repo import Repo from dvc.repo.experiments import hash_exp unchanged = [] def filter_pipeline(stages): unchanged.extend( [stage for stage in stages if isinstance(stage, PipelineStage)] ) if cwd: old_cwd = os.getcwd() os.chdir(cwd) else: old_cwd = None cwd = os.getcwd() try: logger.debug("Running repro in '%s'", cwd) dvc = Repo(dvc_dir) # NOTE: for checkpoint experiments we handle persist outs slightly # differently than normal: # # - checkpoint out may not yet exist if this is the first time this # experiment has been run, this is not an error condition for # experiments # - at the start of a repro run, we need to remove the persist out # and restore it to its last known (committed) state (which may # be removed/does not yet exist) so that our executor workspace # is not polluted with the (persistent) out from an unrelated # experiment run checkpoint = kwargs.pop("checkpoint", False) dvc.checkout(allow_missing=checkpoint, force=checkpoint) stages = dvc.reproduce( on_unchanged=filter_pipeline, allow_missing=checkpoint, **kwargs, ) finally: if old_cwd is not None: os.chdir(old_cwd) # ideally we would return stages here like a normal repro() call, but # stages is not currently picklable and cannot be returned across # multiprocessing calls return hash_exp(stages + unchanged)
https://github.com/iterative/dvc/issues/4777
❯ dvc exp run --continue -v ... 2020-10-23 16:36:29,034 DEBUG: Commit to current experiment branch 2020-10-23 16:36:29,118 DEBUG: Checking out experiment commit 'd5dbcff520d30b5d92a863049f7259044a145a28' 2020-10-23 16:36:29,148 DEBUG: Patching local workspace 2020-10-23 16:36:29,154 DEBUG: Removing '/var/folders/s_/j8cg24s945dcvlh77c677f080000gn/T/tmpj3mfqijf' 2020-10-23 16:36:29,155 DEBUG: fetched: [(60,)] 2020-10-23 16:36:29,156 ERROR: failed to apply experiment changes. ------------------------------------------------------------ Traceback (most recent call last): File "/Users/pmrowla/git/dvc/dvc/repo/experiments/__init__.py", line 770, in checkout_exp self.repo.scm.repo.git.apply(tmp, reverse=True) File "/Users/pmrowla/.virtualenvs/dvc/lib/python3.8/site-packages/git/cmd.py", line 542, in <lambda> return lambda *args, **kwargs: self._call_process(name, *args, **kwargs) File "/Users/pmrowla/.virtualenvs/dvc/lib/python3.8/site-packages/git/cmd.py", line 1005, in _call_process return self.execute(call, **exec_kwargs) File "/Users/pmrowla/.virtualenvs/dvc/lib/python3.8/site-packages/git/cmd.py", line 822, in execute raise GitCommandError(command, status, stderr_value, stdout_value) git.exc.GitCommandError: Cmd('git') failed due to: exit code(1) cmdline: git apply --reverse /var/folders/s_/j8cg24s945dcvlh77c677f080000gn/T/tmpj3mfqijf stderr: 'error: dvc.lock: already exists in working directory' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/Users/pmrowla/git/dvc/dvc/command/experiments.py", line 456, in run self.repo.experiments.run( File "/Users/pmrowla/git/dvc/dvc/repo/experiments/__init__.py", line 881, in run return run(self.repo, *args, **kwargs) File "/Users/pmrowla/git/dvc/dvc/repo/__init__.py", line 51, in wrapper return f(repo, *args, **kwargs) File "/Users/pmrowla/git/dvc/dvc/repo/experiments/run.py", line 62, in run return repo.experiments.reproduce_one( File "/Users/pmrowla/git/dvc/dvc/repo/experiments/__init__.py", line 398, in reproduce_one self.checkout_exp(exp_rev, allow_missing=checkpoint) File "/Users/pmrowla/git/dvc/dvc/repo/experiments/__init__.py", line 38, in wrapper return f(exp, *args, **kwargs) File "/Users/pmrowla/git/dvc/dvc/repo/experiments/__init__.py", line 775, in checkout_exp raise DvcException("failed to apply experiment changes.") dvc.exceptions.DvcException: failed to apply experiment changes. ------------------------------------------------------------
git.exc.GitCommandError
def _filter_missing(repo, paths): repo_tree = RepoTree(repo, stream=True) for path in paths: metadata = repo_tree.metadata(path) if metadata.is_dvc: out = metadata.outs[0] if out.status().get(str(out)) == "not in cache": yield path
def _filter_missing(repo, paths): repo_tree = RepoTree(repo, stream=True) for path in paths: metadata = repo_tree.metadata(path) if metadata.is_dvc: out = metadata.outs[0] if out.status()[str(out)] == "not in cache": yield path
https://github.com/iterative/dvc/issues/4825
Traceback (most recent call last): File "/home/ubuntu/.local/share/virtualenvs/speech-api-EI_ft4iY/lib/python3.7/site-packages/dvc/main.py", line 76, in main ret = cmd.run() File "/home/ubuntu/.local/share/virtualenvs/speech-api-EI_ft4iY/lib/python3.7/site-packages/dvc/command/diff.py", line 130, in run diff = self.repo.diff(self.args.a_rev, self.args.b_rev) File "/home/ubuntu/.local/share/virtualenvs/speech-api-EI_ft4iY/lib/python3.7/site-packages/dvc/repo/__init__.py", line 54, in wrapper return f(repo, *args, **kwargs) File "/home/ubuntu/.local/share/virtualenvs/speech-api-EI_ft4iY/lib/python3.7/site-packages/dvc/repo/diff.py", line 43, in diff missing = sorted(_filter_missing(self, deleted_or_missing)) File "/home/ubuntu/.local/share/virtualenvs/speech-api-EI_ft4iY/lib/python3.7/site-packages/dvc/repo/diff.py", line 125, in _filter_missing if out.status()[str(out)] == "not in cache": KeyError: 'data/KPI/KPI_from_dvc/en/post_probs'
KeyError
def _update_params(self, params: dict): """Update experiment params files with the specified values.""" from dvc.utils.serialize import MODIFIERS logger.debug("Using experiment params '%s'", params) # recursive dict update def _update(dict_, other): for key, value in other.items(): if isinstance(dict_, list) and key.isdigit(): key = int(key) if isinstance(value, Mapping): if isinstance(dict_, list): fallback_value = dict_[key] else: fallback_value = dict_.get(key, {}) dict_[key] = _update(fallback_value, value) else: dict_[key] = value return dict_ for params_fname in params: path = PathInfo(self.exp_dvc.root_dir) / params_fname suffix = path.suffix.lower() modify_data = MODIFIERS[suffix] with modify_data(path, tree=self.exp_dvc.tree) as data: _update(data, params[params_fname]) # Force params file changes to be staged in git # Otherwise in certain situations the changes to params file may be # ignored when we `git stash` them since mtime is used to determine # whether the file is dirty self.scm.add(list(params.keys()))
def _update_params(self, params: dict): """Update experiment params files with the specified values.""" from dvc.utils.serialize import MODIFIERS logger.debug("Using experiment params '%s'", params) # recursive dict update def _update(dict_, other): for key, value in other.items(): if isinstance(value, Mapping): dict_[key] = _update(dict_.get(key, {}), value) else: dict_[key] = value return dict_ for params_fname in params: path = PathInfo(self.exp_dvc.root_dir) / params_fname suffix = path.suffix.lower() modify_data = MODIFIERS[suffix] with modify_data(path, tree=self.exp_dvc.tree) as data: _update(data, params[params_fname]) # Force params file changes to be staged in git # Otherwise in certain situations the changes to params file may be # ignored when we `git stash` them since mtime is used to determine # whether the file is dirty self.scm.add(list(params.keys()))
https://github.com/iterative/dvc/issues/4768
2020-10-21 16:59:00,192 ERROR: unexpected error - 'CommentedSeq' object has no attribute 'get' ------------------------------------------------------------ Traceback (most recent call last): File "/usr/local/lib/python3.8/dist-packages/dvc/main.py", line 76, in main ret = cmd.run() File "/usr/local/lib/python3.8/dist-packages/dvc/command/experiments.py", line 419, in run self.repo.experiments.run( File "/usr/local/lib/python3.8/dist-packages/dvc/repo/experiments/__init__.py", line 801, in run return run(self.repo, *args, **kwargs) File "/usr/local/lib/python3.8/dist-packages/dvc/repo/__init__.py", line 51, in wrapper return f(repo, *args, **kwargs) File "/usr/local/lib/python3.8/dist-packages/dvc/repo/experiments/run.py", line 62, in run return repo.experiments.reproduce_one( File "/usr/local/lib/python3.8/dist-packages/dvc/repo/experiments/__init__.py", line 345, in reproduce_one stash_rev = self.new(**kwargs) File "/usr/local/lib/python3.8/dist-packages/dvc/repo/experiments/__init__.py", line 38, in wrapper return f(exp, *args, **kwargs) File "/usr/local/lib/python3.8/dist-packages/dvc/repo/experiments/__init__.py", line 407, in new stash_rev = self._stash_exp( File "/usr/local/lib/python3.8/dist-packages/dvc/repo/experiments/__init__.py", line 265, in _stash_exp self._update_params(params) File "/usr/local/lib/python3.8/dist-packages/dvc/repo/experiments/__init__.py", line 309, in _update_params _update(data, params[params_fname]) File "/usr/local/lib/python3.8/dist-packages/dvc/repo/experiments/__init__.py", line 299, in _update dict_[key] = _update(dict_.get(key, {}), value) File "/usr/local/lib/python3.8/dist-packages/dvc/repo/experiments/__init__.py", line 299, in _update dict_[key] = _update(dict_.get(key, {}), value) File "/usr/local/lib/python3.8/dist-packages/dvc/repo/experiments/__init__.py", line 299, in _update dict_[key] = _update(dict_.get(key, {}), value) [Previous line repeated 1 more time] AttributeError: 'CommentedSeq' object has no attribute 'get' ------------------------------------------------------------ 2020-10-21 16:59:00,284 DEBUG: Version info for developers: DVC version: 1.8.4 (pip) --------------------------------- Platform: Python 3.8.0 on Linux-5.4.0-51-generic-x86_64-with-glibc2.27 Supports: http, https, s3 Cache types: hardlink, symlink Repo: dvc, git
AttributeError
def _update(dict_, other): for key, value in other.items(): if isinstance(dict_, list) and key.isdigit(): key = int(key) if isinstance(value, Mapping): if isinstance(dict_, list): fallback_value = dict_[key] else: fallback_value = dict_.get(key, {}) dict_[key] = _update(fallback_value, value) else: dict_[key] = value return dict_
def _update(dict_, other): for key, value in other.items(): if isinstance(value, Mapping): dict_[key] = _update(dict_.get(key, {}), value) else: dict_[key] = value return dict_
https://github.com/iterative/dvc/issues/4768
2020-10-21 16:59:00,192 ERROR: unexpected error - 'CommentedSeq' object has no attribute 'get' ------------------------------------------------------------ Traceback (most recent call last): File "/usr/local/lib/python3.8/dist-packages/dvc/main.py", line 76, in main ret = cmd.run() File "/usr/local/lib/python3.8/dist-packages/dvc/command/experiments.py", line 419, in run self.repo.experiments.run( File "/usr/local/lib/python3.8/dist-packages/dvc/repo/experiments/__init__.py", line 801, in run return run(self.repo, *args, **kwargs) File "/usr/local/lib/python3.8/dist-packages/dvc/repo/__init__.py", line 51, in wrapper return f(repo, *args, **kwargs) File "/usr/local/lib/python3.8/dist-packages/dvc/repo/experiments/run.py", line 62, in run return repo.experiments.reproduce_one( File "/usr/local/lib/python3.8/dist-packages/dvc/repo/experiments/__init__.py", line 345, in reproduce_one stash_rev = self.new(**kwargs) File "/usr/local/lib/python3.8/dist-packages/dvc/repo/experiments/__init__.py", line 38, in wrapper return f(exp, *args, **kwargs) File "/usr/local/lib/python3.8/dist-packages/dvc/repo/experiments/__init__.py", line 407, in new stash_rev = self._stash_exp( File "/usr/local/lib/python3.8/dist-packages/dvc/repo/experiments/__init__.py", line 265, in _stash_exp self._update_params(params) File "/usr/local/lib/python3.8/dist-packages/dvc/repo/experiments/__init__.py", line 309, in _update_params _update(data, params[params_fname]) File "/usr/local/lib/python3.8/dist-packages/dvc/repo/experiments/__init__.py", line 299, in _update dict_[key] = _update(dict_.get(key, {}), value) File "/usr/local/lib/python3.8/dist-packages/dvc/repo/experiments/__init__.py", line 299, in _update dict_[key] = _update(dict_.get(key, {}), value) File "/usr/local/lib/python3.8/dist-packages/dvc/repo/experiments/__init__.py", line 299, in _update dict_[key] = _update(dict_.get(key, {}), value) [Previous line repeated 1 more time] AttributeError: 'CommentedSeq' object has no attribute 'get' ------------------------------------------------------------ 2020-10-21 16:59:00,284 DEBUG: Version info for developers: DVC version: 1.8.4 (pip) --------------------------------- Platform: Python 3.8.0 on Linux-5.4.0-51-generic-x86_64-with-glibc2.27 Supports: http, https, s3 Cache types: hardlink, symlink Repo: dvc, git
AttributeError
def md5(self, path): """ Use different md5 commands depending on the OS: - Darwin's `md5` returns BSD-style checksums by default - Linux's `md5sum` needs the `--tag` flag for a similar output Example: MD5 (foo.txt) = f3d220a856b52aabbf294351e8a24300 """ path = shlex.quote(path) if self.uname == "Linux": md5 = self.execute("md5sum " + path).split()[0] elif self.uname == "Darwin": md5 = self.execute("md5 " + path).split()[-1] else: raise DvcException(f"'{self.uname}' is not supported as a SSH remote") assert len(md5) == 32 return md5
def md5(self, path): """ Use different md5 commands depending on the OS: - Darwin's `md5` returns BSD-style checksums by default - Linux's `md5sum` needs the `--tag` flag for a similar output Example: MD5 (foo.txt) = f3d220a856b52aabbf294351e8a24300 """ if self.uname == "Linux": md5 = self.execute("md5sum " + path).split()[0] elif self.uname == "Darwin": md5 = self.execute("md5 " + path).split()[-1] else: raise DvcException(f"'{self.uname}' is not supported as a SSH remote") assert len(md5) == 32 return md5
https://github.com/iterative/dvc/issues/4628
2020-09-28 15:53:35,511 ERROR: failed to import ssh://user@1.2.3.4/home/data/cana/ds30. You could also try downloading it manually, and adding it with `dvc add`. - ssh command 'md5sum /home/data/cana/ds30/cana-mucuna/class35_e2545053-f2c5-4108-9042-67244a94e267_p_['cana']_o_['cana', 'mucuna'].jpg' finished with non-zero return code 1': md5sum: '/home/data/cana/ds30/cana-mucuna/class35_e2545053-f2c5-4108-9042-67244a94e267_p_[cana]_o_[cana,': No such file or directory md5sum: mucuna].jpg: No such file or directory ------------------------------------------------------------ Traceback (most recent call last): File "/home/gabriel/anaconda3/lib/python3.8/site-packages/dvc/command/imp_url.py", line 14, in run self.repo.imp_url( File "/home/gabriel/anaconda3/lib/python3.8/site-packages/dvc/repo/__init__.py", line 51, in wrapper return f(repo, *args, **kwargs) File "/home/gabriel/anaconda3/lib/python3.8/site-packages/dvc/repo/scm_context.py", line 4, in run result = method(repo, *args, **kw) File "/home/gabriel/anaconda3/lib/python3.8/site-packages/dvc/repo/imp_url.py", line 54, in imp_url stage.run() File "/home/gabriel/anaconda3/lib/python3.8/site-packages/funcy/decorators.py", line 39, in wrapper return deco(call, *dargs, **dkwargs) File "/home/gabriel/anaconda3/lib/python3.8/site-packages/dvc/stage/decorators.py", line 36, in rwlocked return call() File "/home/gabriel/anaconda3/lib/python3.8/site-packages/funcy/decorators.py", line 60, in __call__ return self._func(*self._args, **self._kwargs) File "/home/gabriel/anaconda3/lib/python3.8/site-packages/dvc/stage/__init__.py", line 429, in run sync_import(self, dry, force) File "/home/gabriel/anaconda3/lib/python3.8/site-packages/dvc/stage/imports.py", line 29, in sync_import stage.save_deps() File "/home/gabriel/anaconda3/lib/python3.8/site-packages/dvc/stage/__init__.py", line 392, in save_deps dep.save() File "/home/gabriel/anaconda3/lib/python3.8/site-packages/dvc/output/base.py", line 268, in save self.hash_info = self.get_hash() File "/home/gabriel/anaconda3/lib/python3.8/site-packages/dvc/output/base.py", line 178, in get_hash return self.tree.get_hash(self.path_info) File "/home/gabriel/anaconda3/lib/python3.8/site-packages/dvc/tree/base.py", line 263, in get_hash hash_info = self.get_dir_hash(path_info, **kwargs) File "/home/gabriel/anaconda3/lib/python3.8/site-packages/dvc/tree/base.py", line 330, in get_dir_hash dir_info = self._collect_dir(path_info, **kwargs) File "/home/gabriel/anaconda3/lib/python3.8/site-packages/dvc/tree/base.py", line 310, in _collect_dir new_hashes = self._calculate_hashes(not_in_state) File "/home/gabriel/anaconda3/lib/python3.8/site-packages/dvc/tree/base.py", line 296, in _calculate_hashes return dict(zip(file_infos, hashes)) File "/home/gabriel/anaconda3/lib/python3.8/site-packages/dvc/tree/base.py", line 295, in <genexpr> hashes = (hi.value for hi in executor.map(worker, file_infos)) File "/home/gabriel/anaconda3/lib/python3.8/concurrent/futures/_base.py", line 611, in result_iterator yield fs.pop().result() File "/home/gabriel/anaconda3/lib/python3.8/concurrent/futures/_base.py", line 439, in result return self.__get_result() File "/home/gabriel/anaconda3/lib/python3.8/concurrent/futures/_base.py", line 388, in __get_result raise self._exception File "/home/gabriel/anaconda3/lib/python3.8/concurrent/futures/thread.py", line 57, in run result = self.fn(*self.args, **self.kwargs) File "/home/gabriel/anaconda3/lib/python3.8/site-packages/dvc/progress.py", line 126, in wrapped res = fn(*args, **kwargs) File "/home/gabriel/anaconda3/lib/python3.8/site-packages/dvc/tree/ssh/__init__.py", line 242, in get_file_hash return HashInfo(self.PARAM_CHECKSUM, ssh.md5(path_info.path)) File "/home/gabriel/anaconda3/lib/python3.8/site-packages/dvc/tree/ssh/connection.py", line 295, in md5 md5 = self.execute("md5sum " + path).split()[0] File "/home/gabriel/anaconda3/lib/python3.8/site-packages/dvc/tree/ssh/connection.py", line 276, in execute raise RemoteCmdError("ssh", cmd, ret, err) dvc.tree.base.RemoteCmdError: ssh command 'md5sum /home/data/cana/ds30/cana-mucuna/class35_e2545053-f2c5-4108-9042-67244a94e267_p_['cana']_o_['cana', 'mucuna'].jpg' finished with non-zero return code 1': md5sum: '/home/data/cana/ds30/cana-mucuna/class35_e2545053-f2c5-4108-9042-67244a94e267_p_[cana]_o_[cana,': No such file or directory md5sum: mucuna].jpg: No such file or directory ------------------------------------------------------------ 2020-09-28 15:53:35,520 DEBUG: Analytics is enabled. 2020-09-28 15:53:35,605 DEBUG: Trying to spawn '['daemon', '-q', 'analytics', '/tmp/tmp4x4p60hi']' 2020-09-28 15:53:35,608 DEBUG: Spawned '['daemon', '-q', 'analytics', '/tmp/tmp4x4p60hi']'
dvc.tree.base.RemoteCmdError
def copy(self, src, dest): dest = shlex.quote(dest) src = shlex.quote(src) self.execute(f"cp {src} {dest}")
def copy(self, src, dest): self.execute(f"cp {src} {dest}")
https://github.com/iterative/dvc/issues/4628
2020-09-28 15:53:35,511 ERROR: failed to import ssh://user@1.2.3.4/home/data/cana/ds30. You could also try downloading it manually, and adding it with `dvc add`. - ssh command 'md5sum /home/data/cana/ds30/cana-mucuna/class35_e2545053-f2c5-4108-9042-67244a94e267_p_['cana']_o_['cana', 'mucuna'].jpg' finished with non-zero return code 1': md5sum: '/home/data/cana/ds30/cana-mucuna/class35_e2545053-f2c5-4108-9042-67244a94e267_p_[cana]_o_[cana,': No such file or directory md5sum: mucuna].jpg: No such file or directory ------------------------------------------------------------ Traceback (most recent call last): File "/home/gabriel/anaconda3/lib/python3.8/site-packages/dvc/command/imp_url.py", line 14, in run self.repo.imp_url( File "/home/gabriel/anaconda3/lib/python3.8/site-packages/dvc/repo/__init__.py", line 51, in wrapper return f(repo, *args, **kwargs) File "/home/gabriel/anaconda3/lib/python3.8/site-packages/dvc/repo/scm_context.py", line 4, in run result = method(repo, *args, **kw) File "/home/gabriel/anaconda3/lib/python3.8/site-packages/dvc/repo/imp_url.py", line 54, in imp_url stage.run() File "/home/gabriel/anaconda3/lib/python3.8/site-packages/funcy/decorators.py", line 39, in wrapper return deco(call, *dargs, **dkwargs) File "/home/gabriel/anaconda3/lib/python3.8/site-packages/dvc/stage/decorators.py", line 36, in rwlocked return call() File "/home/gabriel/anaconda3/lib/python3.8/site-packages/funcy/decorators.py", line 60, in __call__ return self._func(*self._args, **self._kwargs) File "/home/gabriel/anaconda3/lib/python3.8/site-packages/dvc/stage/__init__.py", line 429, in run sync_import(self, dry, force) File "/home/gabriel/anaconda3/lib/python3.8/site-packages/dvc/stage/imports.py", line 29, in sync_import stage.save_deps() File "/home/gabriel/anaconda3/lib/python3.8/site-packages/dvc/stage/__init__.py", line 392, in save_deps dep.save() File "/home/gabriel/anaconda3/lib/python3.8/site-packages/dvc/output/base.py", line 268, in save self.hash_info = self.get_hash() File "/home/gabriel/anaconda3/lib/python3.8/site-packages/dvc/output/base.py", line 178, in get_hash return self.tree.get_hash(self.path_info) File "/home/gabriel/anaconda3/lib/python3.8/site-packages/dvc/tree/base.py", line 263, in get_hash hash_info = self.get_dir_hash(path_info, **kwargs) File "/home/gabriel/anaconda3/lib/python3.8/site-packages/dvc/tree/base.py", line 330, in get_dir_hash dir_info = self._collect_dir(path_info, **kwargs) File "/home/gabriel/anaconda3/lib/python3.8/site-packages/dvc/tree/base.py", line 310, in _collect_dir new_hashes = self._calculate_hashes(not_in_state) File "/home/gabriel/anaconda3/lib/python3.8/site-packages/dvc/tree/base.py", line 296, in _calculate_hashes return dict(zip(file_infos, hashes)) File "/home/gabriel/anaconda3/lib/python3.8/site-packages/dvc/tree/base.py", line 295, in <genexpr> hashes = (hi.value for hi in executor.map(worker, file_infos)) File "/home/gabriel/anaconda3/lib/python3.8/concurrent/futures/_base.py", line 611, in result_iterator yield fs.pop().result() File "/home/gabriel/anaconda3/lib/python3.8/concurrent/futures/_base.py", line 439, in result return self.__get_result() File "/home/gabriel/anaconda3/lib/python3.8/concurrent/futures/_base.py", line 388, in __get_result raise self._exception File "/home/gabriel/anaconda3/lib/python3.8/concurrent/futures/thread.py", line 57, in run result = self.fn(*self.args, **self.kwargs) File "/home/gabriel/anaconda3/lib/python3.8/site-packages/dvc/progress.py", line 126, in wrapped res = fn(*args, **kwargs) File "/home/gabriel/anaconda3/lib/python3.8/site-packages/dvc/tree/ssh/__init__.py", line 242, in get_file_hash return HashInfo(self.PARAM_CHECKSUM, ssh.md5(path_info.path)) File "/home/gabriel/anaconda3/lib/python3.8/site-packages/dvc/tree/ssh/connection.py", line 295, in md5 md5 = self.execute("md5sum " + path).split()[0] File "/home/gabriel/anaconda3/lib/python3.8/site-packages/dvc/tree/ssh/connection.py", line 276, in execute raise RemoteCmdError("ssh", cmd, ret, err) dvc.tree.base.RemoteCmdError: ssh command 'md5sum /home/data/cana/ds30/cana-mucuna/class35_e2545053-f2c5-4108-9042-67244a94e267_p_['cana']_o_['cana', 'mucuna'].jpg' finished with non-zero return code 1': md5sum: '/home/data/cana/ds30/cana-mucuna/class35_e2545053-f2c5-4108-9042-67244a94e267_p_[cana]_o_[cana,': No such file or directory md5sum: mucuna].jpg: No such file or directory ------------------------------------------------------------ 2020-09-28 15:53:35,520 DEBUG: Analytics is enabled. 2020-09-28 15:53:35,605 DEBUG: Trying to spawn '['daemon', '-q', 'analytics', '/tmp/tmp4x4p60hi']' 2020-09-28 15:53:35,608 DEBUG: Spawned '['daemon', '-q', 'analytics', '/tmp/tmp4x4p60hi']'
dvc.tree.base.RemoteCmdError
def reflink(self, src, dest): dest = shlex.quote(dest) src = shlex.quote(src) if self.uname == "Linux": return self.execute(f"cp --reflink {src} {dest}") if self.uname == "Darwin": return self.execute(f"cp -c {src} {dest}") raise DvcException(f"'{self.uname}' is not supported as a SSH remote")
def reflink(self, src, dest): if self.uname == "Linux": return self.execute(f"cp --reflink {src} {dest}") if self.uname == "Darwin": return self.execute(f"cp -c {src} {dest}") raise DvcException(f"'{self.uname}' is not supported as a SSH remote")
https://github.com/iterative/dvc/issues/4628
2020-09-28 15:53:35,511 ERROR: failed to import ssh://user@1.2.3.4/home/data/cana/ds30. You could also try downloading it manually, and adding it with `dvc add`. - ssh command 'md5sum /home/data/cana/ds30/cana-mucuna/class35_e2545053-f2c5-4108-9042-67244a94e267_p_['cana']_o_['cana', 'mucuna'].jpg' finished with non-zero return code 1': md5sum: '/home/data/cana/ds30/cana-mucuna/class35_e2545053-f2c5-4108-9042-67244a94e267_p_[cana]_o_[cana,': No such file or directory md5sum: mucuna].jpg: No such file or directory ------------------------------------------------------------ Traceback (most recent call last): File "/home/gabriel/anaconda3/lib/python3.8/site-packages/dvc/command/imp_url.py", line 14, in run self.repo.imp_url( File "/home/gabriel/anaconda3/lib/python3.8/site-packages/dvc/repo/__init__.py", line 51, in wrapper return f(repo, *args, **kwargs) File "/home/gabriel/anaconda3/lib/python3.8/site-packages/dvc/repo/scm_context.py", line 4, in run result = method(repo, *args, **kw) File "/home/gabriel/anaconda3/lib/python3.8/site-packages/dvc/repo/imp_url.py", line 54, in imp_url stage.run() File "/home/gabriel/anaconda3/lib/python3.8/site-packages/funcy/decorators.py", line 39, in wrapper return deco(call, *dargs, **dkwargs) File "/home/gabriel/anaconda3/lib/python3.8/site-packages/dvc/stage/decorators.py", line 36, in rwlocked return call() File "/home/gabriel/anaconda3/lib/python3.8/site-packages/funcy/decorators.py", line 60, in __call__ return self._func(*self._args, **self._kwargs) File "/home/gabriel/anaconda3/lib/python3.8/site-packages/dvc/stage/__init__.py", line 429, in run sync_import(self, dry, force) File "/home/gabriel/anaconda3/lib/python3.8/site-packages/dvc/stage/imports.py", line 29, in sync_import stage.save_deps() File "/home/gabriel/anaconda3/lib/python3.8/site-packages/dvc/stage/__init__.py", line 392, in save_deps dep.save() File "/home/gabriel/anaconda3/lib/python3.8/site-packages/dvc/output/base.py", line 268, in save self.hash_info = self.get_hash() File "/home/gabriel/anaconda3/lib/python3.8/site-packages/dvc/output/base.py", line 178, in get_hash return self.tree.get_hash(self.path_info) File "/home/gabriel/anaconda3/lib/python3.8/site-packages/dvc/tree/base.py", line 263, in get_hash hash_info = self.get_dir_hash(path_info, **kwargs) File "/home/gabriel/anaconda3/lib/python3.8/site-packages/dvc/tree/base.py", line 330, in get_dir_hash dir_info = self._collect_dir(path_info, **kwargs) File "/home/gabriel/anaconda3/lib/python3.8/site-packages/dvc/tree/base.py", line 310, in _collect_dir new_hashes = self._calculate_hashes(not_in_state) File "/home/gabriel/anaconda3/lib/python3.8/site-packages/dvc/tree/base.py", line 296, in _calculate_hashes return dict(zip(file_infos, hashes)) File "/home/gabriel/anaconda3/lib/python3.8/site-packages/dvc/tree/base.py", line 295, in <genexpr> hashes = (hi.value for hi in executor.map(worker, file_infos)) File "/home/gabriel/anaconda3/lib/python3.8/concurrent/futures/_base.py", line 611, in result_iterator yield fs.pop().result() File "/home/gabriel/anaconda3/lib/python3.8/concurrent/futures/_base.py", line 439, in result return self.__get_result() File "/home/gabriel/anaconda3/lib/python3.8/concurrent/futures/_base.py", line 388, in __get_result raise self._exception File "/home/gabriel/anaconda3/lib/python3.8/concurrent/futures/thread.py", line 57, in run result = self.fn(*self.args, **self.kwargs) File "/home/gabriel/anaconda3/lib/python3.8/site-packages/dvc/progress.py", line 126, in wrapped res = fn(*args, **kwargs) File "/home/gabriel/anaconda3/lib/python3.8/site-packages/dvc/tree/ssh/__init__.py", line 242, in get_file_hash return HashInfo(self.PARAM_CHECKSUM, ssh.md5(path_info.path)) File "/home/gabriel/anaconda3/lib/python3.8/site-packages/dvc/tree/ssh/connection.py", line 295, in md5 md5 = self.execute("md5sum " + path).split()[0] File "/home/gabriel/anaconda3/lib/python3.8/site-packages/dvc/tree/ssh/connection.py", line 276, in execute raise RemoteCmdError("ssh", cmd, ret, err) dvc.tree.base.RemoteCmdError: ssh command 'md5sum /home/data/cana/ds30/cana-mucuna/class35_e2545053-f2c5-4108-9042-67244a94e267_p_['cana']_o_['cana', 'mucuna'].jpg' finished with non-zero return code 1': md5sum: '/home/data/cana/ds30/cana-mucuna/class35_e2545053-f2c5-4108-9042-67244a94e267_p_[cana]_o_[cana,': No such file or directory md5sum: mucuna].jpg: No such file or directory ------------------------------------------------------------ 2020-09-28 15:53:35,520 DEBUG: Analytics is enabled. 2020-09-28 15:53:35,605 DEBUG: Trying to spawn '['daemon', '-q', 'analytics', '/tmp/tmp4x4p60hi']' 2020-09-28 15:53:35,608 DEBUG: Spawned '['daemon', '-q', 'analytics', '/tmp/tmp4x4p60hi']'
dvc.tree.base.RemoteCmdError
def hardlink(self, src, dest): dest = shlex.quote(dest) src = shlex.quote(src) self.execute(f"ln {src} {dest}")
def hardlink(self, src, dest): self.execute(f"ln {src} {dest}")
https://github.com/iterative/dvc/issues/4628
2020-09-28 15:53:35,511 ERROR: failed to import ssh://user@1.2.3.4/home/data/cana/ds30. You could also try downloading it manually, and adding it with `dvc add`. - ssh command 'md5sum /home/data/cana/ds30/cana-mucuna/class35_e2545053-f2c5-4108-9042-67244a94e267_p_['cana']_o_['cana', 'mucuna'].jpg' finished with non-zero return code 1': md5sum: '/home/data/cana/ds30/cana-mucuna/class35_e2545053-f2c5-4108-9042-67244a94e267_p_[cana]_o_[cana,': No such file or directory md5sum: mucuna].jpg: No such file or directory ------------------------------------------------------------ Traceback (most recent call last): File "/home/gabriel/anaconda3/lib/python3.8/site-packages/dvc/command/imp_url.py", line 14, in run self.repo.imp_url( File "/home/gabriel/anaconda3/lib/python3.8/site-packages/dvc/repo/__init__.py", line 51, in wrapper return f(repo, *args, **kwargs) File "/home/gabriel/anaconda3/lib/python3.8/site-packages/dvc/repo/scm_context.py", line 4, in run result = method(repo, *args, **kw) File "/home/gabriel/anaconda3/lib/python3.8/site-packages/dvc/repo/imp_url.py", line 54, in imp_url stage.run() File "/home/gabriel/anaconda3/lib/python3.8/site-packages/funcy/decorators.py", line 39, in wrapper return deco(call, *dargs, **dkwargs) File "/home/gabriel/anaconda3/lib/python3.8/site-packages/dvc/stage/decorators.py", line 36, in rwlocked return call() File "/home/gabriel/anaconda3/lib/python3.8/site-packages/funcy/decorators.py", line 60, in __call__ return self._func(*self._args, **self._kwargs) File "/home/gabriel/anaconda3/lib/python3.8/site-packages/dvc/stage/__init__.py", line 429, in run sync_import(self, dry, force) File "/home/gabriel/anaconda3/lib/python3.8/site-packages/dvc/stage/imports.py", line 29, in sync_import stage.save_deps() File "/home/gabriel/anaconda3/lib/python3.8/site-packages/dvc/stage/__init__.py", line 392, in save_deps dep.save() File "/home/gabriel/anaconda3/lib/python3.8/site-packages/dvc/output/base.py", line 268, in save self.hash_info = self.get_hash() File "/home/gabriel/anaconda3/lib/python3.8/site-packages/dvc/output/base.py", line 178, in get_hash return self.tree.get_hash(self.path_info) File "/home/gabriel/anaconda3/lib/python3.8/site-packages/dvc/tree/base.py", line 263, in get_hash hash_info = self.get_dir_hash(path_info, **kwargs) File "/home/gabriel/anaconda3/lib/python3.8/site-packages/dvc/tree/base.py", line 330, in get_dir_hash dir_info = self._collect_dir(path_info, **kwargs) File "/home/gabriel/anaconda3/lib/python3.8/site-packages/dvc/tree/base.py", line 310, in _collect_dir new_hashes = self._calculate_hashes(not_in_state) File "/home/gabriel/anaconda3/lib/python3.8/site-packages/dvc/tree/base.py", line 296, in _calculate_hashes return dict(zip(file_infos, hashes)) File "/home/gabriel/anaconda3/lib/python3.8/site-packages/dvc/tree/base.py", line 295, in <genexpr> hashes = (hi.value for hi in executor.map(worker, file_infos)) File "/home/gabriel/anaconda3/lib/python3.8/concurrent/futures/_base.py", line 611, in result_iterator yield fs.pop().result() File "/home/gabriel/anaconda3/lib/python3.8/concurrent/futures/_base.py", line 439, in result return self.__get_result() File "/home/gabriel/anaconda3/lib/python3.8/concurrent/futures/_base.py", line 388, in __get_result raise self._exception File "/home/gabriel/anaconda3/lib/python3.8/concurrent/futures/thread.py", line 57, in run result = self.fn(*self.args, **self.kwargs) File "/home/gabriel/anaconda3/lib/python3.8/site-packages/dvc/progress.py", line 126, in wrapped res = fn(*args, **kwargs) File "/home/gabriel/anaconda3/lib/python3.8/site-packages/dvc/tree/ssh/__init__.py", line 242, in get_file_hash return HashInfo(self.PARAM_CHECKSUM, ssh.md5(path_info.path)) File "/home/gabriel/anaconda3/lib/python3.8/site-packages/dvc/tree/ssh/connection.py", line 295, in md5 md5 = self.execute("md5sum " + path).split()[0] File "/home/gabriel/anaconda3/lib/python3.8/site-packages/dvc/tree/ssh/connection.py", line 276, in execute raise RemoteCmdError("ssh", cmd, ret, err) dvc.tree.base.RemoteCmdError: ssh command 'md5sum /home/data/cana/ds30/cana-mucuna/class35_e2545053-f2c5-4108-9042-67244a94e267_p_['cana']_o_['cana', 'mucuna'].jpg' finished with non-zero return code 1': md5sum: '/home/data/cana/ds30/cana-mucuna/class35_e2545053-f2c5-4108-9042-67244a94e267_p_[cana]_o_[cana,': No such file or directory md5sum: mucuna].jpg: No such file or directory ------------------------------------------------------------ 2020-09-28 15:53:35,520 DEBUG: Analytics is enabled. 2020-09-28 15:53:35,605 DEBUG: Trying to spawn '['daemon', '-q', 'analytics', '/tmp/tmp4x4p60hi']' 2020-09-28 15:53:35,608 DEBUG: Spawned '['daemon', '-q', 'analytics', '/tmp/tmp4x4p60hi']'
dvc.tree.base.RemoteCmdError
def run(self): indent = 1 if self.args.cloud else 0 try: st = self.repo.status( targets=self.args.targets, jobs=self.args.jobs, cloud=self.args.cloud, remote=self.args.remote, all_branches=self.args.all_branches, all_tags=self.args.all_tags, all_commits=self.args.all_commits, with_deps=self.args.with_deps, recursive=self.args.recursive, ) if self.args.quiet: return bool(st) if self.args.show_json: import json logger.info(json.dumps(st)) elif st: self._show(st, indent) elif not self.repo.stages: logger.info(self.EMPTY_PROJECT_MSG) else: logger.info(self.UP_TO_DATE_MSG) except DvcException: logger.exception("") return 1 return 0
def run(self): indent = 1 if self.args.cloud else 0 try: st = self.repo.status( targets=self.args.targets, jobs=self.args.jobs, cloud=self.args.cloud, remote=self.args.remote, all_branches=self.args.all_branches, all_tags=self.args.all_tags, all_commits=self.args.all_commits, with_deps=self.args.with_deps, recursive=self.args.recursive, ) if self.args.quiet: return bool(st) if self.args.show_json: import json logger.info(json.dumps(st)) elif st: self._show(st, indent) elif not self.repo.stages: logger.info(self.EMPTY_PROJECT_MSG) else: logger.info(self.UP_TO_DATE_MSG) except DvcException: logger.exception("failed to obtain data status") return 1 return 0
https://github.com/iterative/dvc/issues/4664
$ dvc metrics diff -v 2020-10-05 09:00:38,005 DEBUG: Check for update is enabled. 2020-10-05 09:00:38,039 DEBUG: fetched: [(3,)] 2020-10-05 09:00:38,048 DEBUG: fetched: [(682,)] 2020-10-05 09:00:38,049 ERROR: unexpected error - while constructing a mapping in "<unicode string>", line 3, column 5 found duplicate key "metrics" with value "[]" (original value: "[]") in "<unicode string>", line 20, column 5 To suppress this check see: http://yaml.readthedocs.io/en/latest/api.html#duplicate-keys Duplicate keys will become an error in future releases, and are errors by default when using the new API. ------------------------------------------------------------ Traceback (most recent call last): File "/Users/dmitry/src/dvc/dvc/main.py", line 76, in main ret = cmd.run() File "/Users/dmitry/src/dvc/dvc/command/metrics.py", line 119, in run all=self.args.all, File "/Users/dmitry/src/dvc/dvc/repo/metrics/__init__.py", line 13, in diff return diff(self.repo, *args, **kwargs) File "/Users/dmitry/src/dvc/dvc/repo/metrics/diff.py", line 22, in diff old = _get_metrics(repo, *args, **kwargs, rev=(a_rev or "HEAD")) File "/Users/dmitry/src/dvc/dvc/repo/metrics/diff.py", line 9, in _get_metrics *args, **kwargs, revs=[rev] if rev else None File "/Users/dmitry/src/dvc/dvc/repo/metrics/__init__.py", line 8, in show return show(self.repo, *args, **kwargs) File "/Users/dmitry/src/dvc/dvc/repo/__init__.py", line 51, in wrapper return f(repo, *args, **kwargs) File "/Users/dmitry/src/dvc/dvc/repo/metrics/show.py", line 108, in show metrics = _collect_metrics(repo, targets, recursive) File "/Users/dmitry/src/dvc/dvc/repo/metrics/show.py", line 33, in _collect_metrics for stage in repo.stages: File "/Users/dmitry/virtenvs/ml/lib/python3.7/site-packages/funcy/objects.py", line 28, in __get__ res = instance.__dict__[self.fget.__name__] = self.fget(instance) File "/Users/dmitry/src/dvc/dvc/repo/__init__.py", line 554, in stages return self._collect_stages() File "/Users/dmitry/src/dvc/dvc/repo/__init__.py", line 562, in _collect_stages new_stages = self.get_stages(os.path.join(root, file_name)) File "/Users/dmitry/src/dvc/dvc/repo/__init__.py", line 254, in get_stages return list(dvcfile.stages.values()) File "/Users/dmitry/src/dvc/dvc/dvcfile.py", line 228, in stages data, _ = self._load() File "/Users/dmitry/src/dvc/dvc/dvcfile.py", line 107, in _load d = parse_yaml(stage_text, self.path) File "/Users/dmitry/src/dvc/dvc/utils/serialize/_yaml.py", line 24, in parse_yaml return yaml.load(text) or {} File "/Users/dmitry/virtenvs/ml/lib/python3.7/site-packages/ruamel/yaml/main.py", line 343, in load return constructor.get_single_data() File "/Users/dmitry/virtenvs/ml/lib/python3.7/site-packages/ruamel/yaml/constructor.py", line 113, in get_single_data return self.construct_document(node) File "/Users/dmitry/virtenvs/ml/lib/python3.7/site-packages/ruamel/yaml/constructor.py", line 123, in construct_document for _dummy in generator: File "/Users/dmitry/virtenvs/ml/lib/python3.7/site-packages/ruamel/yaml/constructor.py", line 723, in construct_yaml_map value = self.construct_mapping(node) File "/Users/dmitry/virtenvs/ml/lib/python3.7/site-packages/ruamel/yaml/constructor.py", line 440, in construct_mapping return BaseConstructor.construct_mapping(self, node, deep=deep) File "/Users/dmitry/virtenvs/ml/lib/python3.7/site-packages/ruamel/yaml/constructor.py", line 257, in construct_mapping if self.check_mapping_key(node, key_node, mapping, key, value): File "/Users/dmitry/virtenvs/ml/lib/python3.7/site-packages/ruamel/yaml/constructor.py", line 295, in check_mapping_key raise DuplicateKeyError(*args) ruamel.yaml.constructor.DuplicateKeyError: while constructing a mapping in "<unicode string>", line 3, column 5 found duplicate key "metrics" with value "[]" (original value: "[]") in "<unicode string>", line 20, column 5 To suppress this check see: http://yaml.readthedocs.io/en/latest/api.html#duplicate-keys Duplicate keys will become an error in future releases, and are errors by default when using the new API. ------------------------------------------------------------ Having any troubles? Hit us up at https://dvc.org/support, we are always happy to help! DVC version: 1.7.9+7b590e --------------------------------- Platform: Python 3.7.3 on Darwin-19.6.0-x86_64-i386-64bit Supports: azure, gdrive, gs, hdfs, http, https, s3, ssh, oss Cache types: reflink, hardlink, symlink Cache directory: apfs on /dev/disk1s5 Workspace directory: apfs on /dev/disk1s5 Repo: dvc, git 2020-10-05 09:00:38,885 DEBUG: Analytics is enabled. 2020-10-05 09:00:39,063 DEBUG: Trying to spawn '['daemon', '-q', 'analytics', '/var/folders/hq/h82mgrhx37nc89_1rcg6gm280000gn/T/tmpivw63jns']' 2020-10-05 09:00:39,065 DEBUG: Spawned '['daemon', '-q', 'analytics', '/var/folders/hq/h82mgrhx37nc89_1rcg6gm280000gn/T/tmpivw63jns']
ruamel.yaml.constructor.DuplicateKeyError
def parse_yaml(text, path, typ="safe"): yaml = YAML(typ=typ) try: with reraise(_YAMLError, YAMLFileCorruptedError(path)): return yaml.load(text) or {} except DuplicateKeyError as exc: # NOTE: unfortunately this one doesn't inherit from YAMLError, so we # have to catch it by-hand. See # https://yaml.readthedocs.io/en/latest/api.html#duplicate-keys raise YAMLError(path, exc.problem)
def parse_yaml(text, path, typ="safe"): yaml = YAML(typ=typ) with reraise(YAMLError, YAMLFileCorruptedError(path)): return yaml.load(text) or {}
https://github.com/iterative/dvc/issues/4664
$ dvc metrics diff -v 2020-10-05 09:00:38,005 DEBUG: Check for update is enabled. 2020-10-05 09:00:38,039 DEBUG: fetched: [(3,)] 2020-10-05 09:00:38,048 DEBUG: fetched: [(682,)] 2020-10-05 09:00:38,049 ERROR: unexpected error - while constructing a mapping in "<unicode string>", line 3, column 5 found duplicate key "metrics" with value "[]" (original value: "[]") in "<unicode string>", line 20, column 5 To suppress this check see: http://yaml.readthedocs.io/en/latest/api.html#duplicate-keys Duplicate keys will become an error in future releases, and are errors by default when using the new API. ------------------------------------------------------------ Traceback (most recent call last): File "/Users/dmitry/src/dvc/dvc/main.py", line 76, in main ret = cmd.run() File "/Users/dmitry/src/dvc/dvc/command/metrics.py", line 119, in run all=self.args.all, File "/Users/dmitry/src/dvc/dvc/repo/metrics/__init__.py", line 13, in diff return diff(self.repo, *args, **kwargs) File "/Users/dmitry/src/dvc/dvc/repo/metrics/diff.py", line 22, in diff old = _get_metrics(repo, *args, **kwargs, rev=(a_rev or "HEAD")) File "/Users/dmitry/src/dvc/dvc/repo/metrics/diff.py", line 9, in _get_metrics *args, **kwargs, revs=[rev] if rev else None File "/Users/dmitry/src/dvc/dvc/repo/metrics/__init__.py", line 8, in show return show(self.repo, *args, **kwargs) File "/Users/dmitry/src/dvc/dvc/repo/__init__.py", line 51, in wrapper return f(repo, *args, **kwargs) File "/Users/dmitry/src/dvc/dvc/repo/metrics/show.py", line 108, in show metrics = _collect_metrics(repo, targets, recursive) File "/Users/dmitry/src/dvc/dvc/repo/metrics/show.py", line 33, in _collect_metrics for stage in repo.stages: File "/Users/dmitry/virtenvs/ml/lib/python3.7/site-packages/funcy/objects.py", line 28, in __get__ res = instance.__dict__[self.fget.__name__] = self.fget(instance) File "/Users/dmitry/src/dvc/dvc/repo/__init__.py", line 554, in stages return self._collect_stages() File "/Users/dmitry/src/dvc/dvc/repo/__init__.py", line 562, in _collect_stages new_stages = self.get_stages(os.path.join(root, file_name)) File "/Users/dmitry/src/dvc/dvc/repo/__init__.py", line 254, in get_stages return list(dvcfile.stages.values()) File "/Users/dmitry/src/dvc/dvc/dvcfile.py", line 228, in stages data, _ = self._load() File "/Users/dmitry/src/dvc/dvc/dvcfile.py", line 107, in _load d = parse_yaml(stage_text, self.path) File "/Users/dmitry/src/dvc/dvc/utils/serialize/_yaml.py", line 24, in parse_yaml return yaml.load(text) or {} File "/Users/dmitry/virtenvs/ml/lib/python3.7/site-packages/ruamel/yaml/main.py", line 343, in load return constructor.get_single_data() File "/Users/dmitry/virtenvs/ml/lib/python3.7/site-packages/ruamel/yaml/constructor.py", line 113, in get_single_data return self.construct_document(node) File "/Users/dmitry/virtenvs/ml/lib/python3.7/site-packages/ruamel/yaml/constructor.py", line 123, in construct_document for _dummy in generator: File "/Users/dmitry/virtenvs/ml/lib/python3.7/site-packages/ruamel/yaml/constructor.py", line 723, in construct_yaml_map value = self.construct_mapping(node) File "/Users/dmitry/virtenvs/ml/lib/python3.7/site-packages/ruamel/yaml/constructor.py", line 440, in construct_mapping return BaseConstructor.construct_mapping(self, node, deep=deep) File "/Users/dmitry/virtenvs/ml/lib/python3.7/site-packages/ruamel/yaml/constructor.py", line 257, in construct_mapping if self.check_mapping_key(node, key_node, mapping, key, value): File "/Users/dmitry/virtenvs/ml/lib/python3.7/site-packages/ruamel/yaml/constructor.py", line 295, in check_mapping_key raise DuplicateKeyError(*args) ruamel.yaml.constructor.DuplicateKeyError: while constructing a mapping in "<unicode string>", line 3, column 5 found duplicate key "metrics" with value "[]" (original value: "[]") in "<unicode string>", line 20, column 5 To suppress this check see: http://yaml.readthedocs.io/en/latest/api.html#duplicate-keys Duplicate keys will become an error in future releases, and are errors by default when using the new API. ------------------------------------------------------------ Having any troubles? Hit us up at https://dvc.org/support, we are always happy to help! DVC version: 1.7.9+7b590e --------------------------------- Platform: Python 3.7.3 on Darwin-19.6.0-x86_64-i386-64bit Supports: azure, gdrive, gs, hdfs, http, https, s3, ssh, oss Cache types: reflink, hardlink, symlink Cache directory: apfs on /dev/disk1s5 Workspace directory: apfs on /dev/disk1s5 Repo: dvc, git 2020-10-05 09:00:38,885 DEBUG: Analytics is enabled. 2020-10-05 09:00:39,063 DEBUG: Trying to spawn '['daemon', '-q', 'analytics', '/var/folders/hq/h82mgrhx37nc89_1rcg6gm280000gn/T/tmpivw63jns']' 2020-10-05 09:00:39,065 DEBUG: Spawned '['daemon', '-q', 'analytics', '/var/folders/hq/h82mgrhx37nc89_1rcg6gm280000gn/T/tmpivw63jns']
ruamel.yaml.constructor.DuplicateKeyError
def main(argv=None): # noqa: C901 """Run dvc CLI command. Args: argv: optional list of arguments to parse. sys.argv is used by default. Returns: int: command's return code. """ args = None disable_other_loggers() outerLogLevel = logger.level try: args = parse_args(argv) level = None if args.quiet: level = logging.CRITICAL elif args.verbose == 1: level = logging.DEBUG elif args.verbose > 1: level = logging.TRACE if level is not None: logger.setLevel(level) logger.trace(args) with profile(enable=args.cprofile, dump=args.cprofile_dump): cmd = args.func(args) ret = cmd.run() except ConfigError: logger.exception("configuration error") ret = 251 except KeyboardInterrupt: logger.exception("interrupted by the user") ret = 252 except NotDvcRepoError: logger.exception("") ret = 253 except DvcParserError: ret = 254 except DvcException: ret = 255 logger.exception("") except Exception as exc: # noqa, pylint: disable=broad-except # pylint: disable=no-member if isinstance(exc, OSError) and exc.errno == errno.EMFILE: logger.exception( "too many open files, please visit " "{} to see how to handle this " "problem".format(error_link("many-files")), extra={"tb_only": True}, ) else: from dvc.info import get_dvc_info logger.exception("unexpected error") dvc_info = get_dvc_info() logger.debug("Version info for developers:\n%s", dvc_info) logger.info(FOOTER) ret = 255 try: if analytics.is_enabled(): analytics.collect_and_send_report(args, ret) return ret finally: logger.setLevel(outerLogLevel) # Closing pools by-hand to prevent weird messages when closing SSH # connections. See https://github.com/iterative/dvc/issues/3248 for # more info. close_pools() # Remove cached repos in the end of the call, these are anonymous # so won't be reused by any other subsequent run anyway. clean_repos()
def main(argv=None): # noqa: C901 """Run dvc CLI command. Args: argv: optional list of arguments to parse. sys.argv is used by default. Returns: int: command's return code. """ args = None disable_other_loggers() outerLogLevel = logger.level try: args = parse_args(argv) level = None if args.quiet: level = logging.CRITICAL elif args.verbose == 1: level = logging.DEBUG elif args.verbose > 1: level = logging.TRACE if level is not None: logger.setLevel(level) logger.trace(args) with profile(enable=args.cprofile, dump=args.cprofile_dump): cmd = args.func(args) ret = cmd.run() except ConfigError: logger.exception("configuration error") ret = 251 except KeyboardInterrupt: logger.exception("interrupted by the user") ret = 252 except NotDvcRepoError: logger.exception("") ret = 253 except DvcParserError: ret = 254 except DvcException: ret = 255 logger.exception("") except Exception as exc: # noqa, pylint: disable=broad-except # pylint: disable=no-member if isinstance(exc, OSError) and exc.errno == errno.EMFILE: logger.exception( "too many open files, please visit " "{} to see how to handle this " "problem".format(error_link("many-files")), extra={"tb_only": True}, ) else: from dvc.info import get_dvc_info logger.exception("unexpected error") logger.info(FOOTER) dvc_info = get_dvc_info() logger.info(dvc_info) ret = 255 try: if analytics.is_enabled(): analytics.collect_and_send_report(args, ret) return ret finally: logger.setLevel(outerLogLevel) # Closing pools by-hand to prevent weird messages when closing SSH # connections. See https://github.com/iterative/dvc/issues/3248 for # more info. close_pools() # Remove cached repos in the end of the call, these are anonymous # so won't be reused by any other subsequent run anyway. clean_repos()
https://github.com/iterative/dvc/issues/4664
$ dvc metrics diff -v 2020-10-05 09:00:38,005 DEBUG: Check for update is enabled. 2020-10-05 09:00:38,039 DEBUG: fetched: [(3,)] 2020-10-05 09:00:38,048 DEBUG: fetched: [(682,)] 2020-10-05 09:00:38,049 ERROR: unexpected error - while constructing a mapping in "<unicode string>", line 3, column 5 found duplicate key "metrics" with value "[]" (original value: "[]") in "<unicode string>", line 20, column 5 To suppress this check see: http://yaml.readthedocs.io/en/latest/api.html#duplicate-keys Duplicate keys will become an error in future releases, and are errors by default when using the new API. ------------------------------------------------------------ Traceback (most recent call last): File "/Users/dmitry/src/dvc/dvc/main.py", line 76, in main ret = cmd.run() File "/Users/dmitry/src/dvc/dvc/command/metrics.py", line 119, in run all=self.args.all, File "/Users/dmitry/src/dvc/dvc/repo/metrics/__init__.py", line 13, in diff return diff(self.repo, *args, **kwargs) File "/Users/dmitry/src/dvc/dvc/repo/metrics/diff.py", line 22, in diff old = _get_metrics(repo, *args, **kwargs, rev=(a_rev or "HEAD")) File "/Users/dmitry/src/dvc/dvc/repo/metrics/diff.py", line 9, in _get_metrics *args, **kwargs, revs=[rev] if rev else None File "/Users/dmitry/src/dvc/dvc/repo/metrics/__init__.py", line 8, in show return show(self.repo, *args, **kwargs) File "/Users/dmitry/src/dvc/dvc/repo/__init__.py", line 51, in wrapper return f(repo, *args, **kwargs) File "/Users/dmitry/src/dvc/dvc/repo/metrics/show.py", line 108, in show metrics = _collect_metrics(repo, targets, recursive) File "/Users/dmitry/src/dvc/dvc/repo/metrics/show.py", line 33, in _collect_metrics for stage in repo.stages: File "/Users/dmitry/virtenvs/ml/lib/python3.7/site-packages/funcy/objects.py", line 28, in __get__ res = instance.__dict__[self.fget.__name__] = self.fget(instance) File "/Users/dmitry/src/dvc/dvc/repo/__init__.py", line 554, in stages return self._collect_stages() File "/Users/dmitry/src/dvc/dvc/repo/__init__.py", line 562, in _collect_stages new_stages = self.get_stages(os.path.join(root, file_name)) File "/Users/dmitry/src/dvc/dvc/repo/__init__.py", line 254, in get_stages return list(dvcfile.stages.values()) File "/Users/dmitry/src/dvc/dvc/dvcfile.py", line 228, in stages data, _ = self._load() File "/Users/dmitry/src/dvc/dvc/dvcfile.py", line 107, in _load d = parse_yaml(stage_text, self.path) File "/Users/dmitry/src/dvc/dvc/utils/serialize/_yaml.py", line 24, in parse_yaml return yaml.load(text) or {} File "/Users/dmitry/virtenvs/ml/lib/python3.7/site-packages/ruamel/yaml/main.py", line 343, in load return constructor.get_single_data() File "/Users/dmitry/virtenvs/ml/lib/python3.7/site-packages/ruamel/yaml/constructor.py", line 113, in get_single_data return self.construct_document(node) File "/Users/dmitry/virtenvs/ml/lib/python3.7/site-packages/ruamel/yaml/constructor.py", line 123, in construct_document for _dummy in generator: File "/Users/dmitry/virtenvs/ml/lib/python3.7/site-packages/ruamel/yaml/constructor.py", line 723, in construct_yaml_map value = self.construct_mapping(node) File "/Users/dmitry/virtenvs/ml/lib/python3.7/site-packages/ruamel/yaml/constructor.py", line 440, in construct_mapping return BaseConstructor.construct_mapping(self, node, deep=deep) File "/Users/dmitry/virtenvs/ml/lib/python3.7/site-packages/ruamel/yaml/constructor.py", line 257, in construct_mapping if self.check_mapping_key(node, key_node, mapping, key, value): File "/Users/dmitry/virtenvs/ml/lib/python3.7/site-packages/ruamel/yaml/constructor.py", line 295, in check_mapping_key raise DuplicateKeyError(*args) ruamel.yaml.constructor.DuplicateKeyError: while constructing a mapping in "<unicode string>", line 3, column 5 found duplicate key "metrics" with value "[]" (original value: "[]") in "<unicode string>", line 20, column 5 To suppress this check see: http://yaml.readthedocs.io/en/latest/api.html#duplicate-keys Duplicate keys will become an error in future releases, and are errors by default when using the new API. ------------------------------------------------------------ Having any troubles? Hit us up at https://dvc.org/support, we are always happy to help! DVC version: 1.7.9+7b590e --------------------------------- Platform: Python 3.7.3 on Darwin-19.6.0-x86_64-i386-64bit Supports: azure, gdrive, gs, hdfs, http, https, s3, ssh, oss Cache types: reflink, hardlink, symlink Cache directory: apfs on /dev/disk1s5 Workspace directory: apfs on /dev/disk1s5 Repo: dvc, git 2020-10-05 09:00:38,885 DEBUG: Analytics is enabled. 2020-10-05 09:00:39,063 DEBUG: Trying to spawn '['daemon', '-q', 'analytics', '/var/folders/hq/h82mgrhx37nc89_1rcg6gm280000gn/T/tmpivw63jns']' 2020-10-05 09:00:39,065 DEBUG: Spawned '['daemon', '-q', 'analytics', '/var/folders/hq/h82mgrhx37nc89_1rcg6gm280000gn/T/tmpivw63jns']
ruamel.yaml.constructor.DuplicateKeyError
def open_by_relpath(self, path, remote=None, mode="r", encoding=None): """Opens a specified resource as a file descriptor""" tree = RepoTree(self, stream=True, subrepos=True) path = PathInfo(self.root_dir) / path try: with self.state: with tree.open( path, mode=mode, encoding=encoding, remote=remote, ) as fobj: yield fobj except FileNotFoundError as exc: raise FileMissingError(path) from exc except IsADirectoryError as exc: raise DvcIsADirectoryError(f"'{path}' is a directory") from exc
def open_by_relpath(self, path, remote=None, mode="r", encoding=None): """Opens a specified resource as a file descriptor""" tree = RepoTree(self, stream=True, subrepos=True) path = os.path.join(self.root_dir, path) try: with self.state: with tree.open( path, mode=mode, encoding=encoding, remote=remote, ) as fobj: yield fobj except FileNotFoundError as exc: raise FileMissingError(path) from exc except IsADirectoryError as exc: raise DvcIsADirectoryError(f"'{path}' is a directory") from exc
https://github.com/iterative/dvc/issues/4650
--------------------------------------------------------------------------- AssertionError Traceback (most recent call last) <ipython-input-x-xxxxxxxxxxxx> in <module> ----> 1 with open('test/foo') as file: 2 pass 3 .../python3.6/contextlib.py in __enter__(self) 79 def __enter__(self): 80 try: ---> 81 return next(self.gen) 82 except StopIteration: 83 raise RuntimeError("generator didn't yield") from None .../python3.6/site-packages/dvc/api.py in _open(path, repo, rev, remote, mode, encoding) 82 with _make_repo(repo, rev=rev) as _repo: 83 with _repo.open_by_relpath( ---> 84 path, remote=remote, mode=mode, encoding=encoding 85 ) as fd: 86 yield fd .../python3.6/contextlib.py in __enter__(self) 79 def __enter__(self): 80 try: ---> 81 return next(self.gen) 82 except StopIteration: 83 raise RuntimeError("generator didn't yield") from None .../python3.6/site-packages/dvc/repo/__init__.py in open_by_relpath(self, path, remote, mode, encoding) 616 with self.state: 617 with tree.open( --> 618 path, mode=mode, encoding=encoding, remote=remote, 619 ) as fobj: 620 yield fobj .../python3.6/site-packages/dvc/tree/repo.py in open(self, path, mode, encoding, **kwargs) 157 raise 158 --> 159 return dvc_tree.open(path, mode=mode, encoding=encoding, **kwargs) 160 161 def exists( .../python3.6/site-packages/dvc/tree/dvc.py in open(self, path, mode, encoding, remote) 80 if self.stream: 81 if out.is_dir_checksum: ---> 82 checksum = self._get_granular_checksum(path, out) 83 else: 84 checksum = out.hash_info.value .../python3.6/site-packages/dvc/tree/dvc.py in _get_granular_checksum(self, path, out, remote) 47 48 def _get_granular_checksum(self, path, out, remote=None): ---> 49 assert isinstance(path, PathInfo) 50 if not self.fetch and not self.stream: 51 raise FileNotFoundError AssertionError:
AssertionError
def _get_granular_checksum(self, path_info: PathInfo, out: "BaseOutput", remote=None): assert isinstance(path_info, PathInfo) if not self.fetch and not self.stream: raise FileNotFoundError dir_cache = out.get_dir_cache(remote=remote) for entry in dir_cache: entry_relpath = entry[out.tree.PARAM_RELPATH] if os.name == "nt": entry_relpath = entry_relpath.replace("/", os.sep) if path_info == out.path_info / entry_relpath: return entry[out.tree.PARAM_CHECKSUM] raise FileNotFoundError
def _get_granular_checksum(self, path, out, remote=None): assert isinstance(path, PathInfo) if not self.fetch and not self.stream: raise FileNotFoundError dir_cache = out.get_dir_cache(remote=remote) for entry in dir_cache: entry_relpath = entry[out.tree.PARAM_RELPATH] if os.name == "nt": entry_relpath = entry_relpath.replace("/", os.sep) if path == out.path_info / entry_relpath: return entry[out.tree.PARAM_CHECKSUM] raise FileNotFoundError
https://github.com/iterative/dvc/issues/4650
--------------------------------------------------------------------------- AssertionError Traceback (most recent call last) <ipython-input-x-xxxxxxxxxxxx> in <module> ----> 1 with open('test/foo') as file: 2 pass 3 .../python3.6/contextlib.py in __enter__(self) 79 def __enter__(self): 80 try: ---> 81 return next(self.gen) 82 except StopIteration: 83 raise RuntimeError("generator didn't yield") from None .../python3.6/site-packages/dvc/api.py in _open(path, repo, rev, remote, mode, encoding) 82 with _make_repo(repo, rev=rev) as _repo: 83 with _repo.open_by_relpath( ---> 84 path, remote=remote, mode=mode, encoding=encoding 85 ) as fd: 86 yield fd .../python3.6/contextlib.py in __enter__(self) 79 def __enter__(self): 80 try: ---> 81 return next(self.gen) 82 except StopIteration: 83 raise RuntimeError("generator didn't yield") from None .../python3.6/site-packages/dvc/repo/__init__.py in open_by_relpath(self, path, remote, mode, encoding) 616 with self.state: 617 with tree.open( --> 618 path, mode=mode, encoding=encoding, remote=remote, 619 ) as fobj: 620 yield fobj .../python3.6/site-packages/dvc/tree/repo.py in open(self, path, mode, encoding, **kwargs) 157 raise 158 --> 159 return dvc_tree.open(path, mode=mode, encoding=encoding, **kwargs) 160 161 def exists( .../python3.6/site-packages/dvc/tree/dvc.py in open(self, path, mode, encoding, remote) 80 if self.stream: 81 if out.is_dir_checksum: ---> 82 checksum = self._get_granular_checksum(path, out) 83 else: 84 checksum = out.hash_info.value .../python3.6/site-packages/dvc/tree/dvc.py in _get_granular_checksum(self, path, out, remote) 47 48 def _get_granular_checksum(self, path, out, remote=None): ---> 49 assert isinstance(path, PathInfo) 50 if not self.fetch and not self.stream: 51 raise FileNotFoundError AssertionError:
AssertionError
def open(self, path: PathInfo, mode="r", encoding="utf-8", remote=None): # pylint: disable=arguments-differ try: outs = self._find_outs(path, strict=False) except OutputNotFoundError as exc: raise FileNotFoundError from exc if len(outs) != 1 or (outs[0].is_dir_checksum and path == outs[0].path_info): raise IsADirectoryError out = outs[0] if out.changed_cache(filter_info=path): if not self.fetch and not self.stream: raise FileNotFoundError remote_obj = self.repo.cloud.get_remote(remote) if self.stream: if out.is_dir_checksum: checksum = self._get_granular_checksum(path, out) else: checksum = out.hash_info.value try: remote_info = remote_obj.tree.hash_to_path_info(checksum) return remote_obj.tree.open(remote_info, mode=mode, encoding=encoding) except RemoteActionNotImplemented: pass cache_info = out.get_used_cache(filter_info=path, remote=remote) self.repo.cloud.pull(cache_info, remote=remote) if out.is_dir_checksum: checksum = self._get_granular_checksum(path, out) cache_path = out.cache.tree.hash_to_path_info(checksum).url else: cache_path = out.cache_path return open(cache_path, mode=mode, encoding=encoding)
def open(self, path, mode="r", encoding="utf-8", remote=None): # pylint: disable=arguments-differ try: outs = self._find_outs(path, strict=False) except OutputNotFoundError as exc: raise FileNotFoundError from exc if len(outs) != 1 or (outs[0].is_dir_checksum and path == outs[0].path_info): raise IsADirectoryError out = outs[0] if out.changed_cache(filter_info=path): if not self.fetch and not self.stream: raise FileNotFoundError remote_obj = self.repo.cloud.get_remote(remote) if self.stream: if out.is_dir_checksum: checksum = self._get_granular_checksum(path, out) else: checksum = out.hash_info.value try: remote_info = remote_obj.tree.hash_to_path_info(checksum) return remote_obj.tree.open(remote_info, mode=mode, encoding=encoding) except RemoteActionNotImplemented: pass cache_info = out.get_used_cache(filter_info=path, remote=remote) self.repo.cloud.pull(cache_info, remote=remote) if out.is_dir_checksum: checksum = self._get_granular_checksum(path, out) cache_path = out.cache.tree.hash_to_path_info(checksum).url else: cache_path = out.cache_path return open(cache_path, mode=mode, encoding=encoding)
https://github.com/iterative/dvc/issues/4650
--------------------------------------------------------------------------- AssertionError Traceback (most recent call last) <ipython-input-x-xxxxxxxxxxxx> in <module> ----> 1 with open('test/foo') as file: 2 pass 3 .../python3.6/contextlib.py in __enter__(self) 79 def __enter__(self): 80 try: ---> 81 return next(self.gen) 82 except StopIteration: 83 raise RuntimeError("generator didn't yield") from None .../python3.6/site-packages/dvc/api.py in _open(path, repo, rev, remote, mode, encoding) 82 with _make_repo(repo, rev=rev) as _repo: 83 with _repo.open_by_relpath( ---> 84 path, remote=remote, mode=mode, encoding=encoding 85 ) as fd: 86 yield fd .../python3.6/contextlib.py in __enter__(self) 79 def __enter__(self): 80 try: ---> 81 return next(self.gen) 82 except StopIteration: 83 raise RuntimeError("generator didn't yield") from None .../python3.6/site-packages/dvc/repo/__init__.py in open_by_relpath(self, path, remote, mode, encoding) 616 with self.state: 617 with tree.open( --> 618 path, mode=mode, encoding=encoding, remote=remote, 619 ) as fobj: 620 yield fobj .../python3.6/site-packages/dvc/tree/repo.py in open(self, path, mode, encoding, **kwargs) 157 raise 158 --> 159 return dvc_tree.open(path, mode=mode, encoding=encoding, **kwargs) 160 161 def exists( .../python3.6/site-packages/dvc/tree/dvc.py in open(self, path, mode, encoding, remote) 80 if self.stream: 81 if out.is_dir_checksum: ---> 82 checksum = self._get_granular_checksum(path, out) 83 else: 84 checksum = out.hash_info.value .../python3.6/site-packages/dvc/tree/dvc.py in _get_granular_checksum(self, path, out, remote) 47 48 def _get_granular_checksum(self, path, out, remote=None): ---> 49 assert isinstance(path, PathInfo) 50 if not self.fetch and not self.stream: 51 raise FileNotFoundError AssertionError:
AssertionError
def open(self, path, mode="r", encoding="utf-8", **kwargs): # pylint: disable=arguments-differ if "b" in mode: encoding = None tree, dvc_tree = self._get_tree_pair(path) path_info = PathInfo(path) try: return tree.open(path_info, mode=mode, encoding=encoding) except FileNotFoundError: if not dvc_tree: raise return dvc_tree.open(path_info, mode=mode, encoding=encoding, **kwargs)
def open(self, path, mode="r", encoding="utf-8", **kwargs): # pylint: disable=arguments-differ if "b" in mode: encoding = None tree, dvc_tree = self._get_tree_pair(path) try: return tree.open(path, mode=mode, encoding=encoding) except FileNotFoundError: if not dvc_tree: raise return dvc_tree.open(path, mode=mode, encoding=encoding, **kwargs)
https://github.com/iterative/dvc/issues/4650
--------------------------------------------------------------------------- AssertionError Traceback (most recent call last) <ipython-input-x-xxxxxxxxxxxx> in <module> ----> 1 with open('test/foo') as file: 2 pass 3 .../python3.6/contextlib.py in __enter__(self) 79 def __enter__(self): 80 try: ---> 81 return next(self.gen) 82 except StopIteration: 83 raise RuntimeError("generator didn't yield") from None .../python3.6/site-packages/dvc/api.py in _open(path, repo, rev, remote, mode, encoding) 82 with _make_repo(repo, rev=rev) as _repo: 83 with _repo.open_by_relpath( ---> 84 path, remote=remote, mode=mode, encoding=encoding 85 ) as fd: 86 yield fd .../python3.6/contextlib.py in __enter__(self) 79 def __enter__(self): 80 try: ---> 81 return next(self.gen) 82 except StopIteration: 83 raise RuntimeError("generator didn't yield") from None .../python3.6/site-packages/dvc/repo/__init__.py in open_by_relpath(self, path, remote, mode, encoding) 616 with self.state: 617 with tree.open( --> 618 path, mode=mode, encoding=encoding, remote=remote, 619 ) as fobj: 620 yield fobj .../python3.6/site-packages/dvc/tree/repo.py in open(self, path, mode, encoding, **kwargs) 157 raise 158 --> 159 return dvc_tree.open(path, mode=mode, encoding=encoding, **kwargs) 160 161 def exists( .../python3.6/site-packages/dvc/tree/dvc.py in open(self, path, mode, encoding, remote) 80 if self.stream: 81 if out.is_dir_checksum: ---> 82 checksum = self._get_granular_checksum(path, out) 83 else: 84 checksum = out.hash_info.value .../python3.6/site-packages/dvc/tree/dvc.py in _get_granular_checksum(self, path, out, remote) 47 48 def _get_granular_checksum(self, path, out, remote=None): ---> 49 assert isinstance(path, PathInfo) 50 if not self.fetch and not self.stream: 51 raise FileNotFoundError AssertionError:
AssertionError
def brancher( # noqa: E302 self, revs=None, all_branches=False, all_tags=False, all_commits=False, sha_only=False, ): """Generator that iterates over specified revisions. Args: revs (list): a list of revisions to iterate over. all_branches (bool): iterate over all available branches. all_commits (bool): iterate over all commits. all_tags (bool): iterate over all available tags. sha_only (bool): only return git SHA for a revision. Yields: str: the display name for the currently selected tree, it could be: - a git revision identifier - empty string it there is no branches to iterate over - "workspace" if there are uncommitted changes in the SCM repo """ if not any([revs, all_branches, all_tags, all_commits]): yield "" return saved_tree = self.tree revs = revs.copy() if revs else [] scm = self.scm self.tree = LocalTree(self, {"url": self.root_dir}, use_dvcignore=True) yield "workspace" if revs and "workspace" in revs: revs.remove("workspace") if all_commits: revs = scm.list_all_commits() else: if all_branches: revs.extend(scm.list_branches()) if all_tags: revs.extend(scm.list_tags()) try: if revs: for sha, names in group_by(scm.resolve_rev, revs).items(): self.tree = scm.get_tree( sha, use_dvcignore=True, dvcignore_root=self.root_dir ) # ignore revs that don't contain repo root # (i.e. revs from before a subdir=True repo was init'ed) if self.tree.exists(self.root_dir): if sha_only: yield sha else: yield ", ".join(names) finally: self.tree = saved_tree
def brancher( # noqa: E302 self, revs=None, all_branches=False, all_tags=False, all_commits=False ): """Generator that iterates over specified revisions. Args: revs (list): a list of revisions to iterate over. all_branches (bool): iterate over all available branches. all_commits (bool): iterate over all commits. all_tags (bool): iterate over all available tags. Yields: str: the display name for the currently selected tree, it could be: - a git revision identifier - empty string it there is no branches to iterate over - "workspace" if there are uncommitted changes in the SCM repo """ if not any([revs, all_branches, all_tags, all_commits]): yield "" return saved_tree = self.tree revs = revs.copy() if revs else [] scm = self.scm self.tree = LocalTree(self, {"url": self.root_dir}, use_dvcignore=True) yield "workspace" if revs and "workspace" in revs: revs.remove("workspace") if all_commits: revs = scm.list_all_commits() else: if all_branches: revs.extend(scm.list_branches()) if all_tags: revs.extend(scm.list_tags()) try: if revs: for sha, names in group_by(scm.resolve_rev, revs).items(): self.tree = scm.get_tree( sha, use_dvcignore=True, dvcignore_root=self.root_dir ) # ignore revs that don't contain repo root # (i.e. revs from before a subdir=True repo was init'ed) if self.tree.exists(self.root_dir): yield ", ".join(names) finally: self.tree = saved_tree
https://github.com/iterative/dvc/issues/4587
dvc exp show -T -v 2020-09-21 17:33:07,541 DEBUG: Check for update is enabled. 2020-09-21 17:33:07,570 DEBUG: fetched: [(3,)] 2020-09-21 17:33:08,049 DEBUG: fetched: [(75,)] 2020-09-21 17:33:08,058 ERROR: failed to show experiments - unknown Git revision 'f97e3cca64d10c299f7e9e54dd22889c6ee7a1b4, decouple/base' ------------------------------------------------------------ Traceback (most recent call last): File "/home/roman/miniconda3/envs/tensorflow/lib/python3.6/site-packages/dvc/command/experiments.py", line 258, in run sha_only=self.args.sha, File "/home/roman/miniconda3/envs/tensorflow/lib/python3.6/site-packages/dvc/repo/experiments/__init__.py", line 616, in show return show(self.repo, *args, **kwargs) File "/home/roman/miniconda3/envs/tensorflow/lib/python3.6/site-packages/dvc/repo/__init__.py", line 51, in wrapper return f(repo, *args, **kwargs) File "/home/roman/miniconda3/envs/tensorflow/lib/python3.6/site-packages/dvc/repo/experiments/show.py", line 73, in show repo, rev, sha_only=sha_only File "/home/roman/miniconda3/envs/tensorflow/lib/python3.6/site-packages/dvc/repo/experiments/show.py", line 16, in _collect_experiment for rev in repo.brancher(revs=[branch]): File "/home/roman/miniconda3/envs/tensorflow/lib/python3.6/site-packages/dvc/repo/brancher.py", line 49, in brancher for sha, names in group_by(scm.resolve_rev, revs).items(): File "/home/roman/miniconda3/envs/tensorflow/lib/python3.6/site-packages/funcy/seqs.py", line 317, in group_by result[f(item)].append(item) File "/home/roman/miniconda3/envs/tensorflow/lib/python3.6/site-packages/dvc/scm/git.py", line 432, in resolve_rev raise RevError(f"unknown Git revision '{rev}'") dvc.scm.base.RevError: unknown Git revision 'f97e3cca64d10c299f7e9e54dd22889c6ee7a1b4, decouple/base'
dvc.scm.base.RevError