I try to install $ pip install zero-shot-re
however I got the error:
(biomedical-knowledge-graph-venv) C:\Users\User\Documents\GitHub\biomedical-knowledge-graph-nlp>pip install zero-shot-re
Collecting zero-shot-re
Using cached zero_shot_re-0.0.4-py3-none-any.whl (6.6 kB)
Collecting numpy==1.19.1 (from zero-shot-re)
Using cached numpy-1.19.1.zip (7.3 MB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... error
error: subprocess-exited-with-error
× Preparing metadata (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [134 lines of output]
Running from numpy source directory.
<string>:470: UserWarning: Unrecognized setuptools command, proceeding with generating Cython sources and expanding templates
C:\Users\User\AppData\Local\Temp\pip-install-axs3irod\numpy_9882ca35e3334eb09c9f2615a114ebea\tools\cythonize.py:73: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
required_version = LooseVersion('0.29.21')
C:\Users\User\AppData\Local\Temp\pip-install-axs3irod\numpy_9882ca35e3334eb09c9f2615a114ebea\tools\cythonize.py:75: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
if LooseVersion(cython_version) < required_version:
performance hint: _common.pyx:275:19: Exception check will always require the GIL to be acquired. Possible solutions:
1. Declare the function as 'noexcept' if you control the definition and you're sure you don't want the function to raise exceptions.
performance hint: _common.pyx:299:19: Exception check will always require the GIL to be acquired. Possible solutions:
1. Declare the function as 'noexcept' if you control the definition and you're sure you don't want the function to raise exceptions.
performance hint: _common.pyx:322:50: Exception check will always require the GIL to be acquired. Possible solutions:
1. Declare the function as 'noexcept' if you control the definition and you're sure you don't want the function to raise exceptions.
performance hint: _common.pyx:426:31: Exception check will always require the GIL to be acquired. Possible solutions:
1. Declare the function as 'noexcept' if you control the definition and you're sure you don't want the function to raise exceptions.
performance hint: _common.pyx:465:31: Exception check will always require the GIL to be acquired. Possible solutions:
1. Declare the function as 'noexcept' if you control the definition and you're sure you don't want the function to raise exceptions.
performance hint: _common.pyx:509:31: Exception check will always require the GIL to be acquired. Possible solutions:
1. Declare the function as 'noexcept' if you control the definition and you're sure you don't want the function to raise exceptions.
performance hint: _common.pyx:592:36: Exception check will always require the GIL to be acquired. Possible solutions:
1. Declare the function as 'noexcept' if you control the definition and you're sure you don't want the function to raise exceptions.
performance hint: _common.pyx:596:36: Exception check will always require the GIL to be acquired. Possible solutions:
1. Declare the function as 'noexcept' if you control the definition and you're sure you don't want the function to raise exceptions.
performance hint: _common.pyx:600:36: Exception check will always require the GIL to be acquired. Possible solutions:
1. Declare the function as 'noexcept' if you control the definition and you're sure you don't want the function to raise exceptions.
performance hint: _common.pyx:604:36: Exception check will always require the GIL to be acquired. Possible solutions:
1. Declare the function as 'noexcept' if you control the definition and you're sure you don't want the function to raise exceptions.
performance hint: _common.pyx:638:31: Exception check will always require the GIL to be acquired. Possible solutions:
1. Declare the function as 'noexcept' if you control the definition and you're sure you don't want the function to raise exceptions.
performance hint: _common.pyx:675:31: Exception check will always require the GIL to be acquired. Possible solutions:
1. Declare the function as 'noexcept' if you control the definition and you're sure you don't want the function to raise exceptions.
performance hint: _common.pyx:712:63: Exception check will always require the GIL to be acquired. Possible solutions:
1. Declare the function as 'noexcept' if you control the definition and you're sure you don't want the function to raise exceptions.
performance hint: _common.pyx:754:31: Exception check will always require the GIL to be acquired. Possible solutions:
1. Declare the function as 'noexcept' if you control the definition and you're sure you don't want the function to raise exceptions.
performance hint: _common.pyx:785:31: Exception check will always require the GIL to be acquired. Possible solutions:
1. Declare the function as 'noexcept' if you control the definition and you're sure you don't want the function to raise exceptions.
performance hint: _common.pyx:903:40: Exception check will always require the GIL to be acquired. Possible solutions:
1. Declare the function as 'noexcept' if you control the definition and you're sure you don't want the function to raise exceptions.
performance hint: _common.pyx:907:40: Exception check will always require the GIL to be acquired. Possible solutions:
1. Declare the function as 'noexcept' if you control the definition and you're sure you don't want the function to raise exceptions.
performance hint: _common.pyx:911:41: Exception check will always require the GIL to be acquired. Possible solutions:
1. Declare the function as 'noexcept' if you control the definition and you're sure you don't want the function to raise exceptions.
performance hint: _common.pyx:916:40: Exception check will always require the GIL to be acquired. Possible solutions:
1. Declare the function as 'noexcept' if you control the definition and you're sure you don't want the function to raise exceptions.
performance hint: _common.pyx:920:41: Exception check will always require the GIL to be acquired. Possible solutions:
1. Declare the function as 'noexcept' if you control the definition and you're sure you don't want the function to raise exceptions.
performance hint: _common.pyx:924:38: Exception check will always require the GIL to be acquired. Possible solutions:
1. Declare the function as 'noexcept' if you control the definition and you're sure you don't want the function to raise exceptions.
performance hint: _common.pyx:960:31: Exception check will always require the GIL to be acquired. Possible solutions:
1. Declare the function as 'noexcept' if you control the definition and you're sure you don't want the function to raise exceptions.
performance hint: _common.pyx:1002:32: Exception check will always require the GIL to be acquired. Possible solutions:
1. Declare the function as 'noexcept' if you control the definition and you're sure you don't want the function to raise exceptions.
performance hint: _generator.pyx:707:41: Exception check will always require the GIL to be acquired. Possible solutions:
1. Declare the function as 'noexcept' if you control the definition and you're sure you don't want the function to raise exceptions.
2. Use an 'int' return type on the function to allow an error code to be returned.
performance hint: _generator.pyx:736:45: Exception check will always require the GIL to be acquired. Possible solutions:
1. Declare the function as 'noexcept' if you control the definition and you're sure you don't want the function to raise exceptions.
2. Use an 'int' return type on the function to allow an error code to be returned.
Error compiling Cython file:
------------------------------------------------------------
...
for i in range(1, RK_STATE_LEN):
self.rng_state.key[i] = val[i]
self.rng_state.pos = i
self._bitgen.state = &self.rng_state
self._bitgen.next_uint64 = &mt19937_uint64
^
------------------------------------------------------------
_mt19937.pyx:138:35: Cannot assign type 'uint64_t (*)(void *) except? -1 nogil' to 'uint64_t (*)(void *) noexcept nogil'. Exception values are incompatible. Suggest adding 'noexcept' to type 'uint64_t (void *) except? -1 nogil'.
Processing numpy/random\_bounded_integers.pxd.in
Processing numpy/random\bit_generator.pyx
Processing numpy/random\mtrand.pyx
Processing numpy/random\_bounded_integers.pyx.in
Processing numpy/random\_common.pyx
Processing numpy/random\_generator.pyx
Processing numpy/random\_mt19937.pyx
Traceback (most recent call last):
File "C:\Users\User\AppData\Local\Temp\pip-install-axs3irod\numpy_9882ca35e3334eb09c9f2615a114ebea\tools\cythonize.py", line 235, in <module>
main()
File "C:\Users\User\AppData\Local\Temp\pip-install-axs3irod\numpy_9882ca35e3334eb09c9f2615a114ebea\tools\cythonize.py", line 231, in main
find_process_files(root_dir)
File "C:\Users\User\AppData\Local\Temp\pip-install-axs3irod\numpy_9882ca35e3334eb09c9f2615a114ebea\tools\cythonize.py", line 222, in find_process_files
process(root_dir, fromfile, tofile, function, hash_db)
File "C:\Users\User\AppData\Local\Temp\pip-install-axs3irod\numpy_9882ca35e3334eb09c9f2615a114ebea\tools\cythonize.py", line 188, in process
processor_function(fromfile, tofile)
File "C:\Users\User\AppData\Local\Temp\pip-install-axs3irod\numpy_9882ca35e3334eb09c9f2615a114ebea\tools\cythonize.py", line 77, in process_pyx
subprocess.check_call(
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\lib\subprocess.py", line 369, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['C:\\Users\\User\\Documents\\GitHub\\biomedical-knowledge-graph-nlp\\biomedical-knowledge-graph-venv\\Scripts\\python.exe', '-m', 'cython', '-3', '--fast-fail', '-o', '_mt19937.c', '_mt19937.pyx']' returned non-zero exit status 1.
Cythonizing sources
Traceback (most recent call last):
File "C:\Users\User\Documents\GitHub\biomedical-knowledge-graph-nlp\biomedical-knowledge-graph-venv\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 353, in <module>
main()
File "C:\Users\User\Documents\GitHub\biomedical-knowledge-graph-nlp\biomedical-knowledge-graph-venv\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 335, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "C:\Users\User\Documents\GitHub\biomedical-knowledge-graph-nlp\biomedical-knowledge-graph-venv\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 149, in prepare_metadata_for_build_wheel
return hook(metadata_directory, config_settings)
File "C:\Users\User\AppData\Local\Temp\pip-build-env-k0s9f8gt\overlay\Lib\site-packages\setuptools\build_meta.py", line 396, in prepare_metadata_for_build_wheel
self.run_setup()
File "C:\Users\User\AppData\Local\Temp\pip-build-env-k0s9f8gt\overlay\Lib\site-packages\setuptools\build_meta.py", line 507, in run_setup
super(_BuildMetaLegacyBackend, self).run_setup(setup_script=setup_script)
File "C:\Users\User\AppData\Local\Temp\pip-build-env-k0s9f8gt\overlay\Lib\site-packages\setuptools\build_meta.py", line 341, in run_setup
exec(code, locals())
File "<string>", line 499, in <module>
File "<string>", line 479, in setup_package
File "<string>", line 274, in generate_cython
RuntimeError: Running cythonize failed!
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed
× Encountered error while generating package metadata.
╰─> See above for output.
note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
I want to install zero_shot_re
to run my code in python:
from transformers import AutoTokenizer
from zero_shot_re import RelTaggerModel, RelationExtractor
model = RelTaggerModel.from_pretrained("fractalego/fewrel-zero-shot")
tokenizer = AutoTokenizer.from_pretrained("bert-large-uncased-whole-word-masking-finetuned-squad")
relations = ['associated', 'interacts']
extractor = RelationExtractor(model, tokenizer, relations)
This code use for relation extraction, and I am trying to run this google colab notebook. text
Anybody can help me, thanks alot.
I tried:
pip install --upgrade pip
pip install --upgrade cython
pip install --upgrade setuptools wheel
pip install --no-cache-dir -v numpy==1.19.1
However I still stuck with this problem.
Actually, the problem comes from the numpy version and the zero-shot-re package.
Since I use Python 3.10 with the default numpy version and the zero-shot-re package does not fit.
Then I used Python 3.7 and installed numpy==1.19.1, this numpy version is adequate with the python version and the zero-shot-re package.