Carnets icon indicating copy to clipboard operation
Carnets copied to clipboard

Pip install ipyvolume

Open luukalt opened this issue 4 years ago • 11 comments

Installing ipyvolume is not working. Although it installs, it does not have the necessary permissions (iPad air 4th gen.)

PermissionError: [Errno 1] Operation not permitted: '/private/var/mobile/Containers/Data/Application/F05D07D0-5946-49F4-B9B4-CAA8BAA5FF7C/.ipyvolume'

luukalt avatar Oct 28 '21 09:10 luukalt

Hi, that is a relatively common iOS issue: we do not have read-write permissions on ~, only on ~/Documents/ (and ~/Library and ~/tmp). So anything that tries to write a configuration file in ~ will fail. Most packages have a configuration option to change the location of the configuration file. Let me have a look.

holzschu avatar Oct 28 '21 10:10 holzschu

Hi again, looking at the code: https://github.com/maartenbreddels/ipyvolume/blob/2517550084b309364f7cfe7c380ff1a7ae8588eb/ipyvolume/datasets.py it seems there are no options to change the location of the data directory (variable data_dir, on line 14). So your best course of action is to edit ipyvolume/datasets.py and change the value of data_dir:

data_dir = os.path.expanduser("~/Documents/.ipyvolume/datasets")

holzschu avatar Oct 28 '21 10:10 holzschu

Hi,

Thanks for the very quick reply. Where on my ipad, could I edit this .py file? (If this is possible).

Thanks :)

luukalt avatar Oct 28 '21 10:10 luukalt

That is a very good question (I should have answered that too). First, you need to bring the file in a position where the Files app can see it:

!cp ~/Library/lib/python3.9/site-packages/ipyvolume/datasets.py ~/Documents/

Then you can edit it (using Carnet's own editor, or any app you like). Once edited, you need to copy the file back in place:

!cp ~/Documents/datasets.py ~/Library/lib/python3.9/site-packages/ipyvolume/datasets.py 

holzschu avatar Oct 28 '21 10:10 holzschu

Where on my iPad do I need to run these commands?

luukalt avatar Oct 28 '21 11:10 luukalt

You run them inside a cell, in a newly created notebook in Carnets.

holzschu avatar Oct 28 '21 11:10 holzschu

Thanks! Sorry for being an amateur, but where do I find the Documents folder on the ipad?

luukalt avatar Oct 28 '21 11:10 luukalt

The Documents folder is the "visible" part of the Carnets app. If you use the Files app (or the file browser that is embedded inside Carnets), it will appear as "On my iPad/Carnets".

holzschu avatar Oct 28 '21 11:10 holzschu

Thanks again.

The procedure worked. However, unfortunately, the expected figure does not appear as output. I guess there is no simple solution to this. :(

Code:

import ipyvolume as ipv import numpy as np x, y, z, u, v, w = np.random.random((6, 1000))*2-1 selected = np.random.randint(0, 1000, 100) ipv.figure() quiver = ipv.quiver(x, y, z, u, v, w, size=5, size_selected=8, selected=selected)

from ipywidgets import FloatSlider, ColorPicker, VBox, jslink size = FloatSlider(min=0, max=30, step=0.1) size_selected = FloatSlider(min=0, max=30, step=0.1) color = ColorPicker() color_selected = ColorPicker() jslink((quiver, 'size'), (size, 'value')) jslink((quiver, 'size_selected'), (size_selected, 'value')) jslink((quiver, 'color'), (color, 'value')) jslink((quiver, 'color_selected'), (color_selected, 'value')) VBox([ipv.gcc(), size, size_selected, color, color_selected])

luukalt avatar Oct 28 '21 13:10 luukalt

Hi, indeed, that does not work, and this time I have no idea why. Even ipyvolume's simpler examples are also failing.

holzschu avatar Oct 28 '21 13:10 holzschu

Thanks anyway, I did learn some new things today. Would be great if 3D plots could be rendered and interacted with. The slider pop up though. Unfortunately, matplotlib does not suffice for this purpose (rotating 3D plots for example), whereas ipyvolume does exactly what I want to achieve.

luukalt avatar Oct 28 '21 13:10 luukalt