Commit aea75005 authored by Rinat Shigapov's avatar Rinat Shigapov Committed by Kai Chen
Browse files

fix dependencies (#146)

* fix requirements

* don't reuse build dependencies between different envs

* minor fix

* change the order of opencv and opencv-headless
parent b480ee47
.git
.gitignore
*.egg-info
.eggs/
.mypy-cache
pip-wheel-metadata
...@@ -8,7 +8,7 @@ before_install: ...@@ -8,7 +8,7 @@ before_install:
- sudo apt-get install -y ffmpeg - sudo apt-get install -y ffmpeg
install: install:
- pip install Cython opencv-python pyyaml codecov flake8 yapf isort - rm -rf .eggs && pip install -e . codecov flake8 yapf isort
cache: cache:
pip: true pip: true
......
FROM python:3.7
WORKDIR /mmcv
COPY . /mmcv
RUN pip install -e .
...@@ -48,3 +48,7 @@ or install from source ...@@ -48,3 +48,7 @@ or install from source
git clone https://github.com/open-mmlab/mmcv.git git clone https://github.com/open-mmlab/mmcv.git
cd mmcv cd mmcv
pip install -e . pip install -e .
Note: If you would like to use :code:`opencv-python-headless` instead of :code:`opencv-python`,
e.g., in a minimum container environment or servers without GUI,
you can first install it before installing MMCV to skip the installation of :code:`opencv-python`.
\ No newline at end of file
import platform import platform
import re
import sys import sys
from io import open # for Python 2 (identical to builtin in Python 3) from io import open # for Python 2 (identical to builtin in Python 3)
from setuptools import Extension, find_packages, setup, dist from setuptools import Extension, dist, find_packages, setup
from pkg_resources import DistributionNotFound, get_distribution
dist.Distribution().fetch_build_eggs(['Cython', 'numpy>=1.11.1']) dist.Distribution().fetch_build_eggs(['Cython', 'numpy>=1.11.1'])
import numpy # noqa: E402 import numpy # noqa: E402
from Cython.Distutils import build_ext # noqa: E402 from Cython.Distutils import build_ext # noqa: E402
def choose_requirement(primary, secondary):
"""If some version of primary requirement installed, return primary,
else return secondary.
"""
try:
name = re.split(r'[!<>=]', primary)[0]
get_distribution(name)
except DistributionNotFound:
return secondary
return str(primary)
install_requires = [ install_requires = [
'numpy>=1.11.1', 'pyyaml', 'six', 'addict', 'requests', 'opencv-python', 'numpy>=1.11.1',
'Cython' 'pyyaml',
'six',
'addict',
'requests',
] ]
# If first not installed install second package
CHOOSE_INSTALL_REQUIRES = [('opencv-python-headless>=3', 'opencv-python>=3')]
for main, secondary in CHOOSE_INSTALL_REQUIRES:
install_requires.append(choose_requirement(main, secondary))
if sys.version_info < (3, 3): if sys.version_info < (3, 3):
install_requires.append('backports.shutil_get_terminal_size') install_requires.append('backports.shutil_get_terminal_size')
if sys.version_info < (3, 4): if sys.version_info < (3, 4):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment