schollz / find3

High-precision indoor positioning framework, version 3.
https://www.internalpositioning.com/doc
MIT License
4.63k stars 363 forks source link

Cython module not found building on arm64 #180

Closed Sammy1Am closed 4 years ago

Sammy1Am commented 4 years ago

While trying to build the docker image on an arm64 system, numpy and scipy both failed because they were unable to find the 'Cython' module. I'm not sure if this is a peculiarity of arm64 builds or if it would apply to other architectures, but in order to get it to build I had to add cython to the Dockerfile (see my changes here).

Not even sure if I went about fixing that appropriately since I'm still relatively new to Docker, but in case it's helpful for others building the image I figured I'd open an issue.

schollz commented 4 years ago

That is weird, as it doesn't use cython...

Sammy1Am commented 4 years ago

ScyPy's site on building from source says:

To build development versions of NumPy, you’ll need a recent version of Cython. Released NumPy sources on PyPi include the C files generated from Cython code, so for released versions having Cython installed isn’t needed.

And scipy's setup.py similarly seems to require it.

It looks like it's only needed under certain building conditions, but running docker build -t schollz/find3 . on an arm64 system appears to meet those conditions.

donkawechico commented 4 years ago

Seeing the same issue on armhf architecture.

Not a docker guru, but would it be as simple as changing Dockerfile to install Cython before installing scipy/numpy? Something like this?

# ...

RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y wget git libc6-dev make pkg-config g++ gcc mosquitto-clients mosquitto python3 python3-dev python3-pip python3-setuptools python3-wheel supervisor libfreetype6-dev python3-matplotlib libopenblas-dev libblas-dev liblapack-dev gfortran
RUN python3 -m pip install Cython --install-option="--no-cython-compile" && \
    apt-get install --no-install-recommends -y python3-scipy python3-numpy && \
    mkdir /usr/local/work && \
    rm -rf /var/lib/apt/lists/* && \

# ...

UPDATE: Confirmed that the above change works on my RPi4 w/ Buster! Built successfully, and the container spun up without issue.

I'll see about putting up a PR, but in the meantime, here's a gist.

UPDATE 2 Put up a PR (see below)

Sammy1Am commented 4 years ago

That's exactly what I did (though I see that my addition of cython to apt-get install is not needed I guess). Thanks for making this a PR :)

donkawechico commented 4 years ago

That's exactly what I did (though I see that my addition of cython to apt-get install is not needed I guess).

Did your solution just do apt-get install cython? Or did you also do a pip install?

Wondering because maybe it'd be simpler to just add cython to the apt-get list rather than this sorta-awkward insertion of a pip command.

Sammy1Am commented 4 years ago

I linked my code changes up at the top of this issue so you can see exactly, but I did both because I wasn't sure which was required, and didn't take the time to reset and try each indiviually.

On Thu, Feb 27, 2020, 10:35 Donnie notifications@github.com wrote:

That's exactly what I did (though I see that my addition of cython to apt-get install is not needed I guess).

Did your solution just do apt-get install cython? Or did you also do a pip install?

Wondering because maybe it'd be simpler to just add cython to the apt-get list rather than this sorta-awkward insertion of a pip command.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/schollz/find3/issues/180?email_source=notifications&email_token=AADSF6HGMK62KEH2M3TTKI3RFABYTA5CNFSM4KIQOD52YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOENFONVI#issuecomment-592111317, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADSF6CIDWXAFSBYE64QZXDRFABYTANCNFSM4KIQOD5Q .

donkawechico commented 4 years ago

Oh, jeez. I read the whole thread but somehow missed the link to your successful changes. Coulda saved myself some effort!