Python3: DistributionNotFound: The 'dijitso' distribution was not found and is required by the application

Issue #27 wontfix
Nico Schlömer created an issue

Importing dijitso from Python 3 results in the error.

DistributionNotFound: The 'dijitso' distribution was not found and is required by the application

This is caused by the recent change in version setting (get_distribution).

(Tentatively assigning Garth.)

Comments (7)

  1. Nico Schlömer reporter

    What works for me in having a single source of truth of the version:

    • Create a file package/__about__.py with all the meta info,
    • import the interesting bits from __init__.py, and
    • Read the data from setup.py with
    base_dir = os.path.abspath(os.path.dirname(__file__))
    about = {}
    with open(os.path.join(base_dir, '<package_name>', '__about__.py')) as f:
        exec(f.read(), about)
    

    See https://packaging.python.org/single_source_version/.

  2. Johannes Ring

    I can't reproduce this either on my laptop or in the ubuntu:17.04 Docker image using the following commands:

    apt-get update && apt-get install -y python3-pip python3-numpy python3-six python3-mpi4py git
    pip3 install git+https://bitbucket.org/fenics-project/dijitso.git@master#egg=dijitso
    python3 -c "import dijitso"
    
  3. Johannes Ring

    Ok, so this error occurs when you import dijitso from the source directory without any installation, like this:

    git clone https://bitbucket.org/fenics-project/dijitso.git
    cd dijitso
    python3 -c "import dijitso"
    

    Same for Python 2.

  4. Nico Schlömer reporter

    This will also cause problems when building the Debian package (which is how I found the issue); see here for reference.

  5. Johannes Ring

    That is only when running the tests, which has never worked when building the Debian package anyway since it did not use pytest. The tests can be disabled by setting export PYBUILD_DISABLE=test in debian/rules, which I have already done for other packages like FFC.

    I am not sure how important it is to support importing from the source directory, so a suggestion is to mark this as wontfix unless someone volunteers to fix this. The fix will also need to be applied to FIAT, FFC, Instant and UFL.

  6. Log in to comment