ImportError when using bitbucket pipeline with python3.5 image

EnderQIU
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 9, 2018
+ umask 000

+ git clone --branch="master" --depth 50 https://x-token-auth:$REPOSITORY_OAUTH_ACCESS_TOKEN@bitbucket.org/EnderQIU/zq_api.git $BUILD_DIR ; git reset --hard 7e56b0331379c956798efa60c9649e6f4d6f9757 ; git remote set-url origin git@bitbucket.org:EnderQIU/zq_api.git
Cloning into '/opt/atlassian/pipelines/agent/build'...
HEAD is now at 7e56b03 pipelines: switch base image to python3.5

+ chmod 777 $BUILD_DIR

Cache "pip": Downloading
Cache "pip": Not found
+ apt-get update
Get:1 http://security.debian.org jessie/updates InRelease [63.1 kB]
Ign http://deb.debian.org jessie InRelease
...
Fetched 10.1 MB in 5s (1907 kB/s)
Reading package lists...

+ apt-get install unzip -y
Reading package lists...
...
Setting up unzip (6.0-16+deb8u3) ...

+ apt-get install swig -y
Reading package lists...
...
Setting up swig (2.0.12-1) ...

+ apt-get install redis-server memcached -y
Reading package lists...
...
Processing triggers for systemd (215-17+deb8u7) ...

+ apt-get install cmake -y
Reading package lists...
...
Processing triggers for libc-bin (2.19-18+deb8u10) ...

+ cd deploy/

