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

Error when running megapose server. #1212

Closed
mattratcliffe opened this issue Jul 27, 2023 · 26 comments
Closed

Error when running megapose server. #1212

mattratcliffe opened this issue Jul 27, 2023 · 26 comments

Comments

@mattratcliffe
Copy link

mattratcliffe commented Jul 27, 2023

Hey there

I had to rebuild everything from scratch and I am hitting some different issues as I run through this tutorial again.

The first issue I hit was when running the install.py script in visp\script\megapose_server was I was getting errors similar to this:
ipython-contrib/jupyter_contrib_nbextensions#1645

As per the comment on the bottom of that issue thread I was able to fix this issue by setting the notebook dependency in megapose_environment.yml to

notebook==6.5.4

This is due to version 7.0.0 of notebook not being compatible with the latest version of jupyter_contrib_nbextensions from what I can gather.

So by setting notebook to 6.5.4 I was able successfully install Megapose.

However when I try to execute the run.py file I now get this error:

(megapose) C:\visp-ws\visp\script>python -m megapose_server.run -h
Loaded megapose variables {'megapose_dir': './megapose6d', 'megapose_data_dir': './megapose6d/data', 'environment': 'megapose'}
MKL_NUM_THREADS: 1
OMP_NUM_THREADS: 1
CUDA_VISIBLE_DEVICES: 0
EGL_VISIBLE_DEVICES: 0
Traceback (most recent call last):
  File "C:\Users\user_1\miniconda3\envs\megapose\lib\runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\user_1\miniconda3\envs\megapose\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\visp-ws\visp\script\megapose_server\run.py", line 52, in <module>
    from megapose.inference.utils import make_detections_from_object_data
  File "C:\visp-ws\visp\script\megapose_server\megapose6d\src\megapose\inference\utils.py", line 32, in <module>
    from megapose.config import EXP_DIR
  File "C:\visp-ws\visp\script\megapose_server\megapose6d\src\megapose\config.py", line 62, in <module>
    assert LOCAL_DATA_DIR.exists()
AssertionError

It's puzzling that I had this working after your previous fix so I am wondering if it's caused by my change to the notebook dependency or something else.

Any help much appreciated.

thanks
Matt

@SamFlt
Copy link
Contributor

SamFlt commented Jul 29, 2023

Hi Matt,

Sorry for all the issues you've had with the installation process!

The error seems to say that the megapose folder where the models are stored is not found. It thus seems unlikely that the notebook version issue is the problem. Thanks for the heads-up however, this feedback greatly appreciated ;)
As you can see from the first print message, the path to megapose is relative: ./megapose6d, same for the data dir (which is the one that is not found): ./megapose6d/data

I thus have a couple of questions:

  • Is the megapose folder located in your current working directory C:\visp-ws\visp\script ?
  • If so, what does this folder contain? you can check with the dir command in a windows terminal and report the results here.
  • Could you report the installed packages with:
 conda activate megapose
 conda list

Storing relative paths is actually an oversight on my part, making the setup a bit brittle: if you run the megapose server from a folder other than the one where you performed the installation, there is a good chance that it will fail. I will fix this as soon as I am able to!

Again, thank you for your feedback, it is extremely useful!

Cheers,
Sam

@mattratcliffe
Copy link
Author

Hi Sam

No problem at all. I feel my lack of experience with Python certainly doesn't help and I do very much appreciate your fast responses and continued support with my issues!

You were spot on, I ran the command in the folder it was installed and the megapose server is now running:

(megapose) C:\visp-ws\visp\script>cd C:\visp-ws\visp\script\megapose_server

(megapose) C:\visp-ws\visp\script\megapose_server>$ python -m megapose_server.run -h
'$' is not recognized as an internal or external command,
operable program or batch file.

(megapose) C:\visp-ws\visp\script\megapose_server>python -m megapose_server.run -h
Loaded megapose variables {'megapose_dir': './megapose6d', 'megapose_data_dir': './megapose6d/data', 'environment': 'megapose'}
MKL_NUM_THREADS: 1
OMP_NUM_THREADS: 1
CUDA_VISIBLE_DEVICES: 0
EGL_VISIBLE_DEVICES: 0
usage: run.py [-h] [--host HOST] [--port PORT] [--model {RGB,RGBD,RGB-multi-hypothesis,RGBD-multi-hypothesis}]
              [--meshes-directory MESHES_DIRECTORY] [--optimize] [--num-workers NUM_WORKERS]

optional arguments:
  -h, --help            show this help message and exit
  --host HOST           IP or hostname to bind the server to. Set to 0.0.0.0 if you wish to listen for incoming
                        connections from any source (dangerous)
  --port PORT           The port on which to listen for new connections
  --model {RGB,RGBD,RGB-multi-hypothesis,RGBD-multi-hypothesis}
                        Which MegaPose model to use. Some models require the depth map. Some models generate multiple
                        hypotheses when estimating the pose, at the cost of more computation. Options: RGB, RGBD, RGB-
                        multi-hypothesis, RGBD-multi-hypothesis
  --meshes-directory MESHES_DIRECTORY
                        Directory containing the 3D models. each 3D model must be in its own subfolder
  --optimize            Experimental: Optimize network for inference speed. This may incur a loss of accuracy.
  --num-workers NUM_WORKERS
                        Number of workers for rendering

Sorry for the mistake and wasting your time!

For the sake of completeness here is my list of packages:

