widgetti / ipyvolume

3d plotting for Python in the Jupyter notebook based on IPython widgets using WebGL
MIT License
1.94k stars 234 forks source link

Conda install issues with fresh Anaconda 5.0.1 #93

Closed danzimmerman closed 6 years ago

danzimmerman commented 6 years ago

Trying to get ipyvolume installed on a Windows 10 machine with Anaconda 5.0.1. This is freshly installed (several attempts, uninstalled with the Anaconda uninstaller in between).

In the root environment, conda install -c conda-forge ipyvolume fails for me:

image

Following the pip install instructions will get through the ipyvolume installation process but throws an error upon trying to use (sorry, I didn't record it in detail, I prefer to stay in conda if I can)

I did succeed in getting ipyvolume working in an environment by running conda env create -f environment.yml with an environment.yml like:

name: onrbasic
channels:
    - defaults
    - conda-forge
dependencies:
    - ipywidgets
    - widgetsnbextension
    - ipyvolume
    - nb_conda
    - <some other stuff>

This is probably okay as a stopgap, but I don't have much need for environments with what I'm doing, and now I have to open a command line every time to manually type

cd <awkward directory> (or browse to <awkward directory> to start the command terminal) activate onrbasic jupyter notebook

I was hoping that using nb_conda to access kernels from different conda environments from within jupyter would allow me to launch jupyter from root (which I do with a windows shortcut to deal with the awkward path to my notebooks) but still access ipyvolume in the appropriate conda environment. But opening the notebook set up that way results in a few 404 errors:

[W 23:38:10.072 NotebookApp] 404 GET /nbextensions/ipyvolume/extension.js?v=20180104233751 (::1) 11.00ms referer=

[W 23:38:10.124 NotebookApp] 404 GET /nbextensions/jupyter-webrtc/extension.js?v=20180104233751 (::1) 2.00ms referer=

[W 23:38:10.364 NotebookApp] 404 GET /nbextensions/widgets/notebook/js/extension.js?v=20180104233751 (::1) 2.00ms referer= In this notebook launched from root, there are no python errors thrown by importing or using ipyvolume, as it's available to the kernel, but nothing shows up in the notebook, presumably because of these missing javascript components.

So I assume if I launch jupyter from the root environment, despite the use of nb_conda, ipyvolume must also be installed in the root environment to get the plots to show up? And I can't do that, so I'm stuck starting jupyter via several sequential commands in the command line?

So I guess there may be two distinct issues here:

The latter feels like more of a nb_conda/widgets/etc issue than an ipyvolume issue. Hopefully the former issue is easily reproduced and not specific to my machine.

Thanks, Dan

maartenbreddels commented 6 years ago

Hi Dan,

thanks for the elaborate report. Indeed, the js part needs to be available for the notebook server, which in your case is the root environment. The default now (for almost all ipywidget packages) is to have the python and the js part in 1 package. This will change in the future probably, where it will be two separate packages. When you pip install, the python part is placed in site-packages, nothing special. But for the notebook to be able to serve it, the extension needs to be enabled, usually:

jupyter nbextension enable --py --sys-prefix ipyvolume

When you install from conda-forge, this will be done automagically for you, by this script: https://github.com/conda-forge/ipyvolume-feedstock/blob/master/recipe/post-link.bat For some reason, that fails, I'm trying to reproduce that, but otherwise try again using pip, and also see if these docs help out: http://ipyvolume.readthedocs.io/en/latest/install.html (although do not use the --user flag)

To check the status of the extensions, the following command may be useful:

jupyter nbextension list --log-level=DEBUG

Can you give me the output of this?

maartenbreddels commented 6 years ago

I could not reproduce the installation in root anaconda2 on OSX. I hope to have a working Windows 10 ~2 weeks from now and will be able to test it there. In the meantime we should be able to get it working in your root using pip. Note also that the ipywidget in anaconda's main channel does not enable the ipywidget/widgetsnbextension automatically. You therefore need to also run:

jupyter nbextension enable --py --sys-prefix widgetsnbextension
danzimmerman commented 6 years ago

Output of jupyter nbextension list --log-level=DEBUG in root:

Known nbextensions:
  config dir: C:\Users\Zimmerman\.jupyter\nbconfig
    notebook section
      jupyter-js-widgets/extension enabled
      - Validating: ok
      ipyvolume/extension enabled
      - Validating: problems found:
        - require?  X ipyvolume/extension
  config dir: C:\Users\Zimmerman\Anaconda2\etc\jupyter\nbconfig
    notebook section
      bqplot/extension enabled
      - Validating: problems found:
        - require?  X bqplot/extension
      jupyter-leaflet/extension enabled
      - Validating: problems found:
        - require?  X jupyter-leaflet/extension
      jupyter-js-widgets/extension enabled
      - Validating: ok
      jupyter-webrtc/extension enabled
      - Validating: problems found:
        - require?  X jupyter-webrtc/extension
    tree section
      nb_conda/tree enabled
      - Validating: ok

ipyvolume is not present in conda list, however.

When I try pip install ipyvolume it looks like I'm possibly getting a conflict with a system python I didn't really know I had. I many messages about Requirement already satisfied, mostly listing things in Anaconda2 directory, but at the top is:

Requirement already satisfied: ipyvolume in c:\users\zimmerman\appdata\roaming\python\python27\site-packages

Possibly this is from one of the earlier times I tried pip install since I didn't clear it out, but I never to my recollection installed Python besides Anaconda, and also:

image

It looks like there's nothing in the appdata python directory besides ipyvolume and its dependencies that weren't satisfied by anaconda:

image

There's nothing in the upper Python27 directory besides the site-packages folder.

There's also this: image

But nothing else in share.

I'm going to try this all on my main workstation today as well, also Win10, will let you know that goes.

Thanks, Dan

maartenbreddels commented 6 years ago

Try uninstalling:

$ pip uninstall ipyvolume

Try it multiple times, it may do wonders :) (if it's installed multiple times). Then try installing again using pip. Hope that works.

danzimmerman commented 6 years ago

pip uninstall ipyvolume did remove the spurious packages in appdata. Running it again didn't find anything to uninstall. Reinstalling ipyvolume with pip succeeded, and now ipyvolume appears in conda list, installed via <pip>.

Now both jupyter nbextension enable --py --sys-prefix ipyvolume and jupyter nbextension enable --py ipyvolume

fail with

<snipped>
File "C:\Users\Zimmerman\Anaconda2\lib\site-packages\traitlets\utils\importstring.py", line 42, in import_item
    return __import__(parts[0])
  File "C:\Users\Zimmerman\Anaconda2\lib\site-packages\ipyvolume\__init__.py", line 5, in <module>
    from .widgets import *
  File "C:\Users\Zimmerman\Anaconda2\lib\site-packages\ipyvolume\widgets.py", line 5, in <module>
    from ipyvolume.traittypes import Image
  File "C:\Users\Zimmerman\Anaconda2\lib\site-packages\ipyvolume\traittypes.py", line 2, in <module>
    import PIL.Image
  File "C:\Users\Zimmerman\Anaconda2\lib\site-packages\PIL\Image.py", line 56, in <module>
    from . import _imaging as core
ImportError: DLL load failed: The specified module could not be found.

From Jupyter, ipyvolume is now importable, but importing results in the following error:

  File "C:\Users\Zimmerman\Anaconda2\lib\site-packages\traitlets\utils\importstring.py", line 42, in import_item
    return __import__(parts[0])
  File "C:\Users\Zimmerman\Anaconda2\lib\site-packages\ipyvolume\__init__.py", line 5, in <module>
    from .widgets import *
  File "C:\Users\Zimmerman\Anaconda2\lib\site-packages\ipyvolume\widgets.py", line 5, in <module>
    from ipyvolume.traittypes import Image
  File "C:\Users\Zimmerman\Anaconda2\lib\site-packages\ipyvolume\traittypes.py", line 2, in <module>
    import PIL.Image
  File "C:\Users\Zimmerman\Anaconda2\lib\site-packages\PIL\Image.py", line 56, in <module>
    from . import _imaging as core
ImportError: DLL load failed: The specified module could not be found.

There is an _imaging.pyd in the C:\Users\Zimmerman\Anaconda2\lib\site-packages\PIL\ directory. PIL is not listed as an installed package. I can't interact with PIL in site-packages with conda or pip; neither recognize that module name. Is the site-packages\PIL directory set up by pillow?

I am not having this issue on my Win 10 desktop workstation. I had ipyvolume 0.4.0 installed there, apparently with Anaconda 5.0.1. (Not a brand new, fresh installation, though.) Upgrading to ipyvolume 0.4.2 via conda worked fine on the desktop workstation and ipyvolume works in a notebook launched from the root environment. import PIL.Image from python on the workstation works fine, and PIL.Image.__file__ points to C:\Users\Zimmerman\Anaconda2\lib\site-packages\PIL\Image.pyc.

Importing PIL.Image on the laptop from a python console gives the same "DLL load" error.

maartenbreddels commented 6 years ago

pillow should be the package that now provides the PIL library (confusing I know :)) Can you try downgrading pillow, as described here, that seems to be a common issue: https://stackoverflow.com/questions/43264773/pil-dll-load-failed-specified-procedure-could-not-be-found

danzimmerman commented 6 years ago

Yes, I now have it working on the laptop, two different ways. At first when I "downgraded" I used pip install pillow=4.0.0, which added pillow 4.0.0 via pip alongside the one I had before. The other one in conda list was 4.3.0 py27hdf32916_1, from the default channel, not from conda-forge.

After pip install pillow==4.0.0, ipyvolume works. Success!

But it doesn't require downgrading...

I also tried pip install pillow==4.3.0 matching conda and pip install pillow==5.0.0 and both worked. So it seems to be installation with pip rather than the specific version. If I pip uninstall pillow so that the only pillow I have is the conda pillow 4.3.0 py27hdf32916_1, ipyvolume breaks again.

===

Then I noticed that in the functioning installation on the desktop workstation, I have pillow 4.3.0 py27_1 from conda-forge, not pillow from the default channel. So I did the following on the laptop, to try to match the desktop:

pip uninstall pillow (conda's pillow 4.3.0 py27hdf32916_1 remains in place) pip uninstall ipyvolume conda install -c conda-forge pillow (replacing conda's pillow with pillow 4.3.0 py27_2 from conda-forge) conda install -c conda-forge ipyvolume (Succeeds!)

image

And it works:

image

To be complete, I left the conda-forge pillow in place and did: conda uninstall ipyvolume pip install ipyvolume jupyter nbextension enable --py --sys-prefix ipyvolume

