install in python:3.6-alpine image failed
summy00 opened this issue · 11 comments
@summy00 you need to install swig and ninja before.
I have installed by:
apk add swig
git clone -b 'release' --depth=1 https://github.com/ninja-build/ninja.git
cd ninja
./configure.py --bootstrap
cmake -Bbuild-cmake -H.
cmake --build build-cmake
git clone https://github.com/tfmoraes/python-gdcm.git
cd python-gdcm
maybe I not install swig & ninja successfully
Try to export CMAKE_EXE and SWIG_EXE before the building:
$ export CMAKE_EXE=/CMAKE/PATH
$ export SWIG_EXE=/SWIG/PATH
I managed to compile this way:
apk add swig ninja cmake gcc g++ patchelf
pip install python-gdcm
It compiles but doesn't import gdcm:
$ python -c "import gdcm"
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/python-gdcm/gdcm.py", line 62, in <module>
from _gdcm.gdcmswig import *
ModuleNotFoundError: No module named '_gdcm.gdcmswig'
after I run apk add ninja
it can cmake with Ninja now...
and can build with python setup.py install
, I will test it if it can import gdcm
Exporting to LD_LIBRARY_PATH
makes it work:
$ export LD_LIBRARY_PATH="/usr/local/lib"
$ python -c "import gdcm; print(gdcm.Version().GetVersion())"
3.0.8
I don't know why but "/usr/local/lib" is not in path list to find the shared libraries. But you can fix it exporting LD_LIBRARY_PATH
.
So to install python-gdcm
in python:3.6-alpine
you have to run the following commands:
# Install swig, ninja, cmake, gcc, c++, patchelf
$ apk add swig ninja cmake gcc g++ patchelf
# Install python-gdcm
$ pip install python-gdcm
# export LD_LIBRARY_PATH to make system find `libpython.so`
$ export LD_LIBRARY_PATH="/usr/local/lib"
# Run Python, import GDCM and print GDCM version
python -c "import gdcm; print(gdcm.Version().GetVersion())"
So to install
python-gdcm
inpython:3.6-alpine
you have to run the following commands:# Install swig, ninja, cmake, gcc, c++, patchelf $ apk add swig ninja cmake gcc g++ patchelf # Install python-gdcm $ pip install python-gdcm # export LD_LIBRARY_PATH to make system find `libpython.so` $ export LD_LIBRARY_PATH="/usr/local/lib" # Run Python, import GDCM and print GDCM version python -c "import gdcm; print(gdcm.Version().GetVersion())"
thanks it work!