Skip to content

Local builds are not "stable"/frozen? #651

@larshinueber

Description

@larshinueber

Describe the issue:

To preface: I am not sure if this is a bug or the intended behavior. Not tagging Alfonso on purpose but will follow up once time permits :)

I'm trying to reuse an environment I had build some time (~half a year) ago, but I run into the following error:

Traceback (most recent call last):
  File "/home/lars/miniconda3/envs/thesis-10/lib/python3.11/site-packages/tudatpy/estimation/observations/__init__.py", line 1, in <module>
    from tudatpy._deprecation import property_deprecation
ModuleNotFoundError: No module named 'tudatpy._deprecation'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/lars/repos/master-thesis/scripts/ema/ema_trajectory.py", line 3, in <module>
    from tudatpy.astro.time_representation import DateTime
  File "/home/lars/miniconda3/envs/thesis-10/lib/python3.11/site-packages/tudatpy/astro/__init__.py", line 1, in <module>
    from . import (
  File "/home/lars/miniconda3/envs/thesis-10/lib/python3.11/site-packages/tudatpy/astro/element_conversion/__init__.py", line 1, in <module>
    from tudatpy.kernel.astro.element_conversion import *
ImportError: initialization failed

which is (I believe) similar to what @jo11he encountered in #636.
In my case however, uninstall and re-installing does not fix the issue, because the build I'm trying to use was built before the ancillary_settings spelling was fixed:

Traceback (most recent call last):
  File "/home/lars/miniconda3/envs/thesis-10/lib/python3.11/site-packages/tudatpy/estimation/observations/__init__.py", line 4, in <module>
    SingleObservationSet.ancilliary_settings = property_deprecation("SingleObservationSet.ancilliary_settings", "SingleObservationSet.ancillary_settings")(SingleObservationSet.ancillary_settings)
                                                                                                                                                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: type object 'tudatpy.kernel.estimation.observations.SingleObser' has no attribute 'ancillary_settings'. Did you mean: 'ancilliary_settings'?

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/lars/repos/master-thesis/scripts/ema/ema_trajectory.py", line 3, in <module>
    from tudatpy.astro.time_representation import DateTime
  File "/home/lars/miniconda3/envs/thesis-10/lib/python3.11/site-packages/tudatpy/astro/__init__.py", line 1, in <module>
    from . import (
  File "/home/lars/miniconda3/envs/thesis-10/lib/python3.11/site-packages/tudatpy/astro/element_conversion/__init__.py", line 1, in <module>
    from tudatpy.kernel.astro.element_conversion import *
ImportError: initialization failed

I believe that the root cause of this is that the __init__.py files are sym-linked to the tudatpy/src dir, instead of the BUILD_DIR/src path:

tudatpy/install.py

Lines 256 to 262 in b89b3a3

self.link_content(
self.base_tudatpy / "src/tudatpy",
self.pylib_dir / "tudatpy",
[".py", ".typed"],
recursive=True,
_skip=["__pycache__"],
)

Changing self.base_tudatpy / "src/tudatpy" to self.build_dir / "src/tudatpy" seems to fix the issue, but I would like to confirm with Alfonso before committing.

How to reproduce the issue:

The following should reproduce the issue:

Checkout an old tudatpy version:

git checkout v1.0.0.dev10

dev10 is arbitrary, but should be before #581 was fixed.
Build and install tudatpy:

python build.py -j 4
python install.py -e

This should now work fine, e.g. running

from tudatpy.astro.time_representation import DateTime

print(DateTime(2000, 1, 1).to_epoch())

prints 0.0.

Check out a current tudatpy version:

git checkout v1.0.0.dev49

this should be after the change of deprecation functionality in #636.

Running the same simple commands now prints:

Traceback (most recent call last):
  File "/home/lars/miniconda3/envs/thesis-10/lib/python3.11/site-packages/tudatpy/estimation/observations/__init__.py", line 1, in <module>
    from tudatpy._deprecation import property_deprecation
ModuleNotFoundError: No module named 'tudatpy._deprecation'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/lars/repos/master-thesis/scripts/ema/ema_trajectory.py", line 3, in <module>
    from tudatpy.astro.time_representation import DateTime
  File "/home/lars/miniconda3/envs/thesis-10/lib/python3.11/site-packages/tudatpy/astro/__init__.py", line 1, in <module>
    from . import (
  File "/home/lars/miniconda3/envs/thesis-10/lib/python3.11/site-packages/tudatpy/astro/element_conversion/__init__.py", line 1, in <module>
    from tudatpy.kernel.astro.element_conversion import *
ImportError: initialization failed

Uninstalling and reinstalling the same build:

python uninstall.py
python install.py -e

then gives:

Traceback (most recent call last):
  File "/home/lars/miniconda3/envs/thesis-10/lib/python3.11/site-packages/tudatpy/estimation/observations/__init__.py", line 4, in <module>
    SingleObservationSet.ancilliary_settings = property_deprecation("SingleObservationSet.ancilliary_settings", "SingleObservationSet.ancillary_settings")(SingleObservationSet.ancillary_settings)
                                                                                                                                                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: type object 'tudatpy.kernel.estimation.observations.SingleObser' has no attribute 'ancillary_settings'. Did you mean: 'ancilliary_settings'?

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/lars/repos/master-thesis/scripts/ema/ema_trajectory.py", line 3, in <module>
    from tudatpy.astro.time_representation import DateTime
  File "/home/lars/miniconda3/envs/thesis-10/lib/python3.11/site-packages/tudatpy/astro/__init__.py", line 1, in <module>
    from . import (
  File "/home/lars/miniconda3/envs/thesis-10/lib/python3.11/site-packages/tudatpy/astro/element_conversion/__init__.py", line 1, in <module>
    from tudatpy.kernel.astro.element_conversion import *
ImportError: initialization failed

OS and Python version:

Should not matter, but python v3.11 on Ubuntu through WSL

Expected behavior:

I would expect that a local build installed in an environment is completely independent of the current state of the tudatpy repository. In my example, I have the thesis-10 conda environment, which I build with the intention of being a "stable" tudatpy version for my thesis, that lies in a separate directory of my tudatpy dev environment. So no matter which state of tudatpy I checkout in the tudatpy repo, the thesis-10 conda environment should always remain working and not be affected by this.

Current behavior:

No response

Additional context:

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bugProblem that affects expected behaviortype: infrastructureChanges to the build system or the repository setup

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions