xnd-project / libxnd

Subsumed into xnd
https://xnd.io/
BSD 3-Clause "New" or "Revised" License
80 stars 12 forks source link

XND looks for ndtypes in the wrong directory #46

Closed peterbell10 closed 2 months ago

peterbell10 commented 5 years ago

I'm unable to install xnd using pip. I always get the same error:

x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Ilibxnd -Indtypes/python/ndtypes -I/usr/lib/python3/dist-packages/ndtypes -I/usr/include/python3.7m -c python/xnd/_xnd.c -o build/temp.linux-x86_64-3.7/python/xnd/_xnd.o -Wextra -Wno-missing-field-initializers -std=c11
python/xnd/_xnd.c:40:10: fatal error: ndtypes.h: No such file or directory
#include "ndtypes.h"

Note the include directory for ndtypes:

-I/usr/lib/python3/dist-packages/ndtypes

But ndtypes is actually installed in /usr/local/lib/python3.7/dist-packages. I'm installing both with the command python3.7 -m pip install so this shouldn't be a problem. It's also correctly including /usr/include/python3.7m in the same compile command.

This is also similarly broken when ndtypes is installed with --user, in which case it lives in ~/.local/python3.7/site-packages

skrah commented 5 years ago

I can't reproduce this, I just tried ./dbg/bin/python3 -m pip install xnd and the install worked. Are you installing as root to the system directories?

Anyway, the PyPI xnd is a bit old now (a new release is due), so I recommend conda dev builds:

conda install -c xnd/label/dev xnd

Or from source:

https://github.com/xnd-project/xnd-all

peterbell10 commented 5 years ago

The problem is here: https://github.com/xnd-project/xnd/blob/89b41c5aaf90356f296b74dd58d73e110df750a3/setup.py#L106

>>> get_python_lib()
'/usr/lib/python3/dist-packages'

If on your system it happens to be installed to that folder then it'll work.

skrah commented 5 years ago

I can reproduce some pip strangeness:

# /usr/bin/python3 -m pip install ndtypes
Requirement already satisfied: ndtypes in /usr/local/lib/python3.5/dist-packages (0.2.0b2)

Bizarre, why is pip looking in /usr/local?

skrah commented 2 months ago

The whole project is now built with CMake (#49), so closing.