Skip to content
This repository has been archived by the owner on Jul 31, 2023. It is now read-only.

ImportError: cannot import name 'Parse' from 'avro.schema' #62

Open
jainmilan opened this issue Jan 19, 2021 · 4 comments
Open

ImportError: cannot import name 'Parse' from 'avro.schema' #62

jainmilan opened this issue Jan 19, 2021 · 4 comments

Comments

@jainmilan
Copy link

I installed tensorflow-recorder using the command: pip install tfrecorder. The package installs without any error, however, I am getting the following error when trying to import the package.

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-1-63673124a3e9> in <module>
      4 import pandas as pd
      5 
----> 6 import tfrecorder
      7 import tensorflow as tf

~\Anaconda3\envs\tfrecords\lib\site-packages\tfrecorder\__init__.py in <module>
     17 """Imports."""
     18 
---> 19 from tfrecorder import accessor
     20 from tfrecorder.converter import convert
     21 from tfrecorder.dataset_loader import load

~\Anaconda3\envs\tfrecords\lib\site-packages\tfrecorder\accessor.py in <module>
     26 from IPython.core import display
     27 
---> 28 from tfrecorder import converter
     29 from tfrecorder import constants
     30 from tfrecorder import input_schema

~\Anaconda3\envs\tfrecords\lib\site-packages\tfrecorder\converter.py in <module>
     25 from typing import Any, Dict, Optional, Sequence, Tuple, Union
     26 
---> 27 import apache_beam as beam
     28 import pandas as pd
     29 import tensorflow as tf

~\Anaconda3\envs\tfrecords\lib\site-packages\apache_beam\__init__.py in <module>
     94 
     95 from apache_beam import coders
---> 96 from apache_beam import io
     97 from apache_beam import typehints
     98 from apache_beam import version

~\Anaconda3\envs\tfrecords\lib\site-packages\apache_beam\io\__init__.py in <module>
     21 from __future__ import absolute_import
     22 
---> 23 from apache_beam.io.avroio import *
     24 from apache_beam.io.filebasedsink import *
     25 from apache_beam.io.iobase import Read

~\Anaconda3\envs\tfrecords\lib\site-packages\apache_beam\io\avroio.py in <module>
     56 from avro import io as avroio
     57 from avro import datafile
---> 58 from avro.schema import Parse
     59 from fastavro.read import block_reader
     60 from fastavro.write import Writer

ImportError: cannot import name 'Parse' from 'avro.schema' (C:\Users\xxxxx\Anaconda3\envs\tfrecords\lib\site-packages\avro\schema.py)

Solutions Tried:

  1. Tried installing tensorflow-recorder through pip3 after learning it might be python2/python3 issue from here.
  2. Tried removing avro to enforce this package to use avro-python3 but looks like it needs avro.

Can somebody please help me with this?

@mbernico
Copy link
Contributor

mbernico commented Jan 20, 2021 via email

@jainmilan
Copy link
Author

@mbernico: were you able to replicate the issue?

@mbernico
Copy link
Contributor

mbernico commented Jan 22, 2021 via email

@scottbelden
Copy link

avro.schema.Parse is a deprecated function in avro-python3: https://github.com/apache/avro/blob/72b06153729b1a7963012b1e3e0cc3837e452322/lang/py3/avro/schema.py#L1247-L1252

Both the avro library and avro-python3 now have the lowercase parse() that should be used.

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

No branches or pull requests

3 participants