openai / deeptype

Code for the paper "DeepType: Multilingual Entity Linking by Neural Type System Evolution"
https://arxiv.org/abs/1802.01021
Other
651 stars 147 forks source link

pip install wikidata_linker_utils_src error on MacOS High Sierra #30

Open shunyaorad opened 6 years ago

shunyaorad commented 6 years ago

I'm having trouble installing wikidata_linker_utils_src/ on mac High Sierra. The error message is

/private/var/folders/pg/2c5pcvy10pgbqdj931yyr82r0000gn/T/pip-auqg6k2b-build/src/cython/wikidata_linker_utils/fast_disambiguate.cpp:585:10: fatal error: 'unordered_set' file not found

include

         ^~~~~~~~~~~~~~~
1 error generated.
error: command 'gcc' failed with exit status 1`

Python version is 3.6.5 and Anaconda 3-5.0.0.

I saw seemingly relevant problem on https://stackoverflow.com/questions/42030598/mac-c-compiler-not-finding-tr1-unordered-map and tried to modify "extra_compile_args" in setup.py for wikidata_linker_utils_src. by adding '-stdlib=libstdc++'. It did not work. Also, I tried to change the compiler to clang++ by adding os.environ["CC"] = "/usr/bin/clang++" at the beginning of setup.py, but also got the same error message.

I added '-mmacosx-version-min=10.13' to the extra_compile_args to the original setup.py, and now I see following error for string(...) functions.

src/cython/wikidata_linker_utils/successor_mask.pyx:1052:34: ambiguous overloaded method

Error compiling Cython file:
------------------------------------------------------------
...
                        if len(source) > 0:
                            yield source
                    else:
                        num_missing += 1
                        with nogil:
                            missing.push_back(pair[string, string](anchor_string, string(target)))

Hope to get some help in this matter. Thank you!

lucolivi commented 6 years ago

Have you fixed it? I had the same problem using Cython 0.28 using fedora. I rolled back to Cython version 0.26 and it did fine.

tantikristanti commented 5 years ago

Hello everyone,

I found the same problem when installing wikidata_linker_utils_src/ on macOS High Sierra.

As explained in the installation step, the first step is the requirements installation. For this step, the installation process couldn't be finished smoothly due to the tensorflow version. But the problem was resolved after I used this command:

$ python3 -m pip install - upgrade https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.12.0-py3-none-any.whl

As mentioned in this issue, I got these errors

tree = Parsing.p_module(s, pxd, full_module_name)

    Error compiling Cython file:
    ------------------------------------------------------------
    ...
                        continue
                    with gil:
                        decoded = source.decode("utf-8")
                        decoded = (decoded[0].upper() + decoded[1:]).encode("utf-8")
                        uppercased_in_python = decoded
                    self._redirections[string(uppercased_in_python)] = string(dest)
                                                                            ^
    ------------------------------------------------------------

    src/cython/wikidata_linker_utils/successor_mask.pyx:70:73: ambiguous overloaded method

    Error compiling Cython file:
    ------------------------------------------------------------
    ...
                return_code = sscanf(line, "%256[^\n\t]\t%256[^\n\t]\t%256[^\n\t]", &context, &anchor, &target)
                if return_code != 3:
                    num_broken += 1
                    continue

                anchor_string = string(anchor)
                                     ^
    ------------------------------------------------------------

    src/cython/wikidata_linker_utils/successor_mask.pyx:1052:34: ambiguous overloaded method

    Error compiling Cython file:
    ------------------------------------------------------------
    ...
                            if len(source) > 0:
                                yield source
                        else:
                            num_missing += 1
                            with nogil:
                                missing.push_back(pair[string, string](anchor_string, string(target)))
                                                                                           ^
    ------------------------------------------------------------

    src/cython/wikidata_linker_utils/successor_mask.pyx:1075:88: ambiguous overloaded method
    building 'wikidata_linker_utils.successor_mask' extension

I hope someone can help me.

Many thanks.

tantikristanti commented 5 years ago

Hello again,

I have tried to overcome the installation error that I found yesterday. With these requirements bellow, the installation process can be done smoothly (btw, I use macOS High Sierra). The Cython 0.26 didn't work with me in this case:

cssselect>=0.9.1
epub-conversion>=1.0.7
lxml>=3.4.3
msgpack-python>=0.4.8
numpy>=1.11.1
pandas>=0.15.2
progressbar2>=3.6.0
requests>=2.6.0
tensorflow==1.8.0
wikipedia-ner>=0.0.23
ciseau>=1.0.1
Cython==0.27.3
marisa-trie>=0.7.2