Open Kinggerm opened 7 years ago
Kinggerm, it looks like for some reason the pf module was not built. It is a C-language extension module. To debug why, try building the module itself only, as
python setup.py build_ext -i
Note any error messages that fly by. The earliest error message is usually a clue. (Numpy API warning messages can be ignored)
Oh, I see. Thank you!
I'm having the same import error as Kinggerm described. I'm using python 3.7 and a virtual environment on a Unix HPC. I was able to install and run successfully on my MacBook, but it takes my laptop 12+ hours to run p4 heterogeneity tests on my phylogenomic data sets, so I would like to install in on an HPC. When I run
python setup.py build_ext -i
The only warnings besides NumPy API warning are:
In file included from /GWSPH/home/jbernot/.conda/envs/p4_2/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:21:0,
from /GWSPH/home/jbernot/.conda/envs/p4_2/lib/python3.7/site-packages/numpy/core/include/numpy/arrayobject.h:4,
from Pf/p4_model.h:2,
from Pf/p4_node.c:3:
/GWSPH/home/jbernot/.conda/envs/p4_2/lib/python3.7/site-packages/numpy/core/include/numpy/__multiarray_api.h:1463:1: warning: ‘_import_array’ defined but not used [-Wunused-function]
_import_array(void)
^~~~~~~~~~~~~
After running python setup.py build_ext -i
when I try to import p4, I do not receive the pf module error and it appears to install. But when I
import p4
p4 --help
I get this error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: bad operand type for unary -: '_Helper'
I'm stuck, any suggestions would be very much appreciated!
jbernot --- Confusingly, p4 is the name of the Python package, and it is also the name of a script that I like to use that I provide with the package (bin/p4 in the p4 package). That script is run from your shell, not from within Python. I put it in my path to make it easy to use. So you would run "p4 --help" from your bash or zsh prompt, not from within interactive Python.
You don't need to use the p4 script, and it is more "pythonic" to do the usual "import p4" from within Python rather than using the p4 script, but I am in the habit of using the script, and so I provide it.
The warning you quoted appears to have come from numpy. I think that can be ignored.
Oh that makes sense! My installation is working now on the HPC -- thank you pgfoster!
I use mac and pyenv. My global python version is 2.7.12. I tried to install p4 with sudo or in the home path, I got this: