gramener / gramex

A visual analytics platform to build data-based web apps with less code.
https://gramener.com/gramex/guide/
Other
142 stars 57 forks source link

Enable conda install #254

Closed sanand0 closed 4 years ago

sanand0 commented 4 years ago

conda install gramex should install Gramex

sanand0 commented 4 years ago

Tested this on Docker on Windows with the continuumio/miniconda instance

conda create -y --name gramex-conda python=3.7 --no-default-packages
conda activate gramex-conda
conda install -c jaidevd -c conda-forge -y gramex

... and then I ran Gramex on the Gramex Guide folder.

Node.js, R and ModelHandler all work fine

sanand0 commented 4 years ago

Tested this on Windows with:

conda create -y --name gramex-conda python=3.7 --no-default-packages
conda activate gramex-conda
conda install -c jaidevd -c conda-forge -y gramex

... and then I ran Gramex on the Gramex Guide folder.

Node.js and ModelHandler work fine. But R still reports this error.

HTTPServerRequest(protocol='http', host='localhost:9988', method='GET', uri='/r/plot_async.png', version='HTTP/1.1', remote_ip='::1')
concurrent.futures.process._RemoteTraceback:
"""
Traceback (most recent call last):
  File "D:\anaconda\3.7\envs\gramex-conda\lib\concurrent\futures\process.py", line 239, in _process_worker
    r = call_item.fn(*call_item.args, **call_item.kwargs)
  File "D:\anaconda\3.7\envs\gramex-conda\lib\site-packages\gramex\ml.py", line 151, in r
    from rpy2.robjects import r, pandas2ri, globalenv
  File "D:\anaconda\3.7\envs\gramex-conda\lib\site-packages\rpy2\robjects\__init__.py", line 16, in <module>
    import rpy2.rinterface as rinterface
  File "D:\anaconda\3.7\envs\gramex-conda\lib\site-packages\rpy2\rinterface.py", line 6, in <module>
    from rpy2.rinterface_lib import openrlib
  File "D:\anaconda\3.7\envs\gramex-conda\lib\site-packages\rpy2\rinterface_lib\openrlib.py", line 44, in <module>
    rlib = _dlopen_rlib(R_HOME)
  File "D:\anaconda\3.7\envs\gramex-conda\lib\site-packages\rpy2\rinterface_lib\openrlib.py", line 37, in _dlopen_rlib      
    rlib = ffi.dlopen(lib_path)
OSError: cannot load library 'D:\anaconda\3.7\envs\gramex-conda\lib\R\bin\x64\R.dll': error 0x7e
"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "D:\anaconda\3.7\envs\gramex-conda\lib\site-packages\tornado\web.py", line 1592, in _execute
    result = yield result
  File "D:\anaconda\3.7\envs\gramex-conda\lib\site-packages\tornado\gen.py", line 1133, in run
    value = future.result()
  File "D:\anaconda\3.7\envs\gramex-conda\lib\site-packages\tornado\gen.py", line 1141, in run
    yielded = self.gen.throw(*exc_info)
  File "D:\anaconda\3.7\envs\gramex-conda\lib\site-packages\gramex\handlers\functionhandler.py", line 61, in _get
    item = yield item
  File "D:\anaconda\3.7\envs\gramex-conda\lib\site-packages\tornado\gen.py", line 1133, in run
    value = future.result()
  File "D:\anaconda\3.7\envs\gramex-conda\lib\site-packages\tornado\gen.py", line 1141, in run
    yielded = self.gen.throw(*exc_info)
  File "D:\site\gramener.com\viz\gramex-guide\r\rcalc.py", line 26, in plot_async
    path = yield pool.submit(gramex.ml.r, path=os.path.join(folder, 'plot.R'))
  File "D:\anaconda\3.7\envs\gramex-conda\lib\site-packages\tornado\gen.py", line 1133, in run
    value = future.result()
  File "D:\anaconda\3.7\envs\gramex-conda\lib\concurrent\futures\_base.py", line 428, in result
    return self.__get_result()
  File "D:\anaconda\3.7\envs\gramex-conda\lib\concurrent\futures\_base.py", line 384, in __get_result
    raise self._exception
OSError: cannot load library 'D:\anaconda\3.7\envs\gramex-conda\lib\R\bin\x64\R.dll': error 0x7e
ERROR   04-Jul 14:55:34 __init__ 9988 500 GET /r/plot_async.png (::1) 2777.62ms subdirs:D:/site/gramener.com/viz/gramex-guide/r/gramex.yaml:r/plot_async.png
sanand0 commented 4 years ago

Tested this on WSL (Windows Subsystem for Linux) on Windows 10, Ubuntu 20.04, we get the following error with Miniconda. But it seems to work better with Anaconda. (See logs much further down.)

This may be WSL related rather than Gramex / Python / Ubuntu. Not a priority

Here's the log with Miniconda installed.

(base) sanand@Quartz:/mnt/d/wsl$ conda create -y --name gramex-conda python=3.7 --no-default-packages
...

(base) sanand@Quartz:/mnt/d/wsl$ conda activate gramex-conda

(gramex-conda) sanand@Quartz:/mnt/d/wsl$ conda install -c jaidevd -c conda-forge -y gramex
...
Preparing transaction: done
Verifying transaction: | 
SafetyError: The package for gcc_impl_linux-64 located at /mnt/d/wsl/ubuntu/miniconda3/pkgs/gcc_impl_linux-64-7.3.0-habb00fd_1
appears to be corrupted. The path 'x86_64-conda_cos6-linux-gnu/sysroot/usr/include/linux/netfilter/xt_DSCP.h'
has an incorrect size.
  reported size: 634 bytes
  actual size: 638 bytes

... (more such SafetyError messages)

ClobberError: The package 'defaults/linux-64::binutils_impl_linux-64-2.31.1-h6176602_1' cannot be installed due to a        
path collision for 'bin/x86_64-conda_cos6-linux-gnu-ld'.
This path already exists in the target prefix, and it won't be removed by
an uninstall action in this transaction. The path appears to be coming from
the package 'defaults/linux-64::ld_impl_linux-64-2.33.1-h53a641e_7', which is already installed in the prefix.

/
done
Executing transaction: done
ERROR conda.core.link:_execute(700): An error occurred while installing package 'jaidevd::gramex-1.60.0-py37_4'.
Rolling back transaction: done

LinkError: post-link script failed for package jaidevd::gramex-1.60.0-py37_4
location of failed script: /mnt/d/wsl/ubuntu/miniconda3/envs/gramex-conda/bin/.gramex-post-link.sh
==> script messages <==
<None>
==> script output <==
stdout: Collecting orderedattrdict>=1.4.3
  Downloading orderedattrdict-1.6.0-py2.py3-none-any.whl (8.7 kB)
Collecting xmljson>=0.1.5
  Downloading xmljson-0.2.1-py2.py3-none-any.whl (10 kB)
Collecting cron-descriptor
  Downloading cron_descriptor-1.2.24.tar.gz (22 kB)
Collecting tables
  Downloading tables-3.6.1-cp37-cp37m-manylinux1_x86_64.whl (4.3 MB)
Requirement already satisfied: numpy>=1.9.3 in /mnt/d/wsl/ubuntu/miniconda3/envs/gramex-conda/lib/python3.7/site-packages (from tables) (1.18.5)
Collecting numexpr>=2.6.2
  Downloading numexpr-2.7.1-cp37-cp37m-manylinux1_x86_64.whl (162 kB)
Building wheels for collected packages: cron-descriptor
  Building wheel for cron-descriptor (setup.py): started
  Building wheel for cron-descriptor (setup.py): finished with status 'done'
  Created wheel for cron-descriptor: filename=cron_descriptor-1.2.24-py3-none-any.whl size=37775 sha256=ce7ce2e7edda24745912078127f20e6a7293b113622f4c1cdbdd0940f773f077
  Stored in directory: /home/sanand/.cache/pip/wheels/e4/13/ac/aff40ad5196dce23e6c520b49a8e6126b57af694630e2fd826
Successfully built cron-descriptor
Installing collected packages: orderedattrdict, xmljson, cron-descriptor, numexpr, tables
yarn config v1.22.4
success Set "ignore-engines" to "true".
Done in 0.08s.

stderr: ERROR: gramex 1.60.0 requires pathlib, which is not installed.
ERROR: gramex 1.60.0 requires redis>=2.10.0, which is not installed.
ERROR: Could not install packages due to an EnvironmentError: [Errno 1] Operation not permitted

Traceback (most recent call last):
  File "/mnt/d/wsl/ubuntu/miniconda3/envs/gramex-conda/lib/python3.7/site-packages/orderedattrdict/__init__.py", line 9, in 
<module>
    class _test_multi_inheritance(OrderedDict, defaultdict):
TypeError: multiple bases have instance lay-out conflict

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/mnt/d/wsl/ubuntu/miniconda3/envs/gramex-conda/bin/gramex", line 7, in <module>
    from gramex import commandline
  File "/mnt/d/wsl/ubuntu/miniconda3/envs/gramex-conda/lib/python3.7/site-packages/gramex/__init__.py", line 37, in <module>    from orderedattrdict import AttrDict
  File "/mnt/d/wsl/ubuntu/miniconda3/envs/gramex-conda/lib/python3.7/site-packages/orderedattrdict/__init__.py", line 13, in <module>
    from .ordereddict import OrderedDict
ModuleNotFoundError: No module named 'orderedattrdict.ordereddict'

return code: 1

()

Here's the log with Anaconda installed.

(base) sanand@Quartz:/mnt/d/wsl$ conda create -y --name gramex-conda python=3.7 --no-default-packages
...

(base) sanand@Quartz:/mnt/d/wsl$ conda activate gramex-conda

(gramex-conda) sanand@Quartz:/mnt/d/wsl$ conda install -c jaidevd -c conda-forge -y gramex
...

Preparing transaction: done
Verifying transaction: - 
SafetyError: The package for gcc_impl_linux-64 located at /mnt/d/wsl/ubuntu/anaconda3/pkgs/gcc_impl_linux-64-7.3.0-habb00fd_1
appears to be corrupted. The path 'x86_64-conda_cos6-linux-gnu/sysroot/usr/include/linux/netfilter/xt_DSCP.h'
has an incorrect size.
  reported size: 634 bytes
  actual size: 638 bytes

... (more such SafetyError messages)

ClobberError: The package 'defaults/linux-64::binutils_impl_linux-64-2.31.1-h6176602_1' cannot be installed due to a        
path collision for 'bin/x86_64-conda_cos6-linux-gnu-ld'.
This path already exists in the target prefix, and it won't be removed by
an uninstall action in this transaction. The path appears to be coming from
the package 'defaults/linux-64::ld_impl_linux-64-2.33.1-h53a641e_7', which is already installed in the prefix.

done
Executing transaction: done
(gramex-conda) sanand@Quartz:/mnt/d/wsl$ gramex --version
Gramex 1.60.0
(gramex-conda) sanand@Quartz:/mnt/d/wsl$ 
sanand0 commented 4 years ago

Closed via 08b04ce2