Skip to content

Commit

Permalink
[Fix] Fix numpy bug on Colab (#2505)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ben-Louis authored Jul 4, 2023
1 parent 39d58da commit c6424b8
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@
import warnings
from setuptools import find_packages, setup

try:
import google.colab # noqa
ON_COLAB = True
except ImportError:
ON_COLAB = False


def readme():
with open('README.md', encoding='utf-8') as f:
Expand Down Expand Up @@ -78,6 +84,16 @@ def parse_line(line):
else:
version = rest # NOQA
info['version'] = (op, version)

if ON_COLAB and info['package'] == 'xtcocotools':
# Due to an incompatibility between the Colab platform and the
# pre-built xtcocotools PyPI package, it is necessary to
# compile xtcocotools from source on Colab.
info = dict(
line=info['line'],
package='xtcocotools@'
'git+https://github.com/jin-s13/xtcocoapi')

yield info

def parse_require_file(fpath):
Expand Down

0 comments on commit c6424b8

Please sign in to comment.