Install fastai on Jetson nano

Here is another newbie for python and Jetson nano.

I’m trying to install fastai on my new Jetson Nano and tried as below. No idea how do I figure this failure out. Just installed Jetson Nano and installed tensorflow and pytorch.

It would be great if you give me a hint for the installation.

dan@Jetson-nano:~$ pip3 install fastai
Collecting fastai
Using cached https://files.pythonhosted.org/packages/73/9a/661a804675d913535159d8de99e008d730382802dff12a3e990917aaebbb/fastai-2.5.3-py3-none-any.whl
Collecting pillow>6.0.0 (from fastai)
Using cached https://files.pythonhosted.org/packages/7d/2a/2fc11b54e2742db06297f7fa7f420a0e3069fdcf0e4b57dfec33f0b08622/Pillow-8.4.0.tar.gz
Collecting spacy<4 (from fastai)
Using cached https://files.pythonhosted.org/packages/54/c9/95f5a8db73f8ab05b6dbf2a1727d8d77daedf7edfec469af59f57a08d8e7/spacy-3.1.3.tar.gz
Complete output from command python setup.py egg_info:

Error compiling Cython file:
------------------------------------------------------------
...
"""Knowledge-base for entity or concept linking."""
from cymem.cymem cimport Pool
^
------------------------------------------------------------

spacy/kb.pxd:2:0: 'cymem/cymem.pxd' not found

Error compiling Cython file:
------------------------------------------------------------
...
"""Knowledge-base for entity or concept linking."""
from cymem.cymem cimport Pool
^
------------------------------------------------------------

spacy/kb.pxd:2:0: 'cymem/cymem/Pool.pxd' not found

Error compiling Cython file:
------------------------------------------------------------
...
"""Knowledge-base for entity or concept linking."""
from cymem.cymem cimport Pool
from preshed.maps cimport PreshMap
^
------------------------------------------------------------

spacy/kb.pxd:3:0: 'preshed/maps.pxd' not found

Error compiling Cython file:
------------------------------------------------------------
...
"""Knowledge-base for entity or concept linking."""
from cymem.cymem cimport Pool
from preshed.maps cimport PreshMap
^
------------------------------------------------------------

spacy/kb.pxd:3:0: 'preshed/maps/PreshMap.pxd' not found

Error compiling Cython file:
------------------------------------------------------------
...
from libcpp.vector cimport vector
from preshed.maps cimport PreshMap
from cymem.cymem cimport Pool
from murmurhash.mrmr cimport hash64
^
------------------------------------------------------------

spacy/vocab.pxd:4:0: 'murmurhash/mrmr.pxd' not found

Error compiling Cython file:
------------------------------------------------------------
...
from libcpp.vector cimport vector
from preshed.maps cimport PreshMap
from cymem.cymem cimport Pool
from murmurhash.mrmr cimport hash64
^
------------------------------------------------------------

spacy/vocab.pxd:4:0: 'murmurhash/mrmr/hash64.pxd' not found

Error compiling Cython file:
------------------------------------------------------------
...
    unsigned char[8] s
    unsigned char* p


cdef class StringStore:
    cdef Pool mem
        ^
------------------------------------------------------------

spacy/strings.pxd:23:9: 'Pool' is not a type identifier

Error compiling Cython file:
------------------------------------------------------------
...

cdef class StringStore:
    cdef Pool mem

    cdef vector[hash_t] keys
    cdef public PreshMap _map
               ^
------------------------------------------------------------

spacy/strings.pxd:26:16: 'PreshMap' is not a type identifier

Error compiling Cython file:
------------------------------------------------------------
...

cdef class StringStore:
    cdef Pool mem

    cdef vector[hash_t] keys
    cdef public PreshMap _map
                        ^
------------------------------------------------------------

spacy/strings.pxd:26:25: C attribute of type '<error>' cannot be accessed from Python

Error compiling Cython file:
------------------------------------------------------------
...
from .strings cimport StringStore
from .typedefs cimport attr_t, hash_t


cdef class Morphology:
    cdef readonly Pool mem
                 ^
------------------------------------------------------------

spacy/morphology.pxd:12:18: 'Pool' is not a type identifier

Error compiling Cython file:
------------------------------------------------------------
...
from .strings cimport StringStore
from .typedefs cimport attr_t, hash_t


cdef class Morphology:
    cdef readonly Pool mem
                      ^
------------------------------------------------------------

spacy/morphology.pxd:12:23: C attribute of type '<error>' cannot be accessed from Python

Error compiling Cython file:
------------------------------------------------------------
...


cdef class Morphology:
    cdef readonly Pool mem
    cdef readonly StringStore strings
    cdef PreshMap tags # Keyed by hash, value is pointer to tag
        ^
------------------------------------------------------------

spacy/morphology.pxd:14:9: 'PreshMap' is not a type identifier

Error compiling Cython file:
------------------------------------------------------------
...
    bint is_lex
    int length


cdef class Vocab:
    cdef Pool mem
        ^
------------------------------------------------------------

spacy/vocab.pxd:27:9: 'Pool' is not a type identifier

Error compiling Cython file:
------------------------------------------------------------
...
    cdef readonly int length
    cdef public object data_dir
    cdef public object lex_attr_getters
    cdef public object cfg

    cdef const LexemeC* get(self, Pool mem, unicode string) except NULL
                                 ^
------------------------------------------------------------

spacy/vocab.pxd:39:34: 'Pool' is not a type identifier

Error compiling Cython file:
------------------------------------------------------------
...
    cdef public object data_dir
    cdef public object lex_attr_getters
    cdef public object cfg

    cdef const LexemeC* get(self, Pool mem, unicode string) except NULL
    cdef const LexemeC* get_by_orth(self, Pool mem, attr_t orth) except NULL
                                         ^
------------------------------------------------------------

spacy/vocab.pxd:40:42: 'Pool' is not a type identifier

Error compiling Cython file:
------------------------------------------------------------
...

    cdef const LexemeC* get(self, Pool mem, unicode string) except NULL
    cdef const LexemeC* get_by_orth(self, Pool mem, attr_t orth) except NULL
    cdef const TokenC* make_fused_token(self, substrings) except NULL

    cdef const LexemeC* _new_lexeme(self, Pool mem, unicode string) except NULL
                                         ^
------------------------------------------------------------

spacy/vocab.pxd:43:42: 'Pool' is not a type identifier

Error compiling Cython file:
------------------------------------------------------------
...
    cdef const LexemeC* get_by_orth(self, Pool mem, attr_t orth) except NULL
    cdef const TokenC* make_fused_token(self, substrings) except NULL

    cdef const LexemeC* _new_lexeme(self, Pool mem, unicode string) except NULL
    cdef int _add_lex_to_vocab(self, hash_t key, const LexemeC* lex) except -1
    cdef const LexemeC* _new_lexeme(self, Pool mem, unicode string) except NULL
                                         ^
------------------------------------------------------------

spacy/vocab.pxd:45:42: 'Pool' is not a type identifier

Error compiling Cython file:
------------------------------------------------------------
...

    cdef const LexemeC* _new_lexeme(self, Pool mem, unicode string) except NULL
    cdef int _add_lex_to_vocab(self, hash_t key, const LexemeC* lex) except -1
    cdef const LexemeC* _new_lexeme(self, Pool mem, unicode string) except NULL

    cdef PreshMap _by_orth
        ^
------------------------------------------------------------

spacy/vocab.pxd:47:9: 'PreshMap' is not a type identifier

Error compiling Cython file:
------------------------------------------------------------
...
    cdef hash_t alias_hash
    cdef float prior_prob


cdef class KnowledgeBase:
    cdef Pool mem
        ^
------------------------------------------------------------

spacy/kb.pxd:30:9: 'Pool' is not a type identifier

Error compiling Cython file:
------------------------------------------------------------
...

    # This maps 64bit keys (hash of unique entity string)
    # to 64bit values (position of the _KBEntryC struct in the _entries vector).
    # The PreshMap is pretty space efficient, as it uses open addressing. So
    # the only overhead is the vacancy rate, which is approximately 30%.
    cdef PreshMap _entry_index
        ^
------------------------------------------------------------

spacy/kb.pxd:38:9: 'PreshMap' is not a type identifier

Error compiling Cython file:
------------------------------------------------------------
...
    # Storing 1m entries would take 41.6mb under this scheme.
    cdef entry_vec _entries

    # This maps 64bit keys (hash of unique alias string)
    # to 64bit values (position of the _AliasC struct in the _aliases_table vector).
    cdef PreshMap _alias_index
        ^
------------------------------------------------------------

spacy/kb.pxd:48:9: 'PreshMap' is not a type identifier

Error compiling Cython file:
------------------------------------------------------------
...
    DOCS: https://spacy.io/api/kb
    """

    def __init__(self, Vocab vocab, entity_vector_length):
        """Create a KnowledgeBase."""
        self.mem = Pool()
                  ^
------------------------------------------------------------

spacy/kb.pyx:89:19: 'Pool' is not a constant, variable or function identifier

Error compiling Cython file:
------------------------------------------------------------
...

    def __init__(self, Vocab vocab, entity_vector_length):
        """Create a KnowledgeBase."""
        self.mem = Pool()
        self.entity_vector_length = entity_vector_length
        self._entry_index = PreshMap()
                           ^
------------------------------------------------------------

spacy/kb.pyx:91:28: 'PreshMap' is not a constant, variable or function identifier

Error compiling Cython file:
------------------------------------------------------------
...
    def __init__(self, Vocab vocab, entity_vector_length):
        """Create a KnowledgeBase."""
        self.mem = Pool()
        self.entity_vector_length = entity_vector_length
        self._entry_index = PreshMap()
        self._alias_index = PreshMap()
                           ^
------------------------------------------------------------

spacy/kb.pyx:92:28: 'PreshMap' is not a constant, variable or function identifier

Error compiling Cython file:
------------------------------------------------------------
...
        self._alias_index = PreshMap()
        self.vocab = vocab
        self._create_empty_vectors(dummy_hash=self.vocab.strings[""])

    def initialize_entities(self, int64_t nr_entities):
        self._entry_index = PreshMap(nr_entities + 1)
                           ^
------------------------------------------------------------

spacy/kb.pyx:97:28: 'PreshMap' is not a constant, variable or function identifier

Error compiling Cython file:
------------------------------------------------------------
...
        self._entry_index = PreshMap(nr_entities + 1)
        self._entries = entry_vec(nr_entities + 1)
        self._vectors_table = float_matrix(nr_entities + 1)

    def initialize_aliases(self, int64_t nr_aliases):
        self._alias_index = PreshMap(nr_aliases + 1)
                           ^
------------------------------------------------------------

spacy/kb.pyx:102:28: 'PreshMap' is not a constant, variable or function identifier
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/tmp/pip-build-szci55fo/spacy/setup.py", line 224, in <module>
    setup_package()
  File "/tmp/pip-build-szci55fo/spacy/setup.py", line 211, in setup_package
    ext_modules = cythonize(ext_modules, compiler_directives=COMPILER_DIRECTIVES)
  File "/usr/local/lib/python3.6/dist-packages/Cython/Build/Dependencies.py", line 1102, in cythonize
    cythonize_one(*args)
  File "/usr/local/lib/python3.6/dist-packages/Cython/Build/Dependencies.py", line 1225, in cythonize_one
    raise CompileError(None, pyx_file)
Cython.Compiler.Errors.CompileError: spacy/kb.pyx
Copied /tmp/pip-build-szci55fo/spacy/setup.cfg -> /tmp/pip-build-szci55fo/spacy/spacy/tests/package
Copied /tmp/pip-build-szci55fo/spacy/pyproject.toml -> /tmp/pip-build-szci55fo/spacy/spacy/tests/package
Cythonizing sources
Compiling spacy/training/example.pyx because it changed.
Compiling spacy/parts_of_speech.pyx because it changed.
Compiling spacy/strings.pyx because it changed.
Compiling spacy/lexeme.pyx because it changed.
Compiling spacy/vocab.pyx because it changed.
Compiling spacy/attrs.pyx because it changed.
Compiling spacy/kb.pyx because it changed.
Compiling spacy/ml/parser_model.pyx because it changed.
Compiling spacy/morphology.pyx because it changed.
Compiling spacy/pipeline/dep_parser.pyx because it changed.
Compiling spacy/pipeline/morphologizer.pyx because it changed.
Compiling spacy/pipeline/multitask.pyx because it changed.
Compiling spacy/pipeline/ner.pyx because it changed.
Compiling spacy/pipeline/pipe.pyx because it changed.
Compiling spacy/pipeline/trainable_pipe.pyx because it changed.
Compiling spacy/pipeline/sentencizer.pyx because it changed.
Compiling spacy/pipeline/senter.pyx because it changed.
Compiling spacy/pipeline/tagger.pyx because it changed.
Compiling spacy/pipeline/transition_parser.pyx because it changed.
Compiling spacy/pipeline/_parser_internals/arc_eager.pyx because it changed.
Compiling spacy/pipeline/_parser_internals/ner.pyx because it changed.
Compiling spacy/pipeline/_parser_internals/nonproj.pyx because it changed.
Compiling spacy/pipeline/_parser_internals/_state.pyx because it changed.
Compiling spacy/pipeline/_parser_internals/stateclass.pyx because it changed.
Compiling spacy/pipeline/_parser_internals/transition_system.pyx because it changed.
Compiling spacy/pipeline/_parser_internals/_beam_utils.pyx because it changed.
Compiling spacy/tokenizer.pyx because it changed.
Compiling spacy/training/align.pyx because it changed.
Compiling spacy/training/gold_io.pyx because it changed.
Compiling spacy/tokens/doc.pyx because it changed.
Compiling spacy/tokens/span.pyx because it changed.
Compiling spacy/tokens/token.pyx because it changed.
Compiling spacy/tokens/span_group.pyx because it changed.
Compiling spacy/tokens/graph.pyx because it changed.
Compiling spacy/tokens/morphanalysis.pyx because it changed.
Compiling spacy/tokens/_retokenize.pyx because it changed.
Compiling spacy/matcher/matcher.pyx because it changed.
Compiling spacy/matcher/phrasematcher.pyx because it changed.
Compiling spacy/matcher/dependencymatcher.pyx because it changed.
Compiling spacy/symbols.pyx because it changed.
Compiling spacy/vectors.pyx because it changed.
[ 1/41] Cythonizing spacy/attrs.pyx
[ 2/41] Cythonizing spacy/kb.pyx

----------------------------------------

Command “python setup.py egg_info” failed with error code 1 in /tmp/pip-build-szci55fo/spacy/
dan@Jetson-nano:~$

Hi,

The error complain about a missing library called Cython.
Please install it with the following command first:

$ sudo apt-get install python3-pip
$ pip3 install cython

Thanks.

Thank you for your advise but cython is already installed as below.

pip3 install cython

Requirement already satisfied: cython in /usr/local/lib/python3.6/dist-packages

Hi,

We found a similar issue in the spaCy forum:

Could you check the upgrade command if works for you first?

Thanks.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.