Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Register
  • Sign in
  • otbtf otbtf
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 7
    • Issues 7
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 1
    • Merge requests 1
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Cresson Remi
  • otbtfotbtf
  • Issues
  • #28
Closed
Open
Issue created Jun 24, 2022 by Narcon Nicolas@nicolas.narconDeveloper

Cannot use otbtf TFrecords without gdal

When on a system without gdal, the following fails:

from otbtf.tfrecords import TFRecords
# import otbtf.tfrecords.TFRecords  # this also fails

Rasing:

raceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/linkhome/rech/gentet01/ube33sw/otbtf/otbtf/__init__.py", line 24, in <module>
    from otbtf.dataset import Buffer, PatchesReaderBase, PatchesImagesReader, IteratorBase, RandomIterator, Dataset, \
  File "/linkhome/rech/gentet01/ube33sw/otbtf/otbtf/dataset.py", line 30, in <module>
    from otbtf.utils import read_as_np_arr, gdal_open
  File "/linkhome/rech/gentet01/ube33sw/otbtf/otbtf/utils.py", line 23, in <module>
    from osgeo import gdal
ModuleNotFoundError: No module named 'osgeo'

This is because in __init__.py, there is some pieces of code that rely on gdal:

from utils import read_as_np_arr, gdal_open
from otbtf.dataset import ...

To fix this issue, we would need an empty init.py. However, there is a drawback: all functions/classes would be split depending on their file (dataset, utils or tfrecords). Thus, backward comp would break, because stuff like import otbtf.Dataset would move to otbtf.dataset.Dataset

Edited Jun 24, 2022 by Narcon Nicolas
Assignee
Assign to
Time tracking