+ unzip FANN-2.2.0-Source.zip
Archive: FANN-2.2.0-Source.zip
inflating: FANN-2.2.0-Source/README.txt
inflating: FANN-2.2.0-Source/VS2010/fannfixed/fannfixed.filters
inflating: FANN-2.2.0-Source/VS2010/fannfixed/fannfixed.vcxproj
inflating: FANN-2.2.0-Source/VS2010/momentums/momentums.vcxproj.filters
inflating: FANN-2.2.0-Source/VS2010/momentums/momentums.vcxproj
inflating: FANN-2.2.0-Source/VS2010/fann.sln
inflating: FANN-2.2.0-Source/VS2010/xor_train/xor_train.vcxproj
inflating: FANN-2.2.0-Source/VS2010/xor_train/xor_train.vcxproj.filters
inflating: FANN-2.2.0-Source/VS2010/simple_train_float/simple_train_float.vcxproj
inflating: FANN-2.2.0-Source/VS2010/simple_train_float/simple_train_float.vcxproj.filters
inflating: FANN-2.2.0-Source/VS2010/scaling_test/scaling_test.vcxproj.filters
inflating: FANN-2.2.0-Source/VS2010/scaling_test/scaling_test.vcxproj
inflating: FANN-2.2.0-Source/VS2010/simple_train_double/simple_train_double.vcxproj.filters
inflating: FANN-2.2.0-Source/VS2010/simple_train_double/simple_train_double.vcxproj
inflating: FANN-2.2.0-Source/VS2010/xor_cpp_sample/xor_cpp_sample.vcxproj.filters
inflating: FANN-2.2.0-Source/VS2010/xor_cpp_sample/xor_cpp_sample.vcxproj
inflating: FANN-2.2.0-Source/VS2010/xor_test_fixed/xor_test_fixed.vcxproj
inflating: FANN-2.2.0-Source/VS2010/xor_test_fixed/xor_test_fixed.vcxproj.filters
inflating: FANN-2.2.0-Source/VS2010/fanndouble/fanndouble.vcxproj
inflating: FANN-2.2.0-Source/VS2010/fanndouble/fanndouble.vcxproj.filters
inflating: FANN-2.2.0-Source/VS2010/xor_test_float/xor_test_float.vcxproj
inflating: FANN-2.2.0-Source/VS2010/xor_test_float/xor_test_float.vcxproj.filters
inflating: FANN-2.2.0-Source/VS2010/scaling_train/scaling_train.vcxproj
inflating: FANN-2.2.0-Source/VS2010/scaling_train/scaling_train.vcxproj.filters
inflating: FANN-2.2.0-Source/VS2010/robot/robot.vcxproj
inflating: FANN-2.2.0-Source/VS2010/robot/robot.vcxproj.filters
inflating: FANN-2.2.0-Source/VS2010/fannfloat/fannfloat.vcxproj
inflating: FANN-2.2.0-Source/VS2010/fannfloat/fannfloat.vcxproj.filters
inflating: FANN-2.2.0-Source/VS2010/cascade_train/cascade_train.vcxproj.filters
inflating: FANN-2.2.0-Source/VS2010/cascade_train/cascade_train.vcxproj
inflating: FANN-2.2.0-Source/VS2010/mushroom/mushroom.vcxproj.filters
inflating: FANN-2.2.0-Source/VS2010/mushroom/mushroom.vcxproj
inflating: FANN-2.2.0-Source/VS2010/steepness_train/steepness_train.vcxproj
inflating: FANN-2.2.0-Source/VS2010/steepness_train/steepness_train.vcxproj.filters
inflating: FANN-2.2.0-Source/bin/fannfloat.lib
inflating: FANN-2.2.0-Source/bin/fanndouble.dll
inflating: FANN-2.2.0-Source/bin/fannfloat.dll
inflating: FANN-2.2.0-Source/bin/fanndouble.lib
inflating: FANN-2.2.0-Source/bin/simple_train_float.exe
inflating: FANN-2.2.0-Source/bin/xor_test_float.exe
inflating: FANN-2.2.0-Source/bin/xor.data
inflating: FANN-2.2.0-Source/bin/xor_test_fixed.exe
inflating: FANN-2.2.0-Source/bin/fannfixed.lib
inflating: FANN-2.2.0-Source/bin/.gitignore
inflating: FANN-2.2.0-Source/bin/fannfixed.dll
inflating: FANN-2.2.0-Source/bin/simple_train_double.exe
inflating: FANN-2.2.0-Source/bin/xor_train.exe
inflating: FANN-2.2.0-Source/datasets/parity13.test
inflating: FANN-2.2.0-Source/datasets/soybean.train
inflating: FANN-2.2.0-Source/datasets/mushroom.test
inflating: FANN-2.2.0-Source/datasets/parity13.train
inflating: FANN-2.2.0-Source/datasets/pumadyn-32fm.train
inflating: FANN-2.2.0-Source/datasets/robot.train
inflating: FANN-2.2.0-Source/datasets/building.train
inflating: FANN-2.2.0-Source/datasets/census-house.test
inflating: FANN-2.2.0-Source/datasets/bank32fm.test
inflating: FANN-2.2.0-Source/datasets/mushroom.train
inflating: FANN-2.2.0-Source/datasets/gene.train
inflating: FANN-2.2.0-Source/datasets/parity8.test
inflating: FANN-2.2.0-Source/datasets/diabetes.test
inflating: FANN-2.2.0-Source/datasets/kin32fm.test
inflating: FANN-2.2.0-Source/datasets/bank32nh.test
inflating: FANN-2.2.0-Source/datasets/two-spiral.test
inflating: FANN-2.2.0-Source/datasets/pumadyn-32fm.test
inflating: FANN-2.2.0-Source/datasets/census-house.train
inflating: FANN-2.2.0-Source/datasets/two-spiral.train
inflating: FANN-2.2.0-Source/datasets/robot.test
inflating: FANN-2.2.0-Source/datasets/parity8.train
inflating: FANN-2.2.0-Source/datasets/abelone.test
inflating: FANN-2.2.0-Source/datasets/thyroid.train
inflating: FANN-2.2.0-Source/datasets/soybean.test
inflating: FANN-2.2.0-Source/datasets/kin32fm.train
inflating: FANN-2.2.0-Source/datasets/thyroid.test
inflating: FANN-2.2.0-Source/datasets/building.test
inflating: FANN-2.2.0-Source/datasets/diabetes.train
inflating: FANN-2.2.0-Source/datasets/abelone.train
inflating: FANN-2.2.0-Source/datasets/bank32nh.train
inflating: FANN-2.2.0-Source/datasets/scaling.data
inflating: FANN-2.2.0-Source/datasets/gene.test
inflating: FANN-2.2.0-Source/datasets/bank32fm.train
inflating: FANN-2.2.0-Source/src/fann_cascade.c
inflating: FANN-2.2.0-Source/src/floatfann.c
inflating: FANN-2.2.0-Source/src/fann_train.c
inflating: FANN-2.2.0-Source/src/fann.c
inflating: FANN-2.2.0-Source/src/fixedfann.c
inflating: FANN-2.2.0-Source/src/fann_train_data.c
inflating: FANN-2.2.0-Source/src/include/fann_error.h
inflating: FANN-2.2.0-Source/src/include/fann_io.h
inflating: FANN-2.2.0-Source/src/include/fann_internal.h
inflating: FANN-2.2.0-Source/src/include/doublefann.h
inflating: FANN-2.2.0-Source/src/include/fann_train.h
inflating: FANN-2.2.0-Source/src/include/floatfann.h
inflating: FANN-2.2.0-Source/src/include/compat_time.h
inflating: FANN-2.2.0-Source/src/include/fann_data.h
inflating: FANN-2.2.0-Source/src/include/config.h
inflating: FANN-2.2.0-Source/src/include/fann_cascade.h
inflating: FANN-2.2.0-Source/src/include/fann_cpp.h
inflating: FANN-2.2.0-Source/src/include/fann.h
inflating: FANN-2.2.0-Source/src/include/fann_activation.h
inflating: FANN-2.2.0-Source/src/include/fixedfann.h
inflating: FANN-2.2.0-Source/src/include/CMakeLists.txt
inflating: FANN-2.2.0-Source/src/doublefann.c
inflating: FANN-2.2.0-Source/src/fann_io.c
inflating: FANN-2.2.0-Source/src/fann_error.c
inflating: FANN-2.2.0-Source/src/CMakeLists.txt
inflating: FANN-2.2.0-Source/cmake/Modules/DefineInstallationPaths.cmake
inflating: FANN-2.2.0-Source/cmake/fann.pc.cmake
inflating: FANN-2.2.0-Source/cmake/config.h.cmake
inflating: FANN-2.2.0-Source/.gitignore
inflating: FANN-2.2.0-Source/COPYING.txt
inflating: FANN-2.2.0-Source/CMakeLists.txt
inflating: FANN-2.2.0-Source/examples/scaling_train.c
inflating: FANN-2.2.0-Source/examples/xor_test.c
inflating: FANN-2.2.0-Source/examples/simple_train.c
inflating: FANN-2.2.0-Source/examples/mushroom.c
inflating: FANN-2.2.0-Source/examples/xor_train.c
inflating: FANN-2.2.0-Source/examples/xor.data
inflating: FANN-2.2.0-Source/examples/cascade_train.c
inflating: FANN-2.2.0-Source/examples/momentums.c
inflating: FANN-2.2.0-Source/examples/simple_test.c
inflating: FANN-2.2.0-Source/examples/steepness_train.c
inflating: FANN-2.2.0-Source/examples/Makefile
inflating: FANN-2.2.0-Source/examples/.gitignore
inflating: FANN-2.2.0-Source/examples/scaling_test.c
inflating: FANN-2.2.0-Source/examples/robot.c
inflating: FANN-2.2.0-Source/examples/xor_sample.cpp

