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

ImportError: cannot import name 'text' from 'magnum' #2049

Closed
YuquanDeng opened this issue Mar 28, 2023 · 13 comments · Fixed by #2055
Closed

ImportError: cannot import name 'text' from 'magnum' #2049

YuquanDeng opened this issue Mar 28, 2023 · 13 comments · Fixed by #2055
Labels
solution proposed A solution or workaround is proposed but may not be merged to main. support User support requested (e.g. specific issue or API usage question)

Comments

@YuquanDeng
Copy link

YuquanDeng commented Mar 28, 2023

Habitat-Sim version

vx.x.x

Habitat is under active development, and we advise users to restrict themselves to stable releases. Are you using the latest release version of Habitat-Sim? Your question may already be addressed in the latest version. We may also not be able to help with problems in earlier versions because they sometimes lack the more verbose logging needed for debugging.

Main branch contains 'bleeding edge' code and should be used at your own risk.

Docs and Tutorials

Did you read the docs? https://aihabitat.org/docs/habitat-sim/

Did you check out the tutorials? https://aihabitat.org/tutorial/2020/

Perhaps your question is answered there. If not, carry on!

❓ Questions and Help

I setup the conda environment by running conda create -n habitat python=3.8 and install habitat-sim from night build by running conda install habitat-sim=0.2.2 withbullet -c conda-forge -c aihabitat-nightly. As I followed the solution from #1909 , I also pull the stable tag. But when I run python examples/viewer.py --scene ./data/scene_datasets/habitat-test-scenes/skokloster-castle.glb, I still met the error:


Traceback (most recent call last):
  File "examples/viewer.py", line 19, in 
    from magnum import shaders, text
ImportError: cannot import name 'text' from 'magnum' 
  • habitat-sim version and current branch of the repo
    image
    image

  • If I run the viewer with habitat-sim in c++, it works fine.
    image

I don't know what exactly goes wrong. Thank you so much in advance!


Another thing is that the installation section suggests using python3.9 or higher but after I created a conda environment with python 3.9 and run conda install habitat-sim withbullet -c conda-forge -c aihabitat. I met unstatisfaction error:

 
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: | 
Found conflicts! Looking for incompatible packages.
This can take several minutes.  Press CTRL-C to abort.
failed                                                                          
 
UnsatisfiableError: The following specifications were found
to be incompatible with the existing python installation in your environment:
 
Specifications:
 
  - habitat-sim -> python[version='>=3.6,<3.7.0a0|>=3.7,<3.8.0a0|>=3.8,<3.9.0a0']
 
Your python: python=3.9
 
If python is on the left-most side of the chain, that's the version you've asked for.
When python appears to the right, that indicates that the thing on the left is somehow
not available for the python version you are constrained to. Note that conda will not
change your python version to a different minor version unless you explicitly specify
that.
 
The following specifications were found to be incompatible with each other:
 
Output in format: Requested package -> Available versions
 
Package habitat-sim-mutex conflicts for:
withbullet -> habitat-sim-mutex==1.0[build=*_bullet]
habitat-sim -> habitat-sim-mutex==1.0[build='display_bullet|headless_nobullet|display_nobullet|headless_bullet']The following specifications were found to be incompatible with your system:
 
  - feature:/linux-64::__glibc==2.31=0
  - python=3.9 -> libgcc-ng[version='>=10.3.0'] -> __glibc[version='>=2.17']
 
Your installed version is: 2.31
 

If I understand correctly, the version of habitat-sim I am installing is incomptiable with python 3.9, so I use python 3.8 instead.

@KyleHuo
Copy link

KyleHuo commented Mar 29, 2023

I met the same problem with you. I also use python 3.8 instead. In addition, I cannot run with C++ either. Hope someone can help.

@maengjemo
Copy link

Same issue, can't solve yet.

Currently available C++ test habitat-viewer /path/to/data/scene_datasets/habitat-test-scenes/skokloster-castle.glb

I tried 0.2.2 and 0.2.3 but both encountered same issue.
Env setting is UIbuntu 20.04, nvidia-470 graphic driver with RTX 2080Ti

@aclegg3
Copy link
Contributor

aclegg3 commented Mar 30, 2023

Hey folks,

To run the viewer application, you'll need a matching and recent version of the conda packages and cloned local repo code.

I tested today on a fresh conda env following build instructions:

conda create -n habitat python=3.9 cmake=3.14.0
conda activate habitat
conda install habitat-sim withbullet -c conda-forge -c aihabitat-nightly
git clone https://github.com/facebookresearch/habitat-sim.git
cd habitat-sim

Note that I installed the nightly build.
Then (assuming you already have data/scene_datasets/habitat-test-scenes/skokloster-castle.glb):

python examples/viewer.py --scene data/scene_datasets/habitat-test-scenes/skokloster-castle.glb
habitat-viewer data/scene_datasets/habitat-test-scenes/skokloster-castle.glb

Both of these work for me.

@aclegg3 aclegg3 added support User support requested (e.g. specific issue or API usage question) solution proposed A solution or workaround is proposed but may not be merged to main. labels Mar 30, 2023
@maengjemo
Copy link

Hey folks,

To run the viewer application, you'll need a matching and recent version of the conda packages and cloned local repo code.

I tested today on a fresh conda env following build instructions:

conda create -n habitat python=3.9 cmake=3.14.0
conda activate habitat
conda install habitat-sim withbullet -c conda-forge -c aihabitat-nightly
git clone https://github.com/facebookresearch/habitat-sim.git
cd habitat-sim

Note that I installed the nightly build. Then (assuming you already have data/scene_datasets/habitat-test-scenes/skokloster-castle.glb):

python examples/viewer.py --scene data/scene_datasets/habitat-test-scenes/skokloster-castle.glb
habitat-viewer data/scene_datasets/habitat-test-scenes/skokloster-castle.glb

Both of these work for me.

HI there!
Thanks for your help.
As follow ur instructions (also same with documentation says)
c++ code for
habitat-viewer data/scene_datasets/habitat-test-scenes/skokloster-castle.glb works well

but using python example,
python examples/viewer.py --scene data/scene_datasets/habitat-test-scenes/skokloster-castle.glb print out RenderTarget Error which is
RenderTarget::Impl::blitRgbaTo(): target framebuffer has a size of Vector(1600, 1200) but expected Vector(800, 600) Aborted (core dumped)

I think a defined buffer size is different. Is there any solution to fix as setting configuration?
Thanks for your help in advance.

Have a nice day :)

@aclegg3
Copy link
Contributor

aclegg3 commented Mar 31, 2023

Hey @jemo-mh, this sounds like a different issue.
It reminds me of system DPI scaling issues we've seen in the past.
@0mdc @mosra thoughts here?

@0mdc
Copy link
Contributor

0mdc commented Apr 1, 2023

I was able to reproduce locally. I issued a fix here: #2055

@jemo-mh Can you try out these changes?

@YuquanDeng
Copy link
Author

Hey folks,

To run the viewer application, you'll need a matching and recent version of the conda packages and cloned local repo code.

I tested today on a fresh conda env following build instructions:

conda create -n habitat python=3.9 cmake=3.14.0
conda activate habitat
conda install habitat-sim withbullet -c conda-forge -c aihabitat-nightly
git clone https://github.com/facebookresearch/habitat-sim.git
cd habitat-sim

Note that I installed the nightly build. Then (assuming you already have data/scene_datasets/habitat-test-scenes/skokloster-castle.glb):

python examples/viewer.py --scene data/scene_datasets/habitat-test-scenes/skokloster-castle.glb
habitat-viewer data/scene_datasets/habitat-test-scenes/skokloster-castle.glb

Both of these work for me.

Sorry for the late reply! Thank you so much for your help!!! That worked for me!

@maengjemo
Copy link

I was able to reproduce locally. I issued a fix here: #2055

@jemo-mh Can you try out these changes?

Hello there!
Cloning your recent commit, It works now.
Thanks for your help and have a nice day :)

@chenhaomingbob
Copy link

I was able to reproduce locally. I issued a fix here: #2055
@jemo-mh Can you try out these changes?

Hello there! Cloning your recent commit, It works now. Thanks for your help and have a nice day :)

Hi. I encountered the ImportError in tag v0.3.1.
Can you remember the version you used that is successfully running?

@0mdc
Copy link
Contributor

0mdc commented Jun 16, 2024

That version works for me. What's your environment?

You might want to try re-creating your conda environment before debugging this further.

@chenhaomingbob
Copy link

That version works for me. What's your environment?

You might want to try re-creating your conda environment before debugging this further.

I find that this error is related to the headless.
If I use conda install habitat-sim withbullet -c conda-forge -c aihabitat instead of conda install habitat-sim withbullet headless -c conda-forge -c aihabitat, the error does not exist.

@0mdc
Copy link
Contributor

0mdc commented Jun 17, 2024

I see. In the case of viewer.py, this makes sense as headless is meant to be used on systems without displays. Therefore, it excludes dependencies like GUI text.

Did you get this error by running something else?

@chenhaomingbob
Copy link

Thanks for your explanation. When I run python examples/viewer.py --scene data, I encounter this error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
solution proposed A solution or workaround is proposed but may not be merged to main. support User support requested (e.g. specific issue or API usage question)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants