AaronWatters / jp_proxy_widget

Generic Jupyter/IPython widget implementation that will support many types of javascript libraries and interactions.
BSD 2-Clause "Simplified" License
61 stars 13 forks source link

Running on Raspberry Pi - 'numpy' has no attribute 'float128' #13

Closed psychemedia closed 3 years ago

psychemedia commented 3 years ago

I'm exploring running a package that uses jp_proxy_widget on a Raspberry PI 400, and it seems that the numpy package is perhaps not as powerful as the one you anticipate.

/usr/local/lib/python3.8/site-packages/jp_proxy_widget/proxy_widget.py in LiteralMaker()
   1468         np.ndarray: np_array_to_list,
   1469         np.float: float,
-> 1470         np.float128: float,
   1471         np.float16: float,
   1472         np.float32: float,

AttributeError: module 'numpy' has no attribute 'float128'

It would be useful to set up a guard to check that that types exist before setting up aliases to them.

AaronWatters commented 3 years ago

Yes. Thanks!

AaronWatters commented 3 years ago

I addressed this in this commit

https://github.com/AaronWatters/jp_proxy_widget/commit/81275118e9f3e1341f2086a891398d3d64487327

For now if you need it please get the modified python package from the github repository. I would rather not do an official "release" with just this update.

psychemedia commented 3 years ago

Sure - thanks...

psychemedia commented 3 years ago

One issue trying to run from the repo rather than pypi: install fails at first attempt with error:

ERROR: Command errored out with exit status 1:
     command: /usr/local/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-req-build-vq2kaujt/setup.py'"'"'; __file__='"'"'/tmp/pip-req-build-vq2kaujt/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-req-build-vq2kaujt/pip-egg-info
         cwd: /tmp/pip-req-build-vq2kaujt/
    Complete output (29 lines):
    setup.py entered
    $PATH=/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
    running egg_info
    running jsdeps
    `npm` unavailable.  If you're running this command using sudo, make sure `npm` is available to sudo
    rebuilding js and css failed
    missing files: ['/tmp/pip-req-build-vq2kaujt/jp_proxy_widget/static/extension.js', '/tmp/pip-req-build-vq2kaujt/jp_proxy_widget/static/index.js']
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-req-build-vq2kaujt/setup.py", line 179, in <module>
        setup(**setup_args)
      File "/usr/local/lib/python3.8/site-packages/setuptools/__init__.py", line 145, in setup
        return distutils.core.setup(**attrs)
      File "/usr/local/lib/python3.8/distutils/core.py", line 148, in setup
        dist.run_commands()
      File "/usr/local/lib/python3.8/distutils/dist.py", line 966, in run_commands
        self.run_command(cmd)
      File "/usr/local/lib/python3.8/distutils/dist.py", line 985, in run_command
        cmd_obj.run()
      File "/tmp/pip-req-build-vq2kaujt/setup.py", line 45, in run
        raise e
      File "/tmp/pip-req-build-vq2kaujt/setup.py", line 38, in run
        self.distribution.run_command('jsdeps')
      File "/usr/local/lib/python3.8/distutils/dist.py", line 985, in run_command
        cmd_obj.run()
      File "/tmp/pip-req-build-vq2kaujt/setup.py", line 118, in run
        raise ValueError(msg)
    ValueError: Missing file: /tmp/pip-req-build-vq2kaujt/jp_proxy_widget/static/extension.js
    npm is required to build a development version of a widget extension
    ----------------------------------------

I'm actually installing into an RPi Jupyter docker container ; the following seemed to provide a quick fix:

#https://gist.github.com/myrtleTree33/8080843
wget https://nodejs.org/dist/latest-v15.x/node-v15.2.0-linux-armv7l.tar.gz 

#unpack
tar xvzf node-v15.2.0-linux-armv7l.tar.gz 

mkdir -p /opt/node
cp -r node-v15.2.0-linux-armv7l/* /opt/node

#Add node to your path so you can call it with just "node"
#Add these lines to the file you opened

PROFILE_TEXT="
PATH=\$PATH:/opt/node/bin
export PATH
"
echo "$PROFILE_TEXT" >> ~/.bash_profile
source ~/.bash_profile

ln -s /opt/node/bin/node /usr/bin/node
ln -s /opt/node/lib/node /usr/lib/node
ln -s /opt/node/bin/npm /usr/bin/npm
ln -s /opt/node/bin/node-waf /usr/bin/node-waf