+ cd FANN-2.2.0-Source

+ cmake .
-- The C compiler identification is GNU 4.9.2
-- The CXX compiler identification is GNU 4.9.2
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- FANN is used as APPLICATION_NAME
-- Configuring done
-- Generating done
-- Build files have been written to: /opt/atlassian/pipelines/agent/build/deploy/FANN-2.2.0-Source

+ make
Scanning dependencies of target doublefann
[ 25%] Building C object src/CMakeFiles/doublefann.dir/doublefann.c.o
Linking C shared library libdoublefann.so
[ 25%] Built target doublefann
Scanning dependencies of target fann
[ 50%] Building C object src/CMakeFiles/fann.dir/floatfann.c.o
Linking C shared library libfann.so
[ 50%] Built target fann
Scanning dependencies of target fixedfann
[ 75%] Building C object src/CMakeFiles/fixedfann.dir/fixedfann.c.o
Linking C shared library libfixedfann.so
[ 75%] Built target fixedfann
Scanning dependencies of target floatfann
[100%] Building C object src/CMakeFiles/floatfann.dir/floatfann.c.o
Linking C shared library libfloatfann.so
[100%] Built target floatfann

+ make install && cd ../
[ 25%] Built target doublefann
[ 50%] Built target fann
[ 75%] Built target fixedfann
[100%] Built target floatfann
Install the project...
-- Install configuration: ""
-- Installing: /usr/local/lib/pkgconfig/fann.pc
-- Installing: /usr/local/lib/libfloatfann.so.2.2.0
-- Installing: /usr/local/lib/libfloatfann.so.2
-- Installing: /usr/local/lib/libfloatfann.so
-- Installing: /usr/local/lib/libdoublefann.so.2.2.0
-- Installing: /usr/local/lib/libdoublefann.so.2
-- Installing: /usr/local/lib/libdoublefann.so
-- Installing: /usr/local/lib/libfixedfann.so.2.2.0
-- Installing: /usr/local/lib/libfixedfann.so.2
-- Installing: /usr/local/lib/libfixedfann.so
-- Installing: /usr/local/lib/libfann.so.2.2.0
-- Installing: /usr/local/lib/libfann.so.2
-- Installing: /usr/local/lib/libfann.so
-- Installing: /usr/local/include/fann.h
-- Installing: /usr/local/include/doublefann.h
-- Installing: /usr/local/include/fann_internal.h
-- Installing: /usr/local/include/floatfann.h
-- Installing: /usr/local/include/fann_data.h
-- Installing: /usr/local/include/fixedfann.h
-- Installing: /usr/local/include/compat_time.h
-- Installing: /usr/local/include/fann_activation.h
-- Installing: /usr/local/include/fann_cascade.h
-- Installing: /usr/local/include/fann_error.h
-- Installing: /usr/local/include/fann_train.h
-- Installing: /usr/local/include/fann_io.h
-- Installing: /usr/local/include/fann_cpp.h

