meshcat-dev / meshcat-python

WebGL-based 3D visualizer for Python
MIT License
259 stars 63 forks source link

Setting up development environment #42

Closed danieljfarrell closed 5 years ago

danieljfarrell commented 5 years ago

I'm having some trouble setting up a development environment for meshcat. Can anyone see what I'm doing wrong?

I've created an environment using,

pyenv virtualenv 3.7.2 meshcat_env
pyenv activate meshcat_env
pip install -e meshcat-python
pip install jupyter

The line pip install -e meshcat-python installs meshcat into that environment using the cloned github repository directory.

Running the src/meshcat/examples/box.py opens a browser tab but the page is entirely blank and results in the warning,

/Users/daniel/dev/Python/meshcat-python/src/meshcat/servers/zmqserver.py:27: DeprecationWarning: zmq.eventloop.ioloop is deprecated in pyzmq 17. pyzmq now works with default tornado and asyncio eventloops.
  ioloop.install()
You can open the visualizer by visiting the following URL:
http://127.0.0.1:7000/static/
WARNING:tornado.access:404 GET /static/main.min.js (127.0.0.1) 1.68ms
0.0009292042255401611

A similar problem occurs when with demo.ipynb, the opened window is blank (and so is the jupyter cell for the visualiser). The terminal reports the following warning,

[W 08:35:36.692 NotebookApp] Notebook meshcat-python/demo.ipynb is not trusted
[I 08:35:37.519 NotebookApp] Kernel started: b154dd5c-a7fc-46b7-8e4c-01a8d9420356
[I 08:35:38.204 NotebookApp] Adapting to protocol v5.1 for kernel b154dd5c-a7fc-46b7-8e4c-01a8d9420356
/Users/daniel/.pyenv/versions/3.7.2/envs/meshcat_env/lib/python3.7/site-packages/notebook/base/zmqhandlers.py:284: RuntimeWarning: coroutine 'WebSocketHandler.get' was never awaited
  super(AuthenticatedZMQStreamHandler, self).get(*args, **kwargs)
RuntimeWarning: Enable tracemalloc to get the object allocation traceback

Minus the packages installed by jupyter, meshcat dependancies are at version,

Package          Version
---------------- -------
numpy            1.16.2 
pip              19.0.3 
pyzmq            18.0.0 
setuptools       40.6.2 
tornado          6.0    
u-msgpack-python 2.5.0  
danieljfarrell commented 5 years ago

The problem seemed to be related to not following the correct installation instructions from source as shown in the README,

git clone https://github.com/rdeits/meshcat-python
cd meshcat-python
git submodule update --init --recursive
python setup.py install

I also needed to downgrading tornado from 6.0 to 5.1.1,

pip install tornado==5.1.1

This works well with an environment created with,

pyenv virtualenv 3.7.2 meshcat_env
pyenv activate meshcat_env
rdeits commented 5 years ago

I think the issue you ran into is essentially https://github.com/pypa/pip/issues/2705 . meshcat-python has a submodule containing the javascript assets, but pip install -e doesn't initialize that submodule.