and that also works.

So, it seems:

According to revision 0 in conda list --revisions, the current Anaconda Windows .exe installs pillow 4.2.1 , but I guess now I've also tried at least 4.0.0, 4.3.0, and 5.0.0 using simply conda install pillow==<version> or conda update pillow, and none of them work.

danzimmerman commented 6 years ago

I reproduced the issue on my home Win10 laptop. Fresh install of Anaconda -> ipyvolume conda install rolls back because of the post-install script error. Install conda-forge pillow 4.3.0 -> ipyvolume conda install succeeds

maartenbreddels commented 6 years ago

Thanks for sharing it, and giving a detailed report! This may help people with similar issues!

glyg commented 6 years ago

Hi @maartenbreddels , I have the same post-link script failed on an appveyor build from conda forge, both with python 3.7 and 3.6. The previous conda-forge build on windows (with ipyvolume 0.4.3 seemed to work).

here is the log of the latest successful build : https://ci.appveyor.com/project/conda-forge/tyssue-feedstock/branch/master

and here is the failing build https://ci.appveyor.com/project/conda-forge/tyssue-feedstock/builds/19347694/job/xu6rqiike6lt74u5

it seems that the version of pillow is the same in both cases, but maybe there's another workaround?

glyg commented 5 years ago

Hi

This is still the case with ipyvolume 0.5.1

Traceback (most recent call last):
  File "C:\Miniconda36-x64\lib\site-packages\conda\core\link.py", line 558, in _execute_actions
    run_script(target_prefix, prec, 'post-unlink' if is_unlink else 'post-link')
  File "C:\Miniconda36-x64\lib\site-packages\conda\core\link.py", line 810, in run_script
    raise LinkError(message)
conda.exceptions.LinkError: post-link script failed for package conda-forge::ipyvolume-0.5.1-py37_1000
running your command again with `-v` will provide additional information
location of failed script: C:\bld\tyssue_1539994427696\_test_env\Scripts\.ipyvolume-post-link.bat
==> script messages <==
<None>

Should I open a new issue?