Skip to content

sofind installs as a Namespace package #26

@jaejoonk

Description

@jaejoonk

Behavior reproducible on a clean Python 3.11 install (as well as 3.12) as well as including --no-build-isolation (or not) to the pip install command:

(sofind) [jaejoonk@tri-login02 ~]$ python3
Python 3.11.4 (main, Nov  4 2023, 03:43:13) [GCC 12.3.1 20230526] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sofind
>>> from sofind import DataModel
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: cannot import name 'DataModel' from 'sofind' (unknown location)
>>> print(sofind)
<module 'sofind' (<_frozen_importlib_external.NamespaceLoader object at 0x7fda42f98c90>)>

sofind.DataModel is unable to be found even though other sub-modules are:

>>> from sofind import products
>>> products
<module 'sofind.products' from '/home/jaejoonk/modules/sofind/sofind/products/__init__.py'>
>>> from sofind import DataModel
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: cannot import name 'DataModel' from 'sofind' (unknown location)

The issue is circumvented by adding the path to the sofind module's root directory to the user's PYTHONPATH.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions