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

ModuleNotFoundError: No module named 'habitat_sim._ext' #12

Closed
Sunnyzhr opened this issue Oct 25, 2020 · 4 comments
Closed

ModuleNotFoundError: No module named 'habitat_sim._ext' #12

Sunnyzhr opened this issue Oct 25, 2020 · 4 comments

Comments

@Sunnyzhr
Copy link

Sunnyzhr commented Oct 25, 2020

Overview

When running python main.py -n1 --auto_gpu_config 0 --split val, I will get error if I write ~/.bashrc with export PYTHONPATH=$PYTHONPATH:~/Desktop/habitat-sim/

ModuleNotFoundError: No module named 'habitat_sim._ext'

I will also get error if I write ~/.bashrc with unset PYTHONPATH

ModuleNotFoundError: No module named habitat.sims.habitat_simulato.action_spaces'

My Info

ENVIRONMENT INFO:
Platform: Linux-5.4.0-52-generic-x86_64-with-glibc2.10
Machine: x86_64
Processor: x86_64
Libc version: glibc 2.27
Mac version:
Python version: 3.8.3
Architecture: 64bit ELF
Win version:
System OS: Linux
Release: 5.4.0-52-generic
Version: #57 18.04.1-Ubuntu SMP Thu Oct 15 14:04:49 UTC 2020
Operational System: linux
GCC version: gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0\n'
CMAKE version: 3.14.0
NVIDIA-SMI: Mon Oct 26 12:50:01 2020
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 450.80.02 Driver Version: 450.80.02 CUDA Version: 11.0 |
|-------------------------------+----------------------+----------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|===============================+======================+======================|
| 0 GeForce GTX 1650 Off | 00000000:01:00.0 On | N/A |
| N/A 42C P8 3W / N/A | 433MiB / 3903MiB | 1% Default |
| | | N/A |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=============================================================================|
| 0 N/A N/A 1323 G /usr/lib/xorg/Xorg 18MiB |
| 0 N/A N/A 1413 G /usr/bin/gnome-shell 47MiB |
| 0 N/A N/A 1688 G /usr/lib/xorg/Xorg 148MiB |
| 0 N/A N/A 1827 G /usr/bin/gnome-shell 134MiB |
| 0 N/A N/A 3226 G /usr/lib/firefox/firefox 1MiB |
| 0 N/A N/A 31858 G ...AAAAAAAAA= --shared-files 79MiB |
+-----------------------------------------------------------------------------+

nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2020 NVIDIA Corporation
Built on Thu_Jun_11_22:26:38_PDT_2020
Cuda compilation tools, release 11.0, V11.0.194
Build cuda_11.0_bu.TC445_37.28540450_0

My Steps

1.Git clone

cd ~/Desktop
git clone --branch stable https://github.com/facebookresearch/habitat-sim.git
git clone --branch stable https://github.com/facebookresearch/habitat-lab.git
git clone --recurse-submodules https://github.com/devendrachaplot/Neural-SLAM

sudo chmod 777 -R ~/Desktop/habitat-sim
sudo chmod 777 -R ~/Desktop/habitat-lab
sudo chmod 777 -R ~/Desktop/Neural-SLAM

2.conda install
Instructed by habitat-sim tutorials

cd ~/Desktop/habitat-sim
conda install habitat-sim -c conda-forge -c aihabitat
conda install habitat-sim headless -c conda-forge -c aihabitat
conda install habitat-sim withbullet headless -c conda-forge -c aihabitat

cd ~/Desktop/habitat-lab
conda install habitat-sim -c conda-forge -c aihabitat
conda install habitat-sim headless -c conda-forge -c aihabitat
conda install habitat-sim withbullet headless -c conda-forge -c aihabitat

cd ~/Desktop/Neural-SLAM
conda install habitat-sim -c conda-forge -c aihabitat
conda install habitat-sim headless -c conda-forge -c aihabitat
conda install habitat-sim withbullet headless -c conda-forge -c aihabitat

