Update setup.py Handle Spacy installation
This commit is contained in:
12
setup.py
12
setup.py
@@ -1,4 +1,7 @@
|
|||||||
from setuptools import setup, find_packages
|
from setuptools import setup, find_packages
|
||||||
|
import os
|
||||||
|
import subprocess
|
||||||
|
from setuptools.command.install import install
|
||||||
|
|
||||||
# Read the requirements from requirements.txt
|
# Read the requirements from requirements.txt
|
||||||
with open("requirements.txt") as f:
|
with open("requirements.txt") as f:
|
||||||
@@ -10,6 +13,12 @@ requirements_without_transformers = [req for req in requirements if not req.star
|
|||||||
requirements_without_nltk = [req for req in requirements if not req.startswith("nltk")]
|
requirements_without_nltk = [req for req in requirements if not req.startswith("nltk")]
|
||||||
requirements_without_torch_transformers_nlkt = [req for req in requirements if not req.startswith("torch") and not req.startswith("transformers") and not req.startswith("nltk")]
|
requirements_without_torch_transformers_nlkt = [req for req in requirements if not req.startswith("torch") and not req.startswith("transformers") and not req.startswith("nltk")]
|
||||||
|
|
||||||
|
class CustomInstallCommand(install):
|
||||||
|
"""Customized setuptools install command to install spacy without dependencies."""
|
||||||
|
def run(self):
|
||||||
|
install.run(self)
|
||||||
|
subprocess.check_call([os.sys.executable, '-m', 'pip', 'install', 'spacy', '--no-deps'])
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name="Crawl4AI",
|
name="Crawl4AI",
|
||||||
version="0.2.0",
|
version="0.2.0",
|
||||||
@@ -27,6 +36,9 @@ setup(
|
|||||||
"colab": requirements_without_torch, # Exclude torch for Colab
|
"colab": requirements_without_torch, # Exclude torch for Colab
|
||||||
"crawl": requirements_without_torch_transformers_nlkt
|
"crawl": requirements_without_torch_transformers_nlkt
|
||||||
},
|
},
|
||||||
|
cmdclass={
|
||||||
|
'install': CustomInstallCommand,
|
||||||
|
},
|
||||||
entry_points={
|
entry_points={
|
||||||
'console_scripts': [
|
'console_scripts': [
|
||||||
'crawl4ai-download-models=crawl4ai.model_loader:main',
|
'crawl4ai-download-models=crawl4ai.model_loader:main',
|
||||||
|
|||||||
Reference in New Issue
Block a user