# Name                    Version                   Build  Channel
ansi2html                 1.8.0                    pypi_0    pypi
antlr4-python3-runtime    4.9.3                    pypi_0    pypi
anyio                     3.6.1              pyhd8ed1ab_1    conda-forge
argon2-cffi               21.3.0             pyhd8ed1ab_0    conda-forge
argon2-cffi-bindings      21.2.0           py39ha55989b_3    conda-forge
arrow                     1.2.3              pyhd8ed1ab_0    conda-forge
assimp                    5.2.5                h4dcb625_0    conda-forge
asttokens                 2.2.1              pyhd8ed1ab_0    conda-forge
async-lru                 2.0.3              pyhd8ed1ab_0    conda-forge
attrs                     23.1.0             pyh71513ae_1    conda-forge
babel                     2.12.1             pyhd8ed1ab_1    conda-forge
backcall                  0.2.0              pyh9f0ad1d_0    conda-forge
backports                 1.0                pyhd8ed1ab_3    conda-forge
backports.functools_lru_cache 1.6.5              pyhd8ed1ab_0    conda-forge
beautifulsoup4            4.12.2             pyha770c72_0    conda-forge
blas                      2.117                       mkl    conda-forge
blas-devel                3.9.0              17_win64_mkl    conda-forge
bleach                    6.0.0              pyhd8ed1ab_0    conda-forge
bokeh                     3.2.1                    pypi_0    pypi
boost                     1.78.0           py39hbd792c9_4    conda-forge
boost-cpp                 1.78.0               h9f4b32c_3    conda-forge
braceexpand               0.1.7                    pypi_0    pypi
brotli-python             1.0.9            py39h99910a6_9    conda-forge
bzip2                     1.0.8                h8ffe710_4    conda-forge
ca-certificates           2023.7.22            h56e8100_0    conda-forge
cached-property           1.5.2                hd8ed1ab_1    conda-forge
cached_property           1.5.2              pyha770c72_1    conda-forge
certifi                   2023.7.22          pyhd8ed1ab_0    conda-forge
cffi                      1.15.1           py39h68f70e3_3    conda-forge
charset-normalizer        3.2.0              pyhd8ed1ab_0    conda-forge
click                     8.1.6                    pypi_0    pypi
colorama                  0.4.6              pyhd8ed1ab_0    conda-forge
comm                      0.1.3              pyhd8ed1ab_0    conda-forge
configargparse            1.7                      pypi_0    pypi
console_bridge            1.0.2                h5362a0b_1    conda-forge
contourpy                 1.1.0                    pypi_0    pypi
cudatoolkit               11.3.1              hf2f0253_12    conda-forge
cycler                    0.11.0                   pypi_0    pypi
dash                      2.11.1                   pypi_0    pypi
dash-core-components      2.0.0                    pypi_0    pypi
dash-html-components      2.0.0                    pypi_0    pypi
dash-table                5.0.0                    pypi_0    pypi
debugpy                   1.6.7            py39h99910a6_0    conda-forge
decorator                 5.1.1              pyhd8ed1ab_0    conda-forge
defusedxml                0.7.1              pyhd8ed1ab_0    conda-forge
eigen                     3.4.0                h91493d7_0    conda-forge
eigenpy                   2.9.0            py39haeffccb_0    conda-forge
entrypoints               0.4                pyhd8ed1ab_0    conda-forge
exceptiongroup            1.1.2              pyhd8ed1ab_0    conda-forge
executing                 1.2.0              pyhd8ed1ab_0    conda-forge
firefox                   115.0                h63175ca_0    conda-forge
flask                     2.2.5                    pypi_0    pypi
flit-core                 3.9.0              pyhd8ed1ab_0    conda-forge
fonttools                 4.41.1                   pypi_0    pypi
fqdn                      1.5.1              pyhd8ed1ab_0    conda-forge
freetype                  2.12.1               h546665d_1    conda-forge
geckodriver               0.33.0               h611cf2b_0    conda-forge
h11                       0.14.0             pyhd8ed1ab_0    conda-forge
h5py                      3.9.0                    pypi_0    pypi
hpp-fcl                   2.2.0            py39hd8f2aa6_2    conda-forge
idna                      3.4                pyhd8ed1ab_0    conda-forge
imageio                   2.31.1                   pypi_0    pypi
importlib-metadata        6.8.0              pyha770c72_0    conda-forge
importlib_metadata        6.8.0                hd8ed1ab_0    conda-forge
importlib_resources       6.0.0              pyhd8ed1ab_1    conda-forge
intel-openmp              2023.2.0         h57928b3_49496    conda-forge
ipdb                      0.13.13                  pypi_0    pypi
ipykernel                 6.25.0             pyh6817e22_0    conda-forge
ipython                   8.14.0             pyh08f2357_0    conda-forge
ipython_genutils          0.2.0                      py_1    conda-forge
ipywidgets                8.0.7              pyhd8ed1ab_0    conda-forge
isoduration               20.11.0            pyhd8ed1ab_0    conda-forge
itsdangerous              2.1.2                    pypi_0    pypi
jedi                      0.18.2             pyhd8ed1ab_0    conda-forge
jinja2                    3.1.2              pyhd8ed1ab_1    conda-forge
joblib                    1.3.1                    pypi_0    pypi
jpeg                      9e                   hcfcfb64_3    conda-forge
json5                     0.9.14             pyhd8ed1ab_0    conda-forge
jsonpatch                 1.33                     pypi_0    pypi
jsonpointer               2.0                        py_0    conda-forge
jsonschema                4.18.4             pyhd8ed1ab_0    conda-forge
jsonschema-specifications 2023.7.1           pyhd8ed1ab_0    conda-forge
jsonschema-with-format-nongpl 4.18.4             pyhd8ed1ab_0    conda-forge
jupyter-lsp               2.2.0              pyhd8ed1ab_0    conda-forge
jupyter_client            8.3.0              pyhd8ed1ab_0    conda-forge
jupyter_contrib_core      0.4.0              pyhd8ed1ab_0    conda-forge
jupyter_contrib_nbextensions 0.7.0              pyhd8ed1ab_0    conda-forge
jupyter_core              5.3.1            py39hcbf5309_0    conda-forge
jupyter_events            0.6.3              pyhd8ed1ab_1    conda-forge
jupyter_highlight_selected_word 0.2.0           py39hcbf5309_1005    conda-forge
jupyter_latex_envs        1.4.6           pyhd8ed1ab_1002    conda-forge
jupyter_nbextensions_configurator 0.6.1              pyhd8ed1ab_0    conda-forge
jupyter_server            2.7.0              pyhd8ed1ab_0    conda-forge
jupyter_server_terminals  0.4.4              pyhd8ed1ab_1    conda-forge
jupyterlab                4.0.3              pyhd8ed1ab_0    conda-forge
jupyterlab_pygments       0.2.2              pyhd8ed1ab_0    conda-forge
jupyterlab_server         2.24.0             pyhd8ed1ab_0    conda-forge
jupyterlab_widgets        3.0.8              pyhd8ed1ab_0    conda-forge
kiwisolver                1.4.4                    pypi_0    pypi
kornia                    0.6.12                   pypi_0    pypi
lcms2                     2.15                 ha5c8aab_0    conda-forge
lerc                      4.0.0                h63175ca_0    conda-forge
libblas                   3.9.0              17_win64_mkl    conda-forge
libcblas                  3.9.0              17_win64_mkl    conda-forge
libdeflate                1.17                 hcfcfb64_0    conda-forge
libffi                    3.4.2                h8ffe710_5    conda-forge
libiconv                  1.15             vc14h29686d3_5  [vc14]  anaconda
liblapack                 3.9.0              17_win64_mkl    conda-forge
liblapacke                3.9.0              17_win64_mkl    conda-forge
libpng                    1.6.39               h19919ed_0    conda-forge
libsodium                 1.0.18               h8d14728_1    conda-forge
libsqlite                 3.42.0               hcfcfb64_0    conda-forge
libtiff                   4.5.0                hf8721a0_2    conda-forge
libuv                     1.44.2               hcfcfb64_1    conda-forge
libwebp-base              1.3.1                hcfcfb64_0    conda-forge
libxcb                    1.13              hcd874cb_1004    conda-forge
libxml2                   2.9.10               h5d81f1c_2    conda-forge
libxslt                   1.1.33               h65864e5_2    conda-forge
libzlib                   1.2.13               hcfcfb64_5    conda-forge
line-profiler             4.0.3                    pypi_0    pypi
lxml                      4.9.3                    pypi_0    pypi
m2w64-gcc-libgfortran     5.3.0                         6    conda-forge
m2w64-gcc-libs            5.3.0                         7    conda-forge
m2w64-gcc-libs-core       5.3.0                         7    conda-forge
m2w64-gmp                 6.1.0                         2    conda-forge
m2w64-libwinpthread-git   5.0.0.4634.697f757               2    conda-forge
markupsafe                2.1.3            py39ha55989b_0    conda-forge
matplotlib                3.7.2                    pypi_0    pypi
matplotlib-inline         0.1.6              pyhd8ed1ab_0    conda-forge
megapose                  1.0                      pypi_0    pypi
megapose-server           0.1                      pypi_0    pypi
meshcat                   0.3.2                    pypi_0    pypi
mistune                   3.0.0              pyhd8ed1ab_0    conda-forge
mkl                       2022.1.0           h6a75c08_874    conda-forge
mkl-devel                 2022.1.0           h57928b3_875    conda-forge
mkl-include               2022.1.0           h6a75c08_874    conda-forge
msys2-conda-epoch         20160418                      1    conda-forge
nb_conda_kernels          2.3.1            py39hcbf5309_2    conda-forge
nbclassic                 1.0.0              pyhb4ecaf3_1    conda-forge
nbclient                  0.8.0              pyhd8ed1ab_0    conda-forge
nbconvert                 7.7.3              pyhd8ed1ab_0    conda-forge
nbconvert-core            7.7.3              pyhd8ed1ab_0    conda-forge
nbconvert-pandoc          7.7.3              pyhd8ed1ab_0    conda-forge
nbformat                  5.7.0                    pypi_0    pypi
nest-asyncio              1.5.6              pyhd8ed1ab_0    conda-forge
networkx                  3.1                      pypi_0    pypi
notebook                  6.5.4              pyha770c72_0    conda-forge
notebook-shim             0.2.3              pyhd8ed1ab_0    conda-forge
numpy                     1.25.1           py39h816b6a6_0    conda-forge
octomap                   1.9.8                h91493d7_0    conda-forge
omegaconf                 2.3.0                    pypi_0    pypi
open3d                    0.17.0                   pypi_0    pypi
opencv-contrib-python     4.8.0.74                 pypi_0    pypi
opencv-python             4.8.0.74                 pypi_0    pypi
openjpeg                  2.5.0                ha2aaf27_2    conda-forge
openssl                   3.1.1                hcfcfb64_1    conda-forge
outcome                   1.2.0              pyhd8ed1ab_0    conda-forge
overrides                 7.3.1              pyhd8ed1ab_0    conda-forge
packaging                 23.1               pyhd8ed1ab_0    conda-forge
panda3d                   1.10.13                  pypi_0    pypi
panda3d-gltf              0.15.0                   pypi_0    pypi
panda3d-simplepbr         0.10                     pypi_0    pypi
pandas                    2.0.3                    pypi_0    pypi
pandoc                    3.1.3                h57928b3_0    conda-forge
pandocfilters             1.5.0              pyhd8ed1ab_0    conda-forge
parso                     0.8.3              pyhd8ed1ab_0    conda-forge
pickleshare               0.7.5                   py_1003    conda-forge
pillow                    9.4.0            py39hcebd2be_1    conda-forge
pinocchio                 2.6.17           py39h266cf9d_1    conda-forge
pip                       23.2.1             pyhd8ed1ab_0    conda-forge
pkgutil-resolve-name      1.3.10             pyhd8ed1ab_0    conda-forge
platformdirs              3.9.1              pyhd8ed1ab_0    conda-forge
plotly                    5.15.0                   pypi_0    pypi
plyfile                   1.0.1                    pypi_0    pypi
progressbar               2.5                      pypi_0    pypi
prometheus_client         0.17.1             pyhd8ed1ab_0    conda-forge
prompt-toolkit            3.0.39             pyha770c72_0    conda-forge
prompt_toolkit            3.0.39               hd8ed1ab_0    conda-forge
psutil                    5.9.5            py39ha55989b_0    conda-forge
pthread-stubs             0.4               hcd874cb_1001    conda-forge
pure_eval                 0.2.2              pyhd8ed1ab_0    conda-forge
pyarrow                   12.0.1                   pypi_0    pypi
pycparser                 2.21               pyhd8ed1ab_0    conda-forge
pygments                  2.15.1             pyhd8ed1ab_0    conda-forge
pyngrok                   6.0.0                    pypi_0    pypi
pyparsing                 3.0.9                    pypi_0    pypi
pypng                     0.20220715.0             pypi_0    pypi
pysocks                   1.7.1              pyh0701188_6    conda-forge
python                    3.9.16          h4de0772_0_cpython    conda-forge
python-dateutil           2.8.2              pyhd8ed1ab_0    conda-forge
python-fastjsonschema     2.18.0             pyhd8ed1ab_0    conda-forge
python-json-logger        2.0.7              pyhd8ed1ab_0    conda-forge
python-wget               3.2                        py_0    conda-forge
python_abi                3.9                      3_cp39    conda-forge
pytorch                   1.11.0          py3.9_cuda11.3_cudnn8_0    pytorch
pytorch-mutex             1.0                        cuda    pytorch
pytz                      2023.3             pyhd8ed1ab_0    conda-forge
pywin32                   304              py39h99910a6_2    conda-forge
pywinpty                  2.0.11           py39h99910a6_0    conda-forge
pyyaml                    6.0.1                    pypi_0    pypi
pyzmq                     25.1.0           py39hea35a22_0    conda-forge
qhull                     2020.2               h70d2c02_2    conda-forge
rclone                    1.63.1               h92b2616_0    conda-forge
referencing               0.30.0             pyhd8ed1ab_0    conda-forge
requests                  2.31.0             pyhd8ed1ab_0    conda-forge
retrying                  1.3.4                    pypi_0    pypi
rfc3339-validator         0.1.4              pyhd8ed1ab_0    conda-forge
rfc3986-validator         0.1.1              pyh9f0ad1d_0    conda-forge
roma                      1.3.4                    pypi_0    pypi
rpds-py                   0.9.2            py39hf21820d_0    conda-forge
scipy                     1.11.1                   pypi_0    pypi
seaborn                   0.12.2                   pypi_0    pypi
selenium                  4.10.0             pyhd8ed1ab_0    conda-forge
send2trash                1.8.2              pyh08f2357_0    conda-forge
setuptools                68.0.0             pyhd8ed1ab_0    conda-forge
setuptools-scm            7.1.0                    pypi_0    pypi
simplejson                3.19.1                   pypi_0    pypi
six                       1.16.0             pyh6c4a22f_0    conda-forge
sniffio                   1.3.0              pyhd8ed1ab_0    conda-forge
sortedcontainers          2.4.0              pyhd8ed1ab_0    conda-forge
soupsieve                 2.3.2.post1        pyhd8ed1ab_0    conda-forge
stack_data                0.6.2              pyhd8ed1ab_0    conda-forge
structlog                 23.1.0                   pypi_0    pypi
tbb                       2021.7.0             h91493d7_0    conda-forge
tenacity                  8.2.2                    pypi_0    pypi
terminado                 0.17.0             pyh08f2357_0    conda-forge
tinycss2                  1.2.1              pyhd8ed1ab_0    conda-forge
tinyxml                   2.6.2                h2d74725_2    conda-forge
tk                        8.6.12               h8ffe710_0    conda-forge
tomli                     2.0.1              pyhd8ed1ab_0    conda-forge
torchgeometry             0.1.2                    pypi_0    pypi
torchnet                  0.0.4                    pypi_0    pypi
torchvision               0.12.0               py39_cu113    pytorch
tornado                   6.3.2            py39ha55989b_0    conda-forge
tqdm                      4.65.0                   pypi_0    pypi
traitlets                 5.9.0              pyhd8ed1ab_0    conda-forge
transforms3d              0.4.1                    pypi_0    pypi
trimesh                   3.22.5                   pypi_0    pypi
trio                      0.22.2           py39hcbf5309_0    conda-forge
trio-websocket            0.10.3             pyhd8ed1ab_0    conda-forge
typing-extensions         4.7.1                hd8ed1ab_0    conda-forge
typing_extensions         4.7.1              pyha770c72_0    conda-forge
typing_utils              0.1.0              pyhd8ed1ab_0    conda-forge
tzdata                    2023.3                   pypi_0    pypi
u-msgpack-python          2.8.0                    pypi_0    pypi
ucrt                      10.0.22621.0         h57928b3_0    conda-forge
urdfdom                   3.1.1                h33150cf_0    conda-forge
urdfdom_headers           1.1.0                h5362a0b_0    conda-forge
uri-template              1.3.0              pyhd8ed1ab_0    conda-forge
urllib3                   2.0.4              pyhd8ed1ab_0    conda-forge
vc                        14.3                h64f974e_17    conda-forge
vc14_runtime              14.36.32532         hfdfe4a8_17    conda-forge
visdom                    0.2.4                    pypi_0    pypi
vs2015_runtime            14.36.32532         h05e6639_17    conda-forge
wcwidth                   0.2.6              pyhd8ed1ab_0    conda-forge
webcolors                 1.13               pyhd8ed1ab_0    conda-forge
webdataset                0.2.48                   pypi_0    pypi
webencodings              0.5.1                      py_1    conda-forge
websocket-client          1.6.1              pyhd8ed1ab_0    conda-forge
werkzeug                  2.2.3                    pypi_0    pypi
wheel                     0.41.0             pyhd8ed1ab_0    conda-forge
widgetsnbextension        4.0.8              pyhd8ed1ab_0    conda-forge
win_inet_pton             1.1.0              pyhd8ed1ab_6    conda-forge
winpty                    0.4.3                         4    conda-forge
wsproto                   1.2.0              pyhd8ed1ab_0    conda-forge
xarray                    2023.7.0                 pypi_0    pypi
xorg-libxau               1.0.11               hcd874cb_0    conda-forge
xorg-libxdmcp             1.1.3                hcd874cb_0    conda-forge
xyzservices               2023.7.0                 pypi_0    pypi
xz                        5.2.6                h8d14728_0    conda-forge
yaml                      0.2.5                h8ffe710_2    conda-forge
zeromq                    4.3.4                h0e60522_1    conda-forge
zipp                      3.16.2             pyhd8ed1ab_0    conda-forge
zlib                      1.2.13               hcfcfb64_5    conda-forge
zstd                      1.5.2                h12be248_7    conda-forge

@mattratcliffe
Copy link
Author

Hi Sam

Apologies for another message but I have run into issues with the next steps where I actually try to get the server running with some data.

When running
python -m megapose_server.run --host 127.0.0.1 --port 5555 --model RGB --meshes-directory data/models

I get the error:

(megapose) C:\visp-ws\visp-build-vc17\tutorial\tracking\dnn>python -m megapose_server.run --host 127.0.0.1 --port 5555 --model RGB --meshes-directory data/models
Loaded megapose variables {'megapose_dir': './megapose6d', 'megapose_data_dir': './megapose6d/data', 'environment': 'megapose'}
MKL_NUM_THREADS: 1
OMP_NUM_THREADS: 1
CUDA_VISIBLE_DEVICES: 0
EGL_VISIBLE_DEVICES: 0
Traceback (most recent call last):
  File "C:\Users\user_1\miniconda3\envs\megapose\lib\runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\user_1\miniconda3\envs\megapose\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Users\user_1\miniconda3\envs\megapose\lib\site-packages\megapose_server\run.py", line 52, in <module>
    from megapose.inference.utils import make_detections_from_object_data
  File "C:\visp-ws\visp\script\megapose_server\megapose6d\src\megapose\inference\utils.py", line 32, in <module>
    from megapose.config import EXP_DIR
  File "C:\visp-ws\visp\script\megapose_server\megapose6d\src\megapose\config.py", line 62, in <module>
    assert LOCAL_DATA_DIR.exists()
AssertionError

Not sure if this will help but here's my megapose folder set up:
image

And my tutorial folder:
image

thanks and sorry for all the questions!
Matt

@SamFlt
Copy link
Contributor

SamFlt commented Jul 29, 2023

Hi again!
Don't apologize, the issue lies with me as it is a problem with how I setup the installation process :(
Your feedback has already helped me a lot in making the installation more robust ;)
Concerning your last message, I believe this is the same issue: You (we) are using relative paths to point to the Megapose folder.

You have two options to remedy this:

  • Start the megapose server not from the tutorial folder, but from the script/megapose_server directory. You can then open another terminal to start the client (in the tutorial folder)
  • You can change the path to megapose in the script/megapose_server/megapose_variables.json file. You should then replace the relative paths megapose_dir and megapose_data_dir with absolute ones. "./megapose6d" would become "C:/visp-ws/visp-build-vc17/script/megapose_server/megapose6d", same for megapose_data_dir. Make sure that these paths are correct for your setup. Also, since you are using Windows, you should either avoid using backslashes or escape them(\ becomes \). Once this is done, save the json file and rerun the install.py script and you should be good to go. With this solution, you should be able to start the server from anywhere.

Note that this issue will be fixed soon, along with the notebook dependency problem.

Don't hesitate if you have other issues!

Sam

@mattratcliffe
Copy link
Author

Hi Sam

Thanks for the kind words, I'm glad I am helping the process!

Thankyou for the additional information. I have now managed to get the megapose server running with these in my megapose_variables file:

 "megapose_dir": "C:/visp-ws/visp/script/megapose_server/megapose6d",
  "megapose_data_dir": "C:/visp-ws/visp/script/megapose_server/megapose6d",
  "environment": "megapose"

I have run into another issue now when running the tutorial-megapose-live-single-object-tracking.exe

This error appears from the megapose server:

Connected to ('127.0.0.1', 49625)
CameraData(K=array([[605.14672852,   0.        , 325.53253174],
       [  0.        , 604.79150391, 244.95083618],
       [  0.        ,   0.        ,   1.        ]]), resolution=(480, 640), TWC=None, camera_id=None, TWC_init=None)
Traceback (most recent call last):
  File "C:\Users\user_1\anaconda3\envs\megapose\lib\site-packages\megapose_server\run.py", line 448, in run
    code, buffer = receive_message(connection)
  File "C:\Users\user_1\anaconda3\envs\megapose\lib\site-packages\megapose_server\network_utils.py", line 104, in receive_message
    msg_length = s.recv(4)
ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the remote host
Connection broken

And here is the output from the megapose server when it is running:

(megapose) C:\visp-ws\visp-build-vc17\tutorial\tracking\dnn\Release>python -m megapose_server.run --host 127.0.0.1 --port 5555 --model RGB --meshes-directory data/models
Loaded megapose variables {'megapose_dir': 'C:/visp-ws/visp/script/megapose_server/megapose6d', 'megapose_data_dir': 'C:/visp-ws/visp/script/megapose_server/megapose6d', 'environment': 'megapose'}
MKL_NUM_THREADS: 1
OMP_NUM_THREADS: 1
CUDA_VISIBLE_DEVICES: 0
EGL_VISIBLE_DEVICES: 0
Loaded megapose variables {'megapose_dir': 'C:/visp-ws/visp/script/megapose_server/megapose6d', 'megapose_data_dir': 'C:/visp-ws/visp/script/megapose_server/megapose6d', 'environment': 'megapose'}
Loaded megapose variables {'megapose_dir': 'C:/visp-ws/visp/script/megapose_server/megapose6d', 'megapose_data_dir': 'C:/visp-ws/visp/script/megapose_server/megapose6d', 'environment': 'megapose'}
Loaded megapose variables {'megapose_dir': 'C:/visp-ws/visp/script/megapose_server/megapose6d', 'megapose_data_dir': 'C:/visp-ws/visp/script/megapose_server/megapose6d', 'environment': 'megapose'}
Loaded megapose variables {'megapose_dir': 'C:/visp-ws/visp/script/megapose_server/megapose6d', 'megapose_data_dir': 'C:/visp-ws/visp/script/megapose_server/megapose6d', 'environment': 'megapose'}
CameraData(K=array([[700.,   0., 320.],
       [  0., 700., 240.],
       [  0.,   0.,   1.]]), resolution=(480, 640), TWC=None, camera_id=None, TWC_init=None)
Known pipe types:
  wglGraphicsPipe
(all display modules loaded.)
MKL_NUM_THREADS: 1
OMP_NUM_THREADS: 1
CUDA_VISIBLE_DEVICES: 0
EGL_VISIBLE_DEVICES: 0
MKL_NUM_THREADS: 1
OMP_NUM_THREADS: 1
CUDA_VISIBLE_DEVICES: 0
EGL_VISIBLE_DEVICES: 0
MKL_NUM_THREADS: 1
OMP_NUM_THREADS: 1
CUDA_VISIBLE_DEVICES: 0
EGL_VISIBLE_DEVICES: 0
MKL_NUM_THREADS: 1
OMP_NUM_THREADS: 1
CUDA_VISIBLE_DEVICES: 0
EGL_VISIBLE_DEVICES: 0
:display(warning): FrameBufferProperties available less than requested.
  requested: depth_bits=1 color_bits=3 red_bits=1 green_bits=1 blue_bits=1 alpha_bits=1 multisamples=4 back_buffers=1 force_hardware
  got: depth_bits=24 color_bits=24 red_bits=8 green_bits=8 blue_bits=8 alpha_bits=8 accum_bits=64 force_hardware
MegaPose server listening for connections
Known pipe types:
  wglGraphicsPipe
(all display modules loaded.)
Known pipe types:
  wglGraphicsPipe
(all display modules loaded.)
Known pipe types:
  wglGraphicsPipeKnown pipe types:

  (all display modules loaded.)
wglGraphicsPipe
(all display modules loaded.)
:display(warning): FrameBufferProperties available less than requested.
  requested: depth_bits=1 color_bits=3 red_bits=1 green_bits=1 blue_bits=1 alpha_bits=1 multisamples=4 back_buffers=1 force_hardware
  got: depth_bits=24 color_bits=24 red_bits=8 green_bits=8 blue_bits=8 alpha_bits=8 accum_bits=64 force_hardware
:display(warning): FrameBufferProperties available less than requested.
  requested: depth_bits=1 color_bits=3 red_bits=1 green_bits=1 blue_bits=1 alpha_bits=1 multisamples=4 back_buffers=1 force_hardware
  got: depth_bits=24 color_bits=24 red_bits=8 green_bits=8 blue_bits=8 alpha_bits=8 accum_bits=64:display (force_hardware warning
): FrameBufferProperties available less than requested.
  requested: depth_bits=1 color_bits=3 red_bits=1 green_bits=1 blue_bits=1 alpha_bits=1 multisamples=4 back_buffers=1 force_hardware
  got: depth_bits=24 color_bits=24 red_bits=8 green_bits=8 blue_bits=8 alpha_bits=8 accum_bits=64 force_hardware
:display(warning): FrameBufferProperties available less than requested.
  requested: depth_bits=1 color_bits=3 red_bits=1 green_bits=1 blue_bits=1 alpha_bits=1 multisamples=4 back_buffers=1 force_hardware
  got: depth_bits=24 color_bits=24 red_bits=8 green_bits=8 blue_bits=8 alpha_bits=8 accum_bits=64 force_hardware

thanks
Matt

@mattratcliffe
Copy link
Author

Additionally here is the log when trying to execute tutorial-megapose-live-single-object-tracking.exe

(base) C:\visp-ws\visp-build-vc17\tutorial\tracking\dnn\Release>tutorial-megapose-live-single-object-tracking --config data/megapose_cube.json megapose/address 127.0.0.1 megapose/port 5555 video-device data/cube_video.mp4
[vpDetectorDNNOpenCV::setParsingMethod] NB: scale factor changed to 1/255. to normalize pixels value.

(base) C:\visp-ws\visp-build-vc17\tutorial\tracking\dnn\Release>

@SamFlt
Copy link
Contributor

SamFlt commented Aug 3, 2023

Hi Matt,

Just to be sure, is anything happening when you run the tutorial? Is the video playing in a new window?

Also, what GPU do you have? Panda3D, the renderer behind Megapose, is giving you a warning about not having a backbuffer.
Could you run nvidia-smifrom your megapose conda environment?

Thanks,
Sam

@mattratcliffe
Copy link
Author

Hey Sam

Thanks for the reply. No I am not getting any video playing in a new window. The terminal opens and closes briefly and that is it.

This is my output from nvidia-smi :

Sat Aug  5 14:56:47 2023
+---------------------------------------------------------------------------------------+
| NVIDIA-SMI 536.67                 Driver Version: 536.67       CUDA Version: 12.2     |
|-----------------------------------------+----------------------+----------------------+
| GPU  Name                     TCC/WDDM  | Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp   Perf          Pwr:Usage/Cap |         Memory-Usage | GPU-Util  Compute M. |
|                                         |                      |               MIG M. |
|=========================================+======================+======================|
|   0  NVIDIA GeForce RTX 2080 ...  WDDM  | 00000000:01:00.0  On |                  N/A |
| N/A   45C    P8               8W /  80W |    829MiB /  8192MiB |      5%      Default |
|                                         |                      |                  N/A |
+-----------------------------------------+----------------------+----------------------+

+---------------------------------------------------------------------------------------+
| Processes:                                                                            |
|  GPU   GI   CI        PID   Type   Process name                            GPU Memory |
|        ID   ID                                                             Usage      |
|=======================================================================================|
|    0   N/A  N/A      3128    C+G   C:\Windows\explorer.exe                   N/A      |
|    0   N/A  N/A      6284    C+G   ...t.LockApp_cw5n1h2txyewy\LockApp.exe    N/A      |
|    0   N/A  N/A      7080    C+G   ...5n1h2txyewy\ShellExperienceHost.exe    N/A      |
|    0   N/A  N/A      9332    C+G   ...\iCloud\WebView2\msedgewebview2.exe    N/A      |
|    0   N/A  N/A      9484    C+G   ...7.0_x64__cv1g1gvanyjgm\WhatsApp.exe    N/A      |
|    0   N/A  N/A     11820    C+G   ...GeForce Experience\NVIDIA Share.exe    N/A      |
|    0   N/A  N/A     11856    C+G   ....5131.0_x64__8j3eq9eme6ctt\IGCC.exe    N/A      |
|    0   N/A  N/A     13028    C+G   ...l\gitkraken\app-9.6.1\gitkraken.exe    N/A      |
|    0   N/A  N/A     13556    C+G   ...CBS_cw5n1h2txyewy\TextInputHost.exe    N/A      |
|    0   N/A  N/A     13608    C+G   ...siveControlPanel\SystemSettings.exe    N/A      |
|    0   N/A  N/A     16536    C+G   ...2txyewy\StartMenuExperienceHost.exe    N/A      |
|    0   N/A  N/A     16788    C+G   ...nt.CBS_cw5n1h2txyewy\SearchHost.exe    N/A      |
|    0   N/A  N/A     16956    C+G   ...a\Local\slack\app-4.33.84\slack.exe    N/A      |
|    0   N/A  N/A     17952    C+G   ...e Stream\78.0.1.0\GoogleDriveFS.exe    N/A      |
|    0   N/A  N/A     18512    C+G   ...ejd91yc\AdobeNotificationClient.exe    N/A      |
|    0   N/A  N/A     18700    C+G   ...ekyb3d8bbwe\PhoneExperienceHost.exe    N/A      |
|    0   N/A  N/A     18784    C+G   ...34.0_x64__zpdnekdrzrea0\Spotify.exe    N/A      |
|    0   N/A  N/A     26048    C+G   ...n\115.0.1901.188\msedgewebview2.exe    N/A      |
|    0   N/A  N/A     27060    C+G   ...Brave-Browser\Application\brave.exe    N/A      |
|    0   N/A  N/A     27428    C+G   ...__8wekyb3d8bbwe\WindowsTerminal.exe    N/A      |
+---------------------------------------------------------------------------------------+

I'll keep digging around to see why my GPU is causing issues.

thanks
Matt

@SamFlt
Copy link
Contributor

SamFlt commented Aug 9, 2023

Hi again Matt,

I was able to reproduce the issue (a networking problem) and fix it. I have however encountered another problem with Panda3D, a dependency of Megapose. I'm afraid that the graphics pipeline on Windows (wglGraphicsPipe) does not have meet the requirements to run Megapose. I'll keep digging to see if something can be done.

@SamFlt
Copy link
Contributor

SamFlt commented Aug 10, 2023

A potential solution for Windows users is to install and run the server in a WSL container. The install and usage is basically the same as on Linux.

The steps would be as follows:

  • Install WSL
  • In WSL, install conda and git
  • Clone the visp repo and launch the installation script in the script/megapose_server folder, as you've done before
  • If when running inference, you have an issue about not being able to find libcudnn_*.so or libcuda.so, try to enter the following in the terminal: export LD_LIBRARY_PATH=/usr/lib/wsl/lib:$LD_LIBRARY_PATH, then restart the server
  • Your server should now be running. From windows, you should be able to connect to it with the IP 127.0.0.1 and the port that you chose (default 5555). If not, check that the server is indeed running and that WSL performs port forwarding to the local host.

I will soon push a PR with some fixes for Windows and improvements for Megapose, stay tuned!

Cheers,
Sam

@mattratcliffe
Copy link
Author

mattratcliffe commented Aug 10, 2023

Hi Sam

Thanks very much for continuing to look into this. I will set up the WSL container and report back.

thanks
Matt

@mattratcliffe
Copy link
Author

Hi @SamFlt

I managed to install megapose on WSL but when trying to run I get a similar error to the one I had back in : #1204 (comment)

(megapose) mattratcliffe@DESKTOP-MO3NOCB:~/visp-ws/visp/script$ python -m megapose_server.run -h
Loaded megapose variables {'megapose_dir': './megapose6d', 'megapose_data_dir': './megapose6d/data', 'environment': 'megapose'}
Traceback (most recent call last):
  File "/home/mattratcliffe/anaconda3/envs/megapose/lib/python3.9/runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/home/mattratcliffe/anaconda3/envs/megapose/lib/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/home/mattratcliffe/visp-ws/visp/script/megapose_server/run.py", line 45, in <module>
    from megapose.datasets.object_dataset import RigidObject, RigidObjectDataset
ModuleNotFoundError: No module named 'megapose'
(megapose) mattratcliffe@DESKTOP-MO3NOCB:~/visp-ws/visp/script$

And dir :

(megapose) mattratcliffe@DESKTOP-MO3NOCB:~/visp-ws/visp/script$ dir
Blender                      PerfVisualize.py         create_module.py         megapose_server
LonLatCamPosesVisualizer.py  PlotCameraTrajectory.py  format-coding-style.sh   plot-ibvs-control-law.py
PerfCompare.py               README.md                make-coverage-report.sh

@SamFlt
Copy link
Contributor

SamFlt commented Aug 10, 2023

Hey Matt,

Did you get any error when running install.py?

@mattratcliffe
Copy link
Author

Hey Sam,

I did initially but that was due to the notebook package version issue. I changed it too : notebook==6.5.4 and it installed fine.

thanks
Matt

@SamFlt
Copy link
Contributor

SamFlt commented Aug 11, 2023

Hey Matt,

I just pushed a PR ( #1216) that includes the fix for Windows (client side), the issue with the notebook version and the problem with relative paths during installation. It's there if you want to try it out :)

Sam

@mattratcliffe
Copy link
Author

Hi Sam

Many thanks for that. I checked out the PR and reinstalled the megapose server on windows. I did hit some more issues unfortunately when trying to run it:

(megapose) C:\visp-ws\visp-build-vc17\tutorial\tracking\dnn\Release>python -m megapose_server.run --host 127.0.0.1 --port 5555 --model RGB --meshes-directory data/models
Traceback (most recent call last):
  File "C:\Users\user_1\anaconda3\envs\megapose\lib\runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\user_1\anaconda3\envs\megapose\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Users\user_1\anaconda3\envs\megapose\lib\site-packages\megapose_server\run.py", line 7, in <module>
    with open(variables_file, 'r') as f:
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\user_1\\anaconda3\\envs\\megapose\\lib\\site-packages\\megapose_server\\megapose_variables_final.json'

I solved this by adding megapose_variables_final.json into C:\Users\user_1\anaconda3\envs\megapose\Lib\site-packages\megapose_server

I thought this had done the trick but when I run it again it cannot find the cube.obj models, I've added the full log below:

(megapose) C:\visp-ws\visp-build-vc17\tutorial\tracking\dnn\Release>python -m megapose_server.run --host 127.0.0.1 --port 5555 --model RGB --meshes-directory data/models
Loaded megapose variables {'megapose_dir': 'C:\\visp-ws\\visp\\script\\megapose_server\\megapose6d', 'megapose_data_dir': 'C:\\visp-ws\\visp\\script\\megapose_server\\megapose6d\\data', 'environment': 'megapose'}
MKL_NUM_THREADS: 1
OMP_NUM_THREADS: 1
CUDA_VISIBLE_DEVICES: 0
EGL_VISIBLE_DEVICES: 0
Loaded megapose variables {'megapose_dir': 'C:\\visp-ws\\visp\\script\\megapose_server\\megapose6d', 'megapose_data_dir': 'C:\\visp-ws\\visp\\script\\megapose_server\\megapose6d\\data', 'environment': 'megapose'}
Loaded megapose variables {'megapose_dir': 'C:\\visp-ws\\visp\\script\\megapose_server\\megapose6d', 'megapose_data_dir': 'C:\\visp-ws\\visp\\script\\megapose_server\\megapose6d\\data', 'environment': 'megapose'}
Loaded megapose variables {'megapose_dir': 'C:\\visp-ws\\visp\\script\\megapose_server\\megapose6d', 'megapose_data_dir': 'C:\\visp-ws\\visp\\script\\megapose_server\\megapose6d\\data', 'environment': 'megapose'}
Loaded megapose variables {'megapose_dir': 'C:\\visp-ws\\visp\\script\\megapose_server\\megapose6d', 'megapose_data_dir': 'C:\\visp-ws\\visp\\script\\megapose_server\\megapose6d\\data', 'environment': 'megapose'}
CameraData(K=array([[700.,   0., 320.],
       [  0., 700., 240.],
       [  0.,   0.,   1.]]), resolution=(480, 640), TWC=None, camera_id=None, TWC_init=None)
Known pipe types:
  wglGraphicsPipe
(all display modules loaded.)
MKL_NUM_THREADS: 1
OMP_NUM_THREADS: 1
CUDA_VISIBLE_DEVICES: 0
EGL_VISIBLE_DEVICES: 0
MKL_NUM_THREADS: 1
OMP_NUM_THREADS: 1
CUDA_VISIBLE_DEVICES: 0
EGL_VISIBLE_DEVICES: 0
MKL_NUM_THREADS: 1
OMP_NUM_THREADS: 1
CUDA_VISIBLE_DEVICES: 0
EGL_VISIBLE_DEVICES: 0
MKL_NUM_THREADS: 1
OMP_NUM_THREADS: 1
CUDA_VISIBLE_DEVICES: 0
EGL_VISIBLE_DEVICES: 0
:display(warning): FrameBufferProperties available less than requested.
  requested: depth_bits=1 color_bits=3 red_bits=1 green_bits=1 blue_bits=1 alpha_bits=1 multisamples=4 back_buffers=1 force_hardware
  got: depth_bits=24 color_bits=24 red_bits=8 green_bits=8 blue_bits=8 alpha_bits=8 accum_bits=64 force_hardware
Warming up models...
Known pipe types:
  wglGraphicsPipe
(all display modules loaded.)
Known pipe types:
  wglGraphicsPipe
(all display modules loaded.)
Known pipe types:
  wglGraphicsPipe
(all display modules loaded.)
Known pipe types:
  wglGraphicsPipe
(all display modules loaded.)
:display(warning): FrameBufferProperties available less than requested.
  requested: depth_bits=1 color_bits=3 red_bits=1 green_bits=1 blue_bits=1 alpha_bits=1 multisamples=4 back_buffers=1 force_hardware
  got: depth_bits=24 color_bits=24 red_bits=8 green_bits=8 blue_bits=8 alpha_bits=8 accum_bits=64 force_hardware
:display(warning): FrameBufferProperties available less than requested.
  requested: depth_bits=1 color_bits=3 red_bits=1 green_bits=1 blue_bits=1 alpha_bits=1 multisamples=4 back_buffers=1 force_hardware
  got: depth_bits=24 color_bits=24 red_bits=8 green_bits=8 blue_bits=8 alpha_bits=8 accum_bits=64 force_hardware
:display(warning): FrameBufferProperties available less than requested.
  requested: depth_bits=1 color_bits=3 red_bits=1 green_bits=1 blue_bits=1 alpha_bits=1 multisamples=4 back_buffers=1 force_hardware
  got: depth_bits=24 color_bits=24 red_bits=8 green_bits=8 blue_bits=8 alpha_bits=8 accum_bits=64 force_hardware
:display(warning): FrameBufferProperties available less than requested.
  requested: depth_bits=1 color_bits=3 red_bits=1 green_bits=1 blue_bits=1 alpha_bits=1 multisamples=4 back_buffers=1 force_hardware
  got: depth_bits=24 color_bits=24 red_bits=8 green_bits=8 blue_bits=8 alpha_bits=8 accum_bits=64 force_hardware
:loader(error): Couldn't load file C:\visp-ws\visp-build-vc17\tutorial\tracking\dnn\Release\data\models\cube\cube.obj: not found on model path (currently: ":loader(error): /c/visp-ws/visp-build-vc17/tutorial/tracking/dnn/Release:loader(Couldn't load file C:\visp-ws\visp-build-vc17\tutorial\tracking\dnn\Release\data\models\cube\cube.obj: not found on model path (currently: ";:loadererror/c/visp-ws/visp-build-vc17/tutorial/tracking/dnn/Release;/c/Users/user_1/anaconda3/envs/megapose/Lib/site-packages/panda3d/etc/..;/c/Users/user_1/anaconda3/envs/megapose/Lib/site-packages/panda3d/etc/..(error): Couldn't load file C:\visp-ws\visp-build-vc17\tutorial\tracking\dnn\Release\data\models\cube\cube.obj: not found on model path ;): /c/Users/user_1/anaconda3/envs/megapose/Lib/site-packages/panda3d/etc/../models(currently: "/c/Users/user_1/anaconda3/envs/megapose/Lib/site-packages/panda3d/etc/../modelsCouldn't load file ")
/c/visp-ws/visp-build-vc17/tutorial/tracking/dnn/Release")
C:\visp-ws\visp-build-vc17\tutorial\tracking\dnn\Release\data\models\cube\cube.obj: not found on model path Process Process-4:
;/c/Users/user_1/anaconda3/envs/megapose/Lib/site-packages/panda3d/etc/..;Process Process-1:
(currently: "/c/Users/user_1/anaconda3/envs/megapose/Lib/site-packages/panda3d/etc/../models/c/visp-ws/visp-build-vc17/tutorial/tracking/dnn/Release")
;/c/Users/user_1/anaconda3/envs/megapose/Lib/site-packages/panda3d/etc/..;Process Process-2:
/c/Users/user_1/anaconda3/envs/megapose/Lib/site-packages/panda3d/etc/../models")
Process Process-3:
Traceback (most recent call last):
  File "C:\Users\user_1\anaconda3\envs\megapose\lib\multiprocessing\process.py", line 315, in _bootstrap
    self.run()
  File "C:\Users\user_1\anaconda3\envs\megapose\lib\multiprocessing\process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "C:\visp-ws\visp\script\megapose_server\megapose6d\src\megapose\panda3d_renderer\panda3d_batch_renderer.py", line 120, in worker_loop
    renderings = renderer.render_scene(
  File "C:\visp-ws\visp\script\megapose_server\megapose6d\src\megapose\panda3d_renderer\panda3d_scene_renderer.py", line 312, in render_scene
    object_nodes = self.setup_scene(root_node, object_datas)
Traceback (most recent call last):
  File "C:\visp-ws\visp\script\megapose_server\megapose6d\src\megapose\panda3d_renderer\panda3d_scene_renderer.py", line 225, in setup_scene
    self.get_object_node(label).instanceTo(obj_node)
  File "C:\Users\user_1\anaconda3\envs\megapose\lib\multiprocessing\process.py", line 315, in _bootstrap
    self.run()
  File "C:\visp-ws\visp\script\megapose_server\megapose6d\src\megapose\panda3d_renderer\panda3d_scene_renderer.py", line 203, in get_object_node
    node = self._app.loader.load_model(str(asset.mesh_path), noCache=True)
Traceback (most recent call last):
  File "C:\Users\user_1\anaconda3\envs\megapose\lib\multiprocessing\process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "C:\Users\user_1\anaconda3\envs\megapose\lib\site-packages\direct\showbase\Loader.py", line 298, in loadModel
    raise IOError(message)
Traceback (most recent call last):
  File "C:\Users\user_1\anaconda3\envs\megapose\lib\multiprocessing\process.py", line 315, in _bootstrap
    self.run()
  File "C:\visp-ws\visp\script\megapose_server\megapose6d\src\megapose\panda3d_renderer\panda3d_batch_renderer.py", line 120, in worker_loop
    renderings = renderer.render_scene(
OSError: Could not load model file(s): ['C:\\visp-ws\\visp-build-vc17\\tutorial\\tracking\\dnn\\Release\\data\\models\\cube\\cube.obj']
  File "C:\Users\user_1\anaconda3\envs\megapose\lib\multiprocessing\process.py", line 315, in _bootstrap
    self.run()
  File "C:\Users\user_1\anaconda3\envs\megapose\lib\multiprocessing\process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "C:\visp-ws\visp\script\megapose_server\megapose6d\src\megapose\panda3d_renderer\panda3d_scene_renderer.py", line 312, in render_scene
    object_nodes = self.setup_scene(root_node, object_datas)
  File "C:\Users\user_1\anaconda3\envs\megapose\lib\multiprocessing\process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "C:\visp-ws\visp\script\megapose_server\megapose6d\src\megapose\panda3d_renderer\panda3d_batch_renderer.py", line 120, in worker_loop
    renderings = renderer.render_scene(
  File "C:\visp-ws\visp\script\megapose_server\megapose6d\src\megapose\panda3d_renderer\panda3d_scene_renderer.py", line 225, in setup_scene
    self.get_object_node(label).instanceTo(obj_node)
  File "C:\visp-ws\visp\script\megapose_server\megapose6d\src\megapose\panda3d_renderer\panda3d_batch_renderer.py", line 120, in worker_loop
    renderings = renderer.render_scene(
  File "C:\visp-ws\visp\script\megapose_server\megapose6d\src\megapose\panda3d_renderer\panda3d_scene_renderer.py", line 312, in render_scene
    object_nodes = self.setup_scene(root_node, object_datas)
  File "C:\visp-ws\visp\script\megapose_server\megapose6d\src\megapose\panda3d_renderer\panda3d_scene_renderer.py", line 203, in get_object_node
    node = self._app.loader.load_model(str(asset.mesh_path), noCache=True)
  File "C:\visp-ws\visp\script\megapose_server\megapose6d\src\megapose\panda3d_renderer\panda3d_scene_renderer.py", line 312, in render_scene
    object_nodes = self.setup_scene(root_node, object_datas)
  File "C:\visp-ws\visp\script\megapose_server\megapose6d\src\megapose\panda3d_renderer\panda3d_scene_renderer.py", line 225, in setup_scene
    self.get_object_node(label).instanceTo(obj_node)
  File "C:\Users\user_1\anaconda3\envs\megapose\lib\site-packages\direct\showbase\Loader.py", line 298, in loadModel
    raise IOError(message)
  File "C:\visp-ws\visp\script\megapose_server\megapose6d\src\megapose\panda3d_renderer\panda3d_scene_renderer.py", line 225, in setup_scene
    self.get_object_node(label).instanceTo(obj_node)
  File "C:\visp-ws\visp\script\megapose_server\megapose6d\src\megapose\panda3d_renderer\panda3d_scene_renderer.py", line 203, in get_object_node
    node = self._app.loader.load_model(str(asset.mesh_path), noCache=True)
OSError: Could not load model file(s): ['C:\\visp-ws\\visp-build-vc17\\tutorial\\tracking\\dnn\\Release\\data\\models\\cube\\cube.obj']
  File "C:\visp-ws\visp\script\megapose_server\megapose6d\src\megapose\panda3d_renderer\panda3d_scene_renderer.py", line 203, in get_object_node
    node = self._app.loader.load_model(str(asset.mesh_path), noCache=True)
  File "C:\Users\user_1\anaconda3\envs\megapose\lib\site-packages\direct\showbase\Loader.py", line 298, in loadModel
    raise IOError(message)
  File "C:\Users\user_1\anaconda3\envs\megapose\lib\site-packages\direct\showbase\Loader.py", line 298, in loadModel
    raise IOError(message)
OSError: Could not load model file(s): ['C:\\visp-ws\\visp-build-vc17\\tutorial\\tracking\\dnn\\Release\\data\\models\\cube\\cube.obj']
OSError: Could not load model file(s): ['C:\\visp-ws\\visp-build-vc17\\tutorial\\tracking\\dnn\\Release\\data\\models\\cube\\cube.obj']

As you can see the models are present in the folder it is trying to find:
image

I am presuming you wanted to run this via windows and not WSL?

thanks
Matt

@SamFlt
Copy link
Contributor

SamFlt commented Aug 17, 2023

Hi Matt,

Sorry for the delay in the response.

You should install the megapose server in WSL, as it seems that megapose does not directly support Windows (the error you encounter here is a part of a problem that could easily be fixed, but there are other issues that are not so easy to debug).

The client (the .exe), can be run on Windows with the PR I linked above.

Sam

@mattratcliffe
Copy link
Author

mattratcliffe commented Aug 17, 2023

Hi Sam

No problem, thanks for responding. I also tried to run it on WSL to see if I had any better success.

When installing I get this error:

Successfully built megapose
Installing collected packages: setuptools-scm, megapose
Successfully installed megapose-1.0 setuptools-scm-7.1.0
Downloading megapose models...
/home/mattratcliffe/anaconda3/envs/megapose/bin/rclone copyto inria_data:megapose-models/ /home/mattratcliffe/visp-ws/visp/script/megapose_server/megapose6d/data/megapose-models --exclude *epoch* --config /home/mattratcliffe/visp-ws/visp/script/megapose_server/megapose6d/rclone.conf --progress
2023-08-12 16:42:51 ERROR : https://www.paris.inria.fr/archive_ylabbeprojectsdata/megapose/megapose-models/: error reading source root directory: error listing "": failed to readDir: Get "https://www.paris.inria.fr/archive_ylabbeprojectsdata/megapose/megapose-models/": tls: failed to verify certificate: x509: certificate signed by unknown authority
2023-08-12 16:42:51 ERROR : Attempt 1/3 failed with 1 errors and: error listing "": failed to readDir: Get "https://www.paris.inria.fr/archive_ylabbeprojectsdata/megapose/megapose-models/": tls: failed to verify certificate: x509: certificate signed by unknown authority
2023-08-12 16:42:51 ERROR : https://www.paris.inria.fr/archive_ylabbeprojectsdata/megapose/megapose-models/: error reading source root directory: error listing "": failed to readDir: Get "https://www.paris.inria.fr/archive_ylabbeprojectsdata/megapose/megapose-models/": tls: failed to verify certificate: x509: certificate signed by unknown authority
2023-08-12 16:42:51 ERROR : Attempt 2/3 failed with 1 errors and: error listing "": failed to readDir: Get "https://www.paris.inria.fr/archive_ylabbeprojectsdata/megapose/megapose-models/": tls: failed to verify certificate: x509: certificate signed by unknown authority
2023-08-12 16:42:51 ERROR : https://www.paris.inria.fr/archive_ylabbeprojectsdata/megapose/megapose-models/: error reading source root directory: error listing "": failed to readDir: Get "https://www.paris.inria.fr/archive_ylabbeprojectsdata/megapose/megapose-models/": tls: failed to verify certificate: x509: certificate signed by unknown authority
2023-08-12 16:42:51 ERROR : Attempt 3/3 failed with 1 errors and: error listing "": failed to readDir: Get "https://www.paris.inria.fr/archive_ylabbeprojectsdata/megapose/megapose-models/": tls: failed to verify certificate: x509: certificate signed by unknown authority
Transferred:              0 B / 0 B, -, 0 B/s, ETA -
Errors:                 1 (retrying may help)
Elapsed time:         1.3s
2023/08/12 16:42:51 Failed to copyto: error listing "": failed to readDir: Get "https://www.paris.inria.fr/archive_ylabbeprojectsdata/megapose/megapose-models/": tls: failed to verify certificate: x509: certificate signed by unknown authority
Traceback (most recent call last):
  File "/home/mattratcliffe/visp-ws/visp/script/megapose_server/install.py", line 138, in <module>
    download_models(megapose_environment, megapose_dir, megapose_data_dir)
  File "/home/mattratcliffe/visp-ws/visp/script/megapose_server/install.py", line 88, in download_models
    subprocess.run(arguments, check=True)
  File "/home/mattratcliffe/anaconda3/lib/python3.11/subprocess.py", line 571, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['/home/mattratcliffe/anaconda3/envs/megapose/bin/rclone', 'copyto', 'inria_data:megapose-models/', '/home/mattratcliffe/visp-ws/visp/script/megapose_server/megapose6d/data/megapose-models', '--exclude', '*epoch*', '--config', '/home/mattratcliffe/visp-ws/visp/script/megapose_server/megapose6d/rclone.conf', '--progress']' returned non-zero exit status 1.

And when I try to run the megapose server I get the following:

(megapose) mattratcliffe@DESKTOP-MO3NOCB:~/visp-ws/visp/script/megapose_server$ python -m megapose_server.run --host 127.0.0.1 --port 5555 --model RGB --meshes-directory data/models
/home/mattratcliffe/anaconda3/envs/megapose/bin/python: Error while finding module specification for 'megapose_server.run' (ModuleNotFoundError: No module named 'megapose_server')

thanks
Matt

@SamFlt
Copy link
Contributor

SamFlt commented Aug 17, 2023

Hey,

It seems that the first error is an issue with downloading the megapose models. I also have this error if I run the script provided with megapose itself. I'll try and provide an alternate download source and raise an issue on their GitHub.

The second error is a result of the first one: since you couldn't download the models, the install script was aborted before installing the megapose_server package.

Sam

@mattratcliffe
Copy link
Author

Hi Sam

Thanks for explaining the errors.

Appreciate the continued support and I'll keep an eye out for a new download source.

thanks
Matt

@SamFlt
Copy link
Contributor

SamFlt commented Aug 23, 2023

Hi Matt,

The issue with the download server has been resolved by the people at Inria Paris. You should now be able to download the models as expected.

We're still looking into setting up another mirror.

Sam

@mattratcliffe
Copy link
Author

Hi Sam

Many thanks for the update. I reinstalled the Megapose server and it seems to have downloaded the models.

When I try to run it I did get the following error.

(megapose) mattratcliffe@DESKTOP-MO3NOCB:~/visp-ws/visp-build/tutorial/tracking/dnn/Release$ python -m megapose_server.run --host 127.0.0.1 --port 5555 --model RGB --meshes-directory data/models
Traceback (most recent call last):
  File "/home/mattratcliffe/anaconda3/envs/megapose/lib/python3.9/runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/home/mattratcliffe/anaconda3/envs/megapose/lib/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/home/mattratcliffe/anaconda3/envs/megapose/lib/python3.9/site-packages/megapose_server/run.py", line 7, in <module>
    with open(variables_file, 'r') as f:
FileNotFoundError: [Errno 2] No such file or directory: '/home/mattratcliffe/anaconda3/envs/megapose/lib/python3.9/site-packages/megapose_server/megapose_variables_final.json'
(megapose) mattratcliffe@DESKTOP-MO3NOCB:~/visp-ws/visp-build/tutorial/tracking/dnn/Release$

I added a megapose_variables_final.json file with the following parameters:

{"megapose_dir": "home/mattratcliffe/anaconda3/envs/megapose/lib/python3.9/site-packages/megapose_server", "megapose_data_dir": "home/mattratcliffe/visp-ws/visp/script/megapose_server/megapose6d/data", "environment": "megapose"}

However when running again I now get this error:

(megapose) mattratcliffe@DESKTOP-MO3NOCB:~/visp-ws/visp-build/tutorial/tracking/dnn/Release$ python -m megapose_server.run --host 127.0.0.1 --port 5555 --model RGB --meshes-directory data/models
Loaded megapose variables {'megapose_dir': 'home/mattratcliffe/anaconda3/envs/megapose/lib/python3.9/site-packages/megapose_server', 'megapose_data_dir': 'home/mattratcliffe/visp-ws/visp/script/megapose_server/megapose6d/data', 'environment': 'megapose'}
MKL_NUM_THREADS: 1
OMP_NUM_THREADS: 1
CUDA_VISIBLE_DEVICES: 0
EGL_VISIBLE_DEVICES: 0
Traceback (most recent call last):
  File "/home/mattratcliffe/anaconda3/envs/megapose/lib/python3.9/runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/home/mattratcliffe/anaconda3/envs/megapose/lib/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/home/mattratcliffe/anaconda3/envs/megapose/lib/python3.9/site-packages/megapose_server/run.py", line 52, in <module>
    from megapose.inference.utils import make_detections_from_object_data
  File "/home/mattratcliffe/visp-ws/visp/script/megapose_server/megapose6d/src/megapose/inference/utils.py", line 32, in <module>
    from megapose.config import EXP_DIR
  File "/home/mattratcliffe/visp-ws/visp/script/megapose_server/megapose6d/src/megapose/config.py", line 62, in <module>
    assert LOCAL_DATA_DIR.exists()
AssertionError
(megapose) mattratcliffe@DESKTOP-MO3NOCB:~/visp-ws/visp-build/tutorial/tracking/dnn/Release$

Is this something to do with not being able to find the data?

Matt

@SamFlt
Copy link
Contributor

SamFlt commented Aug 23, 2023

Hey Matt,

I'll investigate the file file missing from the installed package!

As for your temporary fix, I think that the value for megapose is probably wrong. it should probably be "/home/mattratcliffe/visp-ws/visp/script/megapose_server/megapose6d" as for the megapose_data_dir, you're missing a leading slash, it should be "/home/mattratcliffe/visp-ws/visp/script/megapose_server/megapose6d/"

Sam

@mattratcliffe
Copy link
Author

mattratcliffe commented Aug 25, 2023

Hi Sam

Thanks, that will teach me to write code when tired!

I actually had to use
"megapose_data_dir": "/home/mattratcliffe/visp-ws/visp/script/megapose_server/megapose6d/data"

With "data" on the end of the path otherwise it cannot find a config.yaml file.

I've managed to get it executing but still getting errors. However these I think are being caused by WSL2 not being able see my GPU.

thanks
Matt

@SamFlt
Copy link
Contributor

SamFlt commented Sep 1, 2023

Hi Matt,

Before starting the server, did you input export LD_LIBRARY_PATH=/usr/lib/wsl/lib:$LD_LIBRARY_PATH?

Sam

@mattratcliffe
Copy link
Author

mattratcliffe commented Sep 3, 2023

Hi Sam

Thanks for the support. I switched to another machine and installed Ubuntu fresh as I kept getting CUDA issues with WSL.

Could I ask what GPU you are using when running Megapose? I believe I have it all working but I am now running out of memory.

RuntimeError: CUDA out of memory. Tried to allocate 1.17 GiB (GPU 0; 5.80 GiB total capacity; 4.43 GiB already allocated; 367.88 MiB free; 4.53 GiB reserved in total by PyTorch) If reserved memory is >> allocated memory try setting max_split_size_mb to avoid fragmentation. See documentation for Memory Management and PYTORCH_CUDA_ALLOC_CONF

Here's what I am running

| 
NVIDIA-SMI 535.86.05              Driver Version: 535.86.05    CUDA Version: 12.2     |
|-----------------------------------------+----------------------+----------------------+
| 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  NVIDIA GeForce GTX 1660 Ti     Off | 00000000:01:00.0 Off |                  N/A |
| N/A   53C    P0              16W /  80W |      6MiB /  6144MiB |      0%      Default |
|                                         |        | NVIDIA-SMI 535.86.05              Driver Version: 535.86.05    CUDA Version: 12.2     |
|-----------------------------------------+----------------------+----------------------+
| 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  NVIDIA GeForce GTX 1660 Ti     Off | 00000000:01:00.0 Off |                  N/A |
| N/A   53C    P0              16W /  80W |      6MiB /  6144MiB |      0%      Default |
|                                         |                      |                  N/A |
+-----------------------------------------+----------------------+----------------------+
                                                                                         
+---------------------------------------------------------------------------------------+
| Processes:                                                                            |
|  GPU   GI   CI        PID   Type   Process name                            GPU Memory |
|        ID   ID                                                             Usage      |
|===================```                                              |
|  GPU   GI   CI        PID   Type   Process name                            GPU Memory |
|        ID   ID                                                             Usage      |
|=======================================================================================|
|    0   N/A  N/A      1252      G   /usr/lib/xorg/Xorg                            4MiB |

I also look to close this issue after this as I think my issues are now hardware related.

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