3.build habitat-sim
Instructed by BuildFromSource:

cd ~/Desktop/habitat-sim
conda create -n habitat python=3.6 cmake=3.14.0

conda activate habitat
pip install -r requirements.txt
sudo apt-get update || true
sudo apt-get install -y --no-install-recommends \
     libjpeg-dev libglm-dev libgl1-mesa-glx libegl1-mesa-dev mesa-utils xorg-dev freeglut3-dev

python setup.py install
python setup.py install --headless
python setup.py install --with-cuda
sudo apt-get install libbullet-dev
python setup.py install --bullet 

All these bulid commands above run successfully.

./build/viewer ./data/scene_datasets/habitat-test-scenes/skokloster-castle.glb
./build/viewer --enable-physics ./data/scene_datasets/habitat-test-scenes/van-gogh-room.glb
python examples/example.py --scene ./data/scene_datasets/habitat-test-scenes/skokloster-castle.glb
python examples/example.py --scene ./data/scene_datasets/habitat-test-scenes/skokloster-castle.glb --enable_physics

All these example files above run successfully.

4.export PATHONPATH
This is the most confusing part. I really have no idea what to do.
Instructed by BuildFromSource:, we should write ~/.bashrc with export PYTHONPATH=$PYTHONPATH:~/Desktop/habitat-sim/ However, after doing that, I even could not succeed run example file of habitat-sim, and will get error:

ModuleNotFoundError: No module named 'habitat_sim._ext'

Then accoriding to erikwijmans commented on Feb 14,

Please do unset PYTHONPATH (or similar) to remove it.

Then I write ~/.bashrc with unset PYTHONPATH. I can succeed to run example files of habitat-sim again.

  1. build habitat-lab
sudo -s
conda activate habitat
cd ~/Desktop/habitat-lab
pip install -e .
pip install -r requirements.txt
python setup.py develop --all

python examples/example.py 
python setup.py test
python examples/benchmark.py

I can successfully bulid and run the example files.

6.build Neural-SLAM

sudo -s 
conda activate habitat
cd ~/Desktop/Neural-SLAM
conda install pytorch==1.2.0 torchvision cudatoolkit=11.0 -c pytorch

I will get error:

(Error: habitat 0.1.6 requires torch>=1.3.1, but you'll have torch 1.2.0 which is incompatible.)

I ignore it and run next commands:pip install -r requirements.txt(I don't whether I need to upgrade the torch version to 1.3.1)

Then, when run command python main.py -n1 --auto_gpu_config 0 --split val, I get error:

ModuleNotFoundError: No module named habitat.sims.habitat_simulato.action_spaces'

It should be noticed that, at that time, I wrote ~/.bashrc with unset PYTHONPATH.
Thus, I try to write ~/.bashrc with export PYTHONPATH=$PYTHONPATH:~/Desktop/habitat-sim/ , then the error will change to:

ModuleNotFoundError: No module named 'habitat_sim._ext'

So what is the correct PYTHONPATH to add in to ~/.bashrc ?
How to fix the error?

Expectation

Successfully run the code.

@Sunnyzhr Sunnyzhr changed the title No module named 'gym.spaces.dict_space' ModuleNotFoundError: No module named 'habitat_sim._ext' Oct 26, 2020
@devendrachaplot
Copy link
Owner

Hi,
You need to install specific older versions of habitat-sim and habitat-api for running the Active Neural SLAM code. Check the instructions on installing dependencies in the README for specific versions:

https://github.com/devendrachaplot/Neural-SLAM/blob/master/README.md#installing-dependencies

@Sunnyzhr

This comment has been minimized.

@Sunnyzhr
Copy link
Author

@devendrachaplot Thank you so much for reply!

I follow your instructions carefully, and encounter another errorAttributeError: module 'env' has no attribute 'habitat'. Fortunately, I follow your instruction again to solve the problem. (By change import ... to from ... import ... ) THANKS again!!!

After that, I encounter another trouble that I cannot run with GPU. I fix it by change my torch(cuda11.0) to torch(cuda10.0).

Then, I start to run commands of the tutorial, I've encounter several new problems as below:

New problem 1 - python main.py -n1 --auto_gpu_config 0 --split val

The command runs without error at the first 38 minuets. However, then it encounter errors as below. Additionally, I find that there are some other people who encouter the same error. The code will fail at Cantwell.glb

...
...
Time: 00d 00h 37m 49s, num timesteps 980, FPS 0,
Rewards:
Losses: Local Loss: 4.630, SLAM Loss proj/exp/pose:0.0004/0.0004/0.0101
Time: 00d 00h 38m 11s, num timesteps 990, FPS 0,
Rewards:
Losses: Local Loss: 4.661, SLAM Loss proj/exp/pose:0.0003/0.0003/0.0100
2020-10-27 17:39:42,208 Computing map for data/scene_datasets/gibson/Cantwell.glb
Traceback (most recent call last):
File "main.py", line 769, in
main()
File "main.py", line 617, in main
g_agent.update(g_rollouts)
File "/home/u/Desktop/Neural-SLAM/algo/ppo.py", line 58, in update
for sample in data_generator:
File "/home/u/Desktop/Neural-SLAM/utils/storage.py", line 95, in feed_forward_generator
mini_batch_size = batch_size // num_mini_batch
ZeroDivisionError: integer division or modulo by zero
Exception ignored in: <bound method VectorEnv.del of <env.habitat.habitat_api.habitat.core.vector_env.VectorEnv object at 0x7faf77d21c18>>
Traceback (most recent call last):
File "/home/u/Desktop/Neural-SLAM/env/habitat/habitat_api/habitat/core/vector_env.py", line 487, in del
self.close()
File "/home/u/Desktop/Neural-SLAM/env/habitat/habitat_api/habitat/core/vector_env.py", line 351, in close
write_fn((CLOSE_COMMAND, None))
File "/home/u/anaconda3/envs/habitat/lib/python3.6/multiprocessing/connection.py", line 206, in send
self._send_bytes(_ForkingPickler.dumps(obj))
File "/home/u/anaconda3/envs/habitat/lib/python3.6/multiprocessing/connection.py", line 404, in _send_bytes
self._send(header + buf)
File "/home/u/anaconda3/envs/habitat/lib/python3.6/multiprocessing/connection.py", line 368, in _send
n = write(self._handle, buf)
BrokenPipeError: [Errno 32] Broken pipe

New problem 2 - python main.py

The error information is:

(habitat) root@c:~/Desktop/Neural-SLAM# python main.py
Traceback (most recent call last):
File "main.py", line 33, in
args = get_args()
File "/home/u/Desktop/Neural-SLAM/arguments.py", line 198, in get_args
/1024/1024/1024 > 10.0, "Insufficient GPU memory"
AssertionError: Insufficient GPU memory

I check my GPU memory (I only have 1 GPU) with torch.cuda.get_device_properties(0).total_memory/1024/1024/1024 . The result is 3.81195068359375 which is less than 10.
I see the arguments.py, there are two lines:

num_processes_per_gpu = int(gpu_memory/1.4)
num_processes_on_first_gpu = int((gpu_memory - 10.0)/1.4)

Therefore, could you please recommend me a value of num_processes_per_gpu and num_processes_on_first_gpu?

Expectation

Successfully run the codes.

Thanks for your attention!

@devendrachaplot
Copy link
Owner

For the first problem, you can try adding the argument: --num_mini_batch 1

For the second problem, you can try running the habitat simulator and/or model without using the GPU. For running habitat without GPU, you need to install the CPU version. For running the model without using the GPU, you can use --no_cuda argument.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants