Skip to content

Commit 0ed9584

Browse files
authored
Update suggestion command for building cornac from source (#645)
* Update suggestion command for building cornac from source * Fix install command using escape dependency with specified version
1 parent 68f4f71 commit 0ed9584

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

setup.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,18 @@
3030
import shutil
3131
from setuptools import Extension, Command, setup, find_packages
3232

33+
34+
INSTALL_REQUIRES = ["numpy<2.0.0", "scipy<=1.13.1", "tqdm", "powerlaw"]
35+
3336
try:
3437
from Cython.Distutils import build_ext
3538
import numpy as np
3639
import scipy
3740
except ImportError:
41+
escape_dependency_version = lambda x: '"{}"'.format(x) if "<" in x or "=" in x or ">" in x else x
3842
exit(
3943
"We need some dependencies to build Cornac.\n"
40-
+ "Run: pip3 install Cython numpy scipy"
44+
+ "Run: pip3 install Cython {}".format(" ".join([escape_dependency_version(x) for x in INSTALL_REQUIRES]))
4145
)
4246

4347

@@ -351,7 +355,7 @@ def run(self):
351355
"recommendation",
352356
],
353357
ext_modules=extensions,
354-
install_requires=["numpy<2.0.0", "scipy<=1.13.1", "tqdm", "powerlaw"],
358+
install_requires=INSTALL_REQUIRES,
355359
extras_require={"tests": ["pytest", "pytest-pep8", "pytest-xdist", "pytest-cov", "Flask"]},
356360
cmdclass=cmdclass,
357361
packages=find_packages(),

0 commit comments

Comments
 (0)