+ pip install -r requirements.pip && cd ../
Collecting Django==2.0 (from -r requirements.pip (line 1))
Downloading Django-2.0-py3-none-any.whl (7.1MB)
...
Successfully built django-celery fann2 python3-keyczar django-ipware qiniu python-memcached mysqlclient olefile pycrypto simplegeneric billiard anyjson
Installing collected packages: pytz, Django, olefile, Pillow, beautifulsoup4, billiard, anyjson, amqp, kombu, celery, django-celery, djangorestframework, raven, chardet, certifi, idna, urllib3, requests, fann2, colorlog, psycopg2, pycrypto, pyasn1, python3-keyczar, django-ipware, qiniu, python-magic, redis, six, python-memcached, simplegeneric, wcwidth, prompt-toolkit, pickleshare, ptyprocess, pexpect, decorator, parso, jedi, pygments, ipython-genutils, traitlets, ipython, mysqlclient
Successfully installed Django-2.0 Pillow-4.3.0 amqp-1.4.9 anyjson-0.3.3 beautifulsoup4-4.6.0 billiard-3.3.0.23 celery-3.1.25 certifi-2018.1.18 chardet-3.0.4 colorlog-3.1.0 decorator-4.2.1 django-celery-3.2.2 django-ipware-1.1.6 djangorestframework-3.7.3 fann2-1.1.2 idna-2.6 ipython-6.2.1 ipython-genutils-0.2.0 jedi-0.11.1 kombu-3.0.37 mysqlclient-1.3.12 olefile-0.45.1 parso-0.1.1 pexpect-4.4.0 pickleshare-0.7.4 prompt-toolkit-1.0.15 psycopg2-2.7.3.2 ptyprocess-0.5.2 pyasn1-0.4.2 pycrypto-2.6.1 pygments-2.2.0 python-magic-0.4.15 python-memcached-1.58 python3-keyczar-0.71rc0 pytz-2018.3 qiniu-7.2.0 raven-6.4.0 redis-2.10.6 requests-2.18.4 simplegeneric-0.8.1 six-1.11.0 traitlets-4.3.2 urllib3-1.22 wcwidth-0.1.7

+ python -c 'import fann2'
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/local/lib/python3.5/site-packages/fann2/__init__.py", line 4, in <module>
from fann2 import libfann
File "/usr/local/lib/python3.5/site-packages/fann2/libfann.py", line 28, in <module>
_libfann = swig_import_helper()
File "/usr/local/lib/python3.5/site-packages/fann2/libfann.py", line 24, in swig_import_helper
_mod = imp.load_module('_libfann', fp, pathname, description)
File "/usr/local/lib/python3.5/imp.py", line 243, in load_module
return load_dynamic(name, filename, file)
File "/usr/local/lib/python3.5/imp.py", line 343, in load_dynamic
return _load(spec)
ImportError: libdoublefann.so.2: cannot open shared object file: No such file or directory

Skipping cache upload for failed step
Searching for test report files in directories named [test-results, failsafe-reports, test-reports, surefire-reports] down to a depth of 4
Finished scanning for test reports. Found 0 test report files.
Merged test suites, total number tests is 0, with 0 failures and 0 errors.

 Above is my complete raw building log. I've run cmake to the fann2 c source and "make install" it. Then I installed fann2 via pip and there is no error occurred. But got a ImportError when executing "import fann2" in python shell.

1 answer

0 votes
Philip Hodder
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 5, 2018

Hi,

This looks like a related question: https://stackoverflow.com/questions/1099981/why-cant-python-find-shared-objects-that-are-in-directories-in-sys-path

See if following the steps there helps with your issue. 

Specifically add: 

export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH

to your bitbucket-pipelines.yml script before running your python commands.

Otherwise, you may want to try debug your build locally in a clean environment with Docker: https://confluence.atlassian.com/bitbucket/debug-your-pipelines-locally-with-docker-838273569.html

Thanks,

Phil

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events