Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows OS not supported? #52

Open
internetscooter opened this issue Nov 21, 2024 · 18 comments
Open

Windows OS not supported? #52

internetscooter opened this issue Nov 21, 2024 · 18 comments
Labels
bug Something isn't working triaged This issue or pull request was triaged

Comments

@internetscooter
Copy link

Describe the bug

Hi TBP,

I think Windows OS is not supported due to facebookresearch/habitat-sim#1570 - if this is the case there should be a note on this in the code/docs?

Below is the complete message. If the above is the case I will see what workaround I can come up with.

PS C:\code\tbp.monty> conda env create C:\Users\paulm\anaconda3\Lib\argparse.py:2006: FutureWarning: remote_definitionis deprecated and will be removed in 25.9. Useconda env create --file=URL` instead.
action(self, namespace, argument_values, option_string)
Channels:

  • aihabitat
  • pytorch
  • pyg
  • defaults
    Platform: win-64
    Collecting package metadata (repodata.json): done
    Solving environment: failed

PackagesNotFoundError: The following packages are not available from current channels:

  • aihabitat::habitat-sim==0.2.2
  • wget

Current channels:

To search for alternate channels that may provide the conda package you're
looking for, navigate to

https://anaconda.org

and use the search bar at the top of the page.`

@internetscooter internetscooter added the bug Something isn't working label Nov 21, 2024
@tristanls tristanls added the triaged This issue or pull request was triaged label Nov 21, 2024
@tristanls
Copy link
Contributor

tristanls commented Nov 21, 2024

Hi @internetscooter, thank you for the report.

We did not intend to exclude Windows OS. While Habitat is not available on Windows, Monty should be available.

Does the following environment_win.yml file work for installation (Habitat dependencies omitted)?

# This file may be used to create an environment using:
#
# ## Miniconda or Anaconda
#     $ conda env create --file environment_win.yml
# If you are using the zsh shell, run:
#     $ conda init zsh
# Or, if you are using a different shell, run:
#     $ conda init
# After init, if you do not want conda to change your global shell when
# you open a new terminal, run:
#     $ conda config --set auto_activate_base false
# Finally, activate the environment with:
#     $ conda activate tbp.monty
#
# platform: win
name: tbp.monty
channels:
  - pytorch
  - pyg
  - defaults
  - conda-forge

dependencies:
  - python=3.8
  - cmake>=3.14.0
  - pyg::pyg
  - wget

  - pytorch::pytorch=1.11.0
  - conda-forge::quaternion=2023.0.3 # later versions missing np.long
  - pytorch::torchvision

  - pip
  - pip:
      - -e .[dev]

For example, the Monty Meets World benchmarks are intended to be independent of Habitat: https://thousandbrainsproject.readme.io/docs/benchmark-experiments#monty-meets-world. (A documentation update is pending in #57, which shares instructions for downloading the data used in the benchmarks.)

Unfortunately, once you pointed out the problem, it became apparent that Monty is accidentally coupled to Habitat in some of the motor policies:

import habitat_sim.utils as hab_utils
I think this coupling can be removed as only a quat_rotate_vector and common.quat_to_magnum are used, and can likely be replaced by non-Habitat implementations.

@internetscooter
Copy link
Author

Would yo be happy including SciPy?

scipy.spatial.transform.Rotation

@tristanls
Copy link
Contributor

@vkakerbeck, @nielsleadholm any thoughts on habitat_sim.utils replacements and @internetscooter 's suggestion above?

@vkakerbeck
Copy link
Contributor

vkakerbeck commented Nov 22, 2024

I agree, scipy's Rotation function seems the most straight forward function to replace the use of quat_rotate_vector (especially since we are using this function in all the other places). It should already be included in the installed dependencies as well (

'scipy',
)
For the quaternion <-> magnum conversions (quat_to_magnum and quat_from_magnum) it seems like we could just call whatever habitat implements in the respective functions instead (https://github.com/facebookresearch/habitat-sim/blob/d7da04897f234727813aee3368d7e44e0f08c50e/src_python/habitat_sim/utils/common.py#L48) since its just a straight forward call to magnum functionality (mn.Quaternion(quat.imag, quat.real))

@tristanls
Copy link
Contributor

Thanks @vkakerbeck! After you mentioned calling magnum directly, I remembered that magnum and attr are transitive dependencies bundled with habitat_sim. I think that any calls to magnum would have to be moved to Habitat-specific simulator code. It looks to me like SurfacePolicy.get_inverse_agent_rot would need to be reimplemented:

def get_inverse_agent_rot(self):
"""Get the inverse rotation of the agent's current orientation.
Used to transform poses of e.g. point normals or principle curvature from
global coordinates into the coordinate frame of the agent.
To intuit why we apply the inverse, imagine an e.g. point normal with the same
pose as the agent; in the agent's reference frame, this should have the
identity pose, which will be aquired by transforming the original pose by the
inverse
NB Magnum appears to be a library used by Habitat; i.e. it is still grounded
in quaternions
Returns:
Inverse quaternion rotation.
"""
inverse_magnum_rotation = hab_utils.common.quat_to_magnum(
self.state["agent_id_0"]["rotation"]
).inverted()
inverse_quaternion_rotation = hab_utils.common.quat_from_magnum(
inverse_magnum_rotation
)
return inverse_quaternion_rotation

@vkakerbeck
Copy link
Contributor

I'm kind of confused why we convert here to magnum anyways. We could just invert the quaternion directly... @nielsleadholm any recollection why we did that?

@tristanls
Copy link
Contributor

tristanls commented Nov 22, 2024

I dug into the pre-open source code history, and based on that context (PR 201), the magnum conversion seems incidental and not done for a specific reason.

@tristanls
Copy link
Contributor

As reported in https://thousandbrains.discourse.group/t/implimentation-problems-on-a-raspberry-pi/187/7, tests are another source of coupling. Following the default instructions and running pytest will fail when importing Habitat dependencies.

@vkakerbeck
Copy link
Contributor

vkakerbeck commented Nov 22, 2024

Okay, so it sounds like for getting Monty running without habitat we can use scipy.spatial.transform.Rotation.inv instead of the two lines that convert back and forth between quaternion and magnum.

Making the unit tests independent of habitat will be a lot more involved 😬 This can be done in a second step later on.

@internetscooter
Copy link
Author

internetscooter commented Nov 23, 2024

Does the following environment_win.yml file work for installation (Habitat dependencies omitted)?

@tristanls it still failed on the wget. I updated that to python-wget and that solved the errors

Edit: However pytest fails with pytest: error: unrecognized arguments: -n , there might be another quirk with Windows and pytest-xdist

@internetscooter
Copy link
Author

Installing conda install -c conda-forge pytest-xdist and restarting the shell got pytest running. Here is the output for windows with habitat_sim failures for reference:

`
============================================================================================ test session starts ============================================================================================
platform win32 -- Python 3.8.20, pytest-7.1.1, pluggy-1.5.0
rootdir: C:\code\tbp.monty, configfile: pyproject.toml, testpaths: tests/unit
plugins: cov-3.0.0, forked-1.6.0, xdist-2.5.0
gw0 [168] / gw1 [168] / gw2 [168] / gw3 [168] / gw4 [168] / gw5 [168] / gw6 [168] / gw7 [168] / gw8 [168] / gw9 [168] / gw10 [168] / gw11 [168] / gw12 [168] / gw13 [168]
........................................................................................................................................................................ [100%]
================================================================================================== ERRORS ===================================================================================================
______________________________________________________________________________ ERROR collecting tests/unit/base_config_test.py ______________________________________________________________________________
ImportError while importing test module 'C:\code\tbp.monty\tests\unit\base_config_test.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
C:\Users\paulm\anaconda3\envs\tbp.monty\lib\importlib_init_.py:127: in import_module
return _bootstrap.gcd_import(name[level:], package, level)
tests\unit\base_config_test.py:18: in
from tbp.monty.frameworks.config_utils.config_args import (
src\tbp\monty\frameworks\config_utils\config_args.py:52: in
from tbp.monty.frameworks.models.motor_policies import (
src\tbp\monty\frameworks\models\motor_policies.py:18: in
import habitat_sim.utils as hab_utils
E ModuleNotFoundError: No module named 'habitat_sim'
---------------------------------------------------------------------------------------------- Captured stdout ----------------------------------------------------------------------------------------------
MONTY_LOGS not set. Using default directory: C:\Users\paulm\AppData\Local\Temp\tmp66uzl7un
MONTY_MODELS not set. Using default directory: C:\Users\paulm\AppData\Local\Temp\tmp66uzl7unpretrained_models/
WANDB_DIR not set. Using default directory: C:\Users\paulm\AppData\Local\Temp\tmp66uzl7un
____________________________________________________________________________ ERROR collecting tests/unit/custom_actions_test.py _____________________________________________________________________________
ImportError while importing test module 'C:\code\tbp.monty\tests\unit\custom_actions_test.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
C:\Users\paulm\anaconda3\envs\tbp.monty\lib\importlib_init
.py:127: in import_module
return _bootstrap.gcd_import(name[level:], package, level)
tests\unit\custom_actions_test.py:12: in
import magnum as mn
E ModuleNotFoundError: No module named 'magnum'
_____________________________________________________________________________ ERROR collecting tests/unit/embodied_data_test.py _____________________________________________________________________________
ImportError while importing test module 'C:\code\tbp.monty\tests\unit\embodied_data_test.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
C:\Users\paulm\anaconda3\envs\tbp.monty\lib\importlib_init
.py:127: in import_module
return _bootstrap.gcd_import(name[level:], package, level)
tests\unit\embodied_data_test.py:20: in
from tbp.monty.frameworks.config_utils.config_args import make_base_policy_config
src\tbp\monty\frameworks\config_utils\config_args.py:52: in
from tbp.monty.frameworks.models.motor_policies import (
src\tbp\monty\frameworks\models\motor_policies.py:18: in
import habitat_sim.utils as hab_utils
E ModuleNotFoundError: No module named 'habitat_sim'
______________________________________________________________________________ ERROR collecting tests/unit/evidence_lm_test.py ______________________________________________________________________________
ImportError while importing test module 'C:\code\tbp.monty\tests\unit\evidence_lm_test.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
C:\Users\paulm\anaconda3\envs\tbp.monty\lib\importlib_init
.py:127: in import_module
return _bootstrap.gcd_import(name[level:], package, level)
tests\unit\evidence_lm_test.py:26: in
from tbp.monty.frameworks.config_utils.config_args import (
src\tbp\monty\frameworks\config_utils\config_args.py:52: in
from tbp.monty.frameworks.models.motor_policies import (
src\tbp\monty\frameworks\models\motor_policies.py:18: in
import habitat_sim.utils as hab_utils
E ModuleNotFoundError: No module named 'habitat_sim'
____________________________________________________________________________ ERROR collecting tests/unit/graph_building_test.py _____________________________________________________________________________
ImportError while importing test module 'C:\code\tbp.monty\tests\unit\graph_building_test.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
C:\Users\paulm\anaconda3\envs\tbp.monty\lib\importlib_init
.py:127: in import_module
return _bootstrap.gcd_import(name[level:], package, level)
tests\unit\graph_building_test.py:18: in
from tbp.monty.frameworks.config_utils.config_args import (
src\tbp\monty\frameworks\config_utils\config_args.py:52: in
from tbp.monty.frameworks.models.motor_policies import (
src\tbp\monty\frameworks\models\motor_policies.py:18: in
import habitat_sim.utils as hab_utils
E ModuleNotFoundError: No module named 'habitat_sim'
____________________________________________________________________________ ERROR collecting tests/unit/graph_learning_test.py _____________________________________________________________________________
ImportError while importing test module 'C:\code\tbp.monty\tests\unit\graph_learning_test.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
C:\Users\paulm\anaconda3\envs\tbp.monty\lib\importlib_init
.py:127: in import_module
return _bootstrap.gcd_import(name[level:], package, level)
tests\unit\graph_learning_test.py:24: in
from tbp.monty.frameworks.config_utils.config_args import (
src\tbp\monty\frameworks\config_utils\config_args.py:52: in
from tbp.monty.frameworks.models.motor_policies import (
src\tbp\monty\frameworks\models\motor_policies.py:18: in
import habitat_sim.utils as hab_utils
E ModuleNotFoundError: No module named 'habitat_sim'
_____________________________________________________________________________ ERROR collecting tests/unit/habitat_data_test.py ______________________________________________________________________________
ImportError while importing test module 'C:\code\tbp.monty\tests\unit\habitat_data_test.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
C:\Users\paulm\anaconda3\envs\tbp.monty\lib\importlib_init
.py:127: in import_module
return _bootstrap.gcd_import(name[level:], package, level)
tests\unit\habitat_data_test.py:13: in
import magnum as mn
E ModuleNotFoundError: No module named 'magnum'
______________________________________________________________________________ ERROR collecting tests/unit/habitat_sim_test.py ______________________________________________________________________________
ImportError while importing test module 'C:\code\tbp.monty\tests\unit\habitat_sim_test.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
C:\Users\paulm\anaconda3\envs\tbp.monty\lib\importlib_init
.py:127: in import_module
return _bootstrap.gcd_import(name[level:], package, level)
tests\unit\habitat_sim_test.py:16: in
import habitat_sim
E ModuleNotFoundError: No module named 'habitat_sim'
________________________________________________________________________________ ERROR collecting tests/unit/policy_test.py _________________________________________________________________________________
ImportError while importing test module 'C:\code\tbp.monty\tests\unit\policy_test.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
C:\Users\paulm\anaconda3\envs\tbp.monty\lib\importlib_init
.py:127: in import_module
return _bootstrap.gcd_import(name[level:], package, level)
tests\unit\policy_test.py:16: in
import habitat_sim.utils as hab_utils
E ModuleNotFoundError: No module named 'habitat_sim'
_____________________________________________________________________________ ERROR collecting tests/unit/run_parallel_test.py ______________________________________________________________________________
ImportError while importing test module 'C:\code\tbp.monty\tests\unit\run_parallel_test.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
C:\Users\paulm\anaconda3\envs\tbp.monty\lib\importlib_init
.py:127: in import_module
return _bootstrap.gcd_import(name[level:], package, level)
tests\unit\run_parallel_test.py:21: in
from tbp.monty.frameworks.config_utils.config_args import (
src\tbp\monty\frameworks\config_utils\config_args.py:52: in
from tbp.monty.frameworks.models.motor_policies import (
src\tbp\monty\frameworks\models\motor_policies.py:18: in
import habitat_sim.utils as hab_utils
E ModuleNotFoundError: No module named 'habitat_sim'
__________________________________________________________________________________ ERROR collecting tests/unit/run_test.py __________________________________________________________________________________
ImportError while importing test module 'C:\code\tbp.monty\tests\unit\run_test.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
C:\Users\paulm\anaconda3\envs\tbp.monty\lib\importlib_init
.py:127: in import_module
return _bootstrap.gcd_import(name[level:], package, level)
tests\unit\run_test.py:19: in
import magnum as mn
E ModuleNotFoundError: No module named 'magnum'
_____________________________________________________________________________ ERROR collecting tests/unit/sensor_module_test.py _____________________________________________________________________________
ImportError while importing test module 'C:\code\tbp.monty\tests\unit\sensor_module_test.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
C:\Users\paulm\anaconda3\envs\tbp.monty\lib\importlib_init
.py:127: in import_module
return _bootstrap.gcd_import(name[level:], package, level)
tests\unit\sensor_module_test.py:16: in
from tbp.monty.frameworks.config_utils.config_args import (
src\tbp\monty\frameworks\config_utils\config_args.py:52: in
from tbp.monty.frameworks.models.motor_policies import (
src\tbp\monty\frameworks\models\motor_policies.py:18: in
import habitat_sim.utils as hab_utils
E ModuleNotFoundError: No module named 'habitat_sim'
_________________________________________________________________________________ ERROR collecting tests/unit/tacto_test.py _________________________________________________________________________________
ImportError while importing test module 'C:\code\tbp.monty\tests\unit\tacto_test.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
C:\Users\paulm\anaconda3\envs\tbp.monty\lib\importlib_init
.py:127: in import_module
return _bootstrap.gcd_import(name[level:], package, level)
tests\unit\tacto_test.py:11: in
import habitat_sim
E ModuleNotFoundError: No module named 'habitat_sim'
__________________________________________________________________ ERROR collecting tests/unit/frameworks/actions/habitat/actuator_test.py __________________________________________________________________
ImportError while importing test module 'C:\code\tbp.monty\tests\unit\frameworks\actions\habitat\actuator_test.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
C:\Users\paulm\anaconda3\envs\tbp.monty\lib\importlib_init
.py:127: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
tests\unit\frameworks\actions\habitat\actuator_test.py:13: in
from habitat_sim import Agent, AgentConfiguration
E ModuleNotFoundError: No module named 'habitat_sim'
============================================================================================= warnings summary ==============================================================================================
....\Users\paulm\anaconda3\envs\tbp.monty\lib\site-packages_pytest\stepwise.py:52
C:\Users\paulm\anaconda3\envs\tbp.monty\lib\site-packages_pytest\stepwise.py:52: PytestCacheWarning: cache could not write path C:\code\tbp.monty.pytest_cache\v\cache\stepwise
session.config.cache.set(STEPWISE_CACHE_DIR, [])

tests/unit/evidence_sdr_lm_test.py::EvidenceSDRIntegrationTest::test_can_generate_reasonable_sdrs
C:\code\tbp.monty\src\tbp\monty\frameworks\models\evidence_sdr_matching.py:446: RuntimeWarning: invalid value encountered in divide
evidence[valid_ix] = (evidence[valid_ix] - input_range[0]) * (

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
========================================================================================== short test summary info ==========================================================================================
ERROR tests/unit/base_config_test.py
ERROR tests/unit/custom_actions_test.py
ERROR tests/unit/embodied_data_test.py
ERROR tests/unit/evidence_lm_test.py
ERROR tests/unit/graph_building_test.py
ERROR tests/unit/graph_learning_test.py
ERROR tests/unit/habitat_data_test.py
ERROR tests/unit/habitat_sim_test.py
ERROR tests/unit/policy_test.py
ERROR tests/unit/run_parallel_test.py
ERROR tests/unit/run_test.py
ERROR tests/unit/sensor_module_test.py
ERROR tests/unit/tacto_test.py
ERROR tests/unit/frameworks/actions/habitat/actuator_test.py
================================================================================ 168 passed, 2 warnings, 14 errors in 59.87s ================================================================================
`

@nielsleadholm
Copy link
Contributor

Just adding my voice @tristanls @vkakerbeck that I agree the use of magnum looks like it was incidental rather than required, and Scipy should work well as an alternative.

@tristanls
Copy link
Contributor

I'm looking at motor_policies.py to remove the hab_utils dependency. I don't have a plan to address the tests yet.

@leemkuny
Copy link

@internetscooter Thanks for raising bug, I can replicate your result (1 less warning).

================================ 168 passed, 1 warning, 14 errors in 197.31s (0:03:17) ================================

@tristanls Will the modified environment_win.yml be committed into git repo?

@tristanls
Copy link
Contributor

tristanls commented Nov 28, 2024

@leemkuny, yes, some version of environment.yml for Windows users should go into the repository so that installation path is more straightforward, but I'm not sure what the final version of it would be yet. Do you have a version that works without modification?

@tristanls
Copy link
Contributor

tristanls commented Nov 28, 2024

I removed the HabitatSim dependency from motor_policies.py in #79. The tests are still expected to fail, as there were no changes there.

With coupling removed in motor_policies.py, I discovered the next source of coupling to HabitatSim in make_dataset_configs.py:

from tbp.monty.frameworks.environments.habitat import (
AgentConfig,
HabitatEnvironment,
ObjectConfig,
)

when attempting

~tbp/tbp.monty % python benchmarks/run.py -e hand_intrusion_world_image_on_scanned_model
MONTY_LOGS not set. Using default directory: ~/tbp/results/monty/
MONTY_MODELS not set. Using default directory: ~/tbp/results/monty/pretrained_models/
WANDB_DIR not set. Using default directory: ~/tbp/results/monty/
Traceback (most recent call last):
  File "benchmarks/run.py", line 15, in <module>
    from configs import CONFIGS  # noqa: E402
  File "~tbp/tbp.monty/benchmarks/configs/__init__.py", line 10, in <module>
    from .monty_world_experiments import CONFIGS as MONTY_WORLD
  File "~/tbp/tbp.monty/benchmarks/configs/monty_world_experiments.py", line 21, in <module>
    from tbp.monty.frameworks.config_utils.make_dataset_configs import (
  File "~/tbp/tbp.monty/src/tbp/monty/frameworks/config_utils/make_dataset_configs.py", line 22, in <module>
    from tbp.monty.frameworks.environments.habitat import (
  File "~/tbp/tbp.monty/src/tbp/monty/frameworks/environments/habitat.py", line 19, in <module>
    from tbp.monty.simulators.habitat import (
  File "~/tbp/tbp.monty/src/tbp/monty/simulators/habitat/__init__.py", line 10, in <module>
    from .actions import *
  File "~/tbp/tbp.monty/src/tbp/monty/simulators/habitat/actions.py", line 13, in <module>
    import habitat_sim.utils as hab_utils
ModuleNotFoundError: No module named 'habitat_sim'

@mirroredkube
Copy link

Hi, @internetscooter, did you try on WSL? It's pretty seamless on WSL for windows users. I had to do very little updates to get the tests running. But it may not be performant for obvious reasons.

@internetscooter
Copy link
Author

internetscooter commented Dec 7, 2024

Hi, @internetscooter, did you try on WSL? It's pretty seamless on WSL for windows users. I had to do very little updates to get the tests running. But it may not be performant for obvious reasons.

Not yet - would it not be performant due to CUDA? This might be resolved with Enable NVIDIA CUDA on WSL. If I am likely to end up with a fully functional performant set-up, I am happy to put in the work and document the whole process while doing it :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triaged This issue or pull request was triaged
Projects
None yet
Development

No branches or pull requests

6 participants