bd2kccd / py-causal

Other
204 stars 50 forks source link

Installation trouble #85

Open rcoconnell opened 5 years ago

rcoconnell commented 5 years ago

I had trouble installing through Anaconda. I ran through the steps described in the "Anaconda/Jupyter" section of the Readme, and found that I was able to import pydot, but not graphviz (not sure if this matters?) or pycausal.

The output from conda list included the following:

graphviz                  2.40.1               hefbbd9a_2 
pycausal                  0.1.3                    py27_0    chirayu
pydot                     1.4.1                    py27_0 

At this point I could import pydot, but not graphviz or pycausal.

Poking around a little bit, it sounded like conda install graphviz doesn't install python bindings for graphviz, so I ran pip install graphviz. conda list now includes

python-graphviz           0.11.1                   pypi_0    pypi

and I can now import graphviz successfully. Unfortunately, pycausal is still borked:

>>> import pycausal
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named pycausal

Any guidance?

chirayukong commented 5 years ago

Did you install with 'python setup.py install' at the py-causal folder? Try to call it at python prompt. I think conda installs the library in a different place. If you want to run it on Jupyter notebook, try it on Docker: https://hub.docker.com/r/chirayukong/py-causal-notebook.

rcoconnell commented 5 years ago

I get similar results from running setup.py and from running pip install git+git://github.com/bd2kccd/py-causal,

/Users/rcoconne/anaconda2/lib/python2.7/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:15:2: warning: "Using deprecated NumPy API, disable it by "          "#defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-W#warnings]
    #warning "Using deprecated NumPy API, disable it by " \
     ^
    _javabridge.c:527:10: fatal error: 'jni.h' file not found
    #include "jni.h"
             ^~~~~~~
    1 warning and 1 error generated.
    error: command 'gcc' failed with exit status 1

    ----------------------------------------
Command "/Users/rcoconne/anaconda2/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/bd/rbkf2ts97j15tpt46_ttzzcc0000gn/T/pip-install-xRQMzq/javabridge/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/var/folders/bd/rbkf2ts97j15tpt46_ttzzcc0000gn/T/pip-record-fGYOdx/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/bd/rbkf2ts97j15tpt46_ttzzcc0000gn/T/pip-install-xRQMzq/javabridge/

Is a missing jni.h some kind of Java problem? I'm on OS X 10.14.5, if it's relevant.

chirayukong commented 5 years ago

https://stackoverflow.com/questions/14529720/how-to-make-jni-h-be-found

rcoconnell commented 5 years ago

Like I said, I'm not on Ubuntu :)

I have some experience hacking things together in Python, and absolutely none in Java. Do I need to install the JDK in order to run your package? If so, it would be helpful to indicate that in the installation instructions. Do I want Java 11 or Java 12, OpenJDK or Sun, does any of that matter, etc.?

chirayukong commented 5 years ago

Definitely, you do need JDK. The library was coded in Java. OpenJDK or Oracle should do the trick as long as its version is 8 or more.