ripe-battery-94204
10/11/2023, 8:51 AMgit+
specifying it like this: _`spacy[nb_core_news_lg]==3.60`_ and putting it into my BUILD
file somehow. I’m having a hard time including both the package and the original space dependency.
Has anyone faced this problem before? Could someone please point in the right direction for how to solve this? Thanks a lot! 💫broad-processor-92400
10/11/2023, 9:27 AMripe-battery-94204
10/11/2023, 9:50 AMEngine traceback:
in `package` goal
ValueError: Invalid requirement '<https://github.com/explosion/spacy-models/releases/download/nb_core_news_lg-3.6.0/nb_core_news_lg-3.6.0-py3-none-any.whl>' in requirements.txt at line 28: Parse error at "'://githu'": Expected string_end
If I try
nb_core_news_lg @ git+<https://github.com/explosion/spacy-models/releases/download/nb_core_news_lg-3.6.0/nb_core_news_lg-3.6.0-py3-none-any.whl#sha256=b0d83b282d68300c8d3fb00abd3e9403a3c71070ce9bc7ecec67e2fe7f9b0198>
I get
OSError: [E050] Can't find model 'nb_core_news_lg'. It doesn't seem to be a Python package or a valid path to a data directory.
ripe-battery-94204
10/11/2023, 9:52 AMnb_core_news_lg
as a requirement to my build file:
python_requirement(
name = "nb_core_news_lg",
requirements = ["git+<https://github.com/explosion/spacy-models/releases/download/nb_core_news_lg-3.6.0/nb_core_news_lg-3.6.0-py3-none-any.whl#sha256=b0d83b282d68300c8d3fb00abd3e9403a3c71070ce9bc7ecec67e2fe7f9b0198>"]
)
but I still get a parsing error
InvalidTargetException: BUILD:17: Invalid requirement 'git+<https://github.com/explosion/spacy-models/releases/download/nb_core_news_lg-3.6.0/nb_core_news_lg-3.6.0-py3-none-any.whl#sha256=b0d83b282d68300c8d3fb00abd3e9403a3c71070ce9bc7ecec67e2fe7f9b0198>' in the 'requirements' field for the target //:nb_core_news_lg: Parse error at "'+https:/'": Expected string_end
happy-kitchen-89482
10/11/2023, 3:40 PMOSError: [E050] Can't find model 'nb_core_news_lg'. It doesn't seem to be a Python package or a valid path to a data directory.
happy-kitchen-89482
10/11/2023, 3:48 PM$ pip install 'nb_core_news_lg@git+<https://github.com/explosion/spacy-models/releases/download/nb_core_news_lg-3.6.0/nb_core_news_lg-3.6.0-py3-none-any.whl#sha256=b0d83b282d68300c8d3fb00abd3e9403a3c71070ce9bc7ecec67e2fe7f9b0198>'
...
TypeError: stat: path should be string, bytes, os.PathLike or integer, not NoneType
happy-kitchen-89482
10/11/2023, 3:48 PMhappy-kitchen-89482
10/11/2023, 3:49 PMpip install '<https://github.com/explosion/spacy-models/releases/download/nb_core_news_lg-3.6.0/nb_core_news_lg-3.6.0-py3-none-any.whl>'
worksenough-analyst-54434
10/11/2023, 4:11 PMenough-analyst-54434
10/11/2023, 4:12 PMenough-analyst-54434
10/11/2023, 4:52 PM$ pex "nb-core-news-lg @ <https://github.com/explosion/spacy-models/releases/download/nb_core_news_lg-3.6.0/nb_core_news_lg-3.6.0-py3-none-any.whl|https://github.com/explosion/spacy-models/releases/download/nb_core_news_lg-3.6.0/nb_core_news_lg-3.6.0-py3-none-any.whl>"
Python 3.9.5 (default, Nov 23 2021, 15:27:38)
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> import nb_core_news_lg
>>> nb_core_news_lg.__file__
'/home/jsirois/.pex/installed_wheels/b0d83b282d68300c8d3fb00abd3e9403a3c71070ce9bc7ecec67e2fe7f9b0198/nb_core_news_lg-3.6.0-py3-none-any.whl/nb_core_news_lg/__init__.py'
>>>
enough-analyst-54434
10/11/2023, 4:53 PMhappy-kitchen-89482
10/11/2023, 6:04 PMnb_core_news_lg@https://github.com/explosion/spacy-models/releases/download/nb_core_news_lg-3.6.0/nb_core_news_lg-3.6.0-py3-none-any.whl
in your requirements.txt should work finehappy-kitchen-89482
10/11/2023, 6:04 PMripe-battery-94204
10/12/2023, 11:24 AMripe-battery-94204
10/12/2023, 11:30 AMspacy.load("nb_core_news_lg")
.
For anyone facing the same difficulties, I ended up not putting the module in the requirements.txt, but I declared it in the BUILD file as such
python_requirement(
name = "nb_core_news_sm",
requirements = [
"nb_core_news_sm@https://github.com/explosion/spacy-models/releases/download/nb_core_news_sm-3.6.0/nb_core_news_sm-3.6.0-py3-none-any.whl",
],
)
python_requirement(
name = "spacy",
requirements = [
"spacy<3.7.0"
],
dependencies = [
# "//:de_core_news_sm",
"//:nb_core_news_sm"
]
)
This allowed me to load the language module using SpaCy's load mechanism.
I have a feeling that this won't scale as it will always need to load all language modules declared here, but it will have to do for now.happy-kitchen-89482
10/12/2023, 8:32 PMpython_requirement
is entirely equivalent to having the dep in requirements.txt
(there is an implicit python_requirement
created for each entry in requirements.txt
).happy-kitchen-89482
10/12/2023, 8:33 PMhappy-kitchen-89482
10/12/2023, 8:33 PM3rdparty/python#nb_core_news_lg
or wherever your requirements.txt liveshappy-kitchen-89482
10/12/2023, 8:34 PMimport
statement.happy-kitchen-89482
10/12/2023, 8:34 PMspacy.load("nb_core_news_lg")
and Pants doesn't know about those.happy-kitchen-89482
10/12/2023, 8:34 PM