Shared Libraries Error while installing ydk
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-19-2019 02:00 PM
Hi,
I have included the python installation in LD_LIBRARY_PATH, but while installing ydk through "pip install ydk", I am getting the following error:
/tmp/pip-install-5vc0wm56/ydk/python.cpp:541:39: warning: unused parameter ‘left’ [-Wunused-parameter] .def("__eq__", [](ydk::Empty& left, ydk::Empty& right) ^ /tmp/pip-install-5vc0wm56/ydk/python.cpp:541:57: warning: unused parameter ‘right’ [-Wunused-parameter] .def("__eq__", [](ydk::Empty& left, ydk::Empty& right) ^ /tmp/pip-install-5vc0wm56/ydk/python.cpp:545:39: warning: unused parameter ‘left’ [-Wunused-parameter] .def("__ne__", [](ydk::Empty& left, ydk::Empty& right) ^ /tmp/pip-install-5vc0wm56/ydk/python.cpp:545:57: warning: unused parameter ‘right’ [-Wunused-parameter] .def("__ne__", [](ydk::Empty& left, ydk::Empty& right) ^ [100%] Linking CXX shared module ../lib.linux-x86_64-3.6/ydk_.so /opt/rh/devtoolset-4/root/usr/libexec/gcc/x86_64-redhat-linux/5.3.1/ld: /usr/local/lib/libpython3.6m.a(abstract.o): relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a shared object; recompile with -fPIC /usr/local/lib/libpython3.6m.a: error adding symbols: Bad value
- Labels:
-
YANG Development Kit (YDK)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-19-2019 05:47 PM - edited 12-19-2019 05:56 PM
It looks like your system is incompatible with offered precompiled artifacts.
I suggest you to install core libraries by building from source. After successful installation repeat python core package installation with '-v' flag to get detailed log, which might expose source of possible issues.
YDK Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-01-2020 04:10 PM - edited 01-01-2020 04:24 PM
Our django web application runs on python3.6.7 and works fine since we are using it for over 2-3 years now. I now installed ydk-gen from source . And also installed libydk and libydk_gnmi. However in my application I still get this error:
File "/home/sgang31/netadc3/ciscoaci/views/views_cutsheet.py", line 67, in <module> from ydk.services import CRUDService ModuleNotFoundError: No module named 'ydk
I am not sure why while installing ydk through pip install ydk, it tries to use my global python install
/usr/local/lib/libpython3.6
/opt/rh/devtoolset-4/root/usr/libexec/gcc/x86_64-redhat-linux/5.3.1/ld: /usr/local/lib/libpython3.6m.a(abstract.o): relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a shared object; recompile with -fPIC
My pip and python install are under a virtualenv :
(netadc_sgang31) [root@hqidlavxwa02 netadc3]# which pip
/root/.venvs3/netadc_sgang31/bin/pip
All other python packages installed fine for the past 2-3 years. Please help!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-01-2020 05:24 PM
Based on the error message the YDK python core package installation has failed. To be certain you need repeat its installation with '-v' flag. Most likely the system could not find your Python3.6 shared library, which is required for linking python with C++ core library. See Python Requirements for details. Make sure the LD_LIBRARY_PATH environment variable is set properly to include path to Python3.6 shared library, then repeat in your virtual environment:
pip uninstall -y ydk
pip install -v ydk
Test installation in CLI:
python -c "import ydk.services"
Post the installation console output, if it fails again after all requirements are satisfied.
YDK Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-01-2020 06:29 PM
I installed again with the "-v" flag. I set the LD_LIBRARY_PATH.
(netadc_sgang31) [root@hqidlavxwa02 netadc3]# printenv | grep LD_LIBRARY_PATH LD_LIBRARY_PATH=/home/sgang31/netadc3/Python-3.6.3/libpython3.6m.a:/opt/rh/rh-mongodb32/root/usr/lib64
However I still get the error:
[100%] Linking CXX shared module ../lib.linux-x86_64-3.6/ydk_.so /opt/rh/devtoolset-4/root/usr/libexec/gcc/x86_64-redhat-linux/5.3.1/ld: /usr/local/lib/libpython3.6m.a(abstract.o): relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a shared object; recompile with -fPIC /usr/local/lib/libpython3.6m.a: error adding symbols: Bad value collect2: error: ld returned 1 exit status gmake[2]: *** [../lib.linux-x86_64-3.6/ydk_.so] Error 1 gmake[1]: *** [CMakeFiles/ydk_.dir/all] Error 2 gmake: *** [all] Error 2 Traceback (most recent call last): File "<string>", line 1, in <module> File "/tmp/pip-install-h7qf7x2_/ydk/setup.py", line 145, in <module> zip_safe=False, File "/root/.venvs3/netadc_sgang31/lib/python3.6/site-packages/setuptools/__init__.py", line 145, in setup return distutils.core.setup(**attrs) File "/usr/local/lib/python3.6/distutils/core.py", line 148, in setup dist.run_commands() File "/usr/local/lib/python3.6/distutils/dist.py", line 955, in run_commands self.run_command(cmd) File "/usr/local/lib/python3.6/distutils/dist.py", line 974, in run_command cmd_obj.run() File "/root/.venvs3/netadc_sgang31/lib/python3.6/site-packages/wheel/bdist_wheel.py", line 192, in run self.run_command('build') File "/usr/local/lib/python3.6/distutils/cmd.py", line 313, in run_command self.distribution.run_command(command) File "/usr/local/lib/python3.6/distutils/dist.py", line 974, in run_command cmd_obj.run() File "/usr/local/lib/python3.6/distutils/command/build.py", line 135, in run self.run_command(cmd_name) File "/usr/local/lib/python3.6/distutils/cmd.py", line 313, in run_command self.distribution.run_command(command) File "/usr/local/lib/python3.6/distutils/dist.py", line 974, in run_command cmd_obj.run() File "/tmp/pip-install-h7qf7x2_/ydk/setup.py", line 68, in run self.build_extension(ext) File "/tmp/pip-install-h7qf7x2_/ydk/setup.py", line 101, in build_extension subprocess.check_call([cmake_executable, '--build', '.'], cwd=self.build_temp) File "/usr/local/lib/python3.6/subprocess.py", line 291, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['cmake3', '--build', '.']' returned non-zero exit status 2. error ERROR: Failed building wheel for ydk Running setup.py clean for ydk Running command /root/.venvs3/netadc_sgang31/bin/python3.6 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-h7qf7x2_/ydk/setup.py'"'"'; __file__='"'"'/tmp/pip-install-h7qf7x2_/ydk/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' clean --all running clean removing 'build/temp.linux-x86_64-3.6' (and everything under it) removing 'build/lib.linux-x86_64-3.6' (and everything under it) 'build/bdist.linux-x86_64' does not exist -- can't clean it 'build/scripts-3.6' does not exist -- can't clean it removing 'build' Failed to build ydk Installing collected packages: ydk Created temporary directory: /tmp/pip-record-g6cfex3z Running command /root/.venvs3/netadc_sgang31/bin/python3.6 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-h7qf7x2_/ydk/setup.py'"'"'; __file__='"'"'/tmp/pip-install-h7qf7x2_/ydk/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-g6cfex3z/install-record.txt --single-version-externally-managed --compile --install-headers /root/.venvs3/netadc_sgang31/include/site/python3.6/ydk
Also the python version that shows is the global python shared library:
python version: 3.6m -- Found PythonLibs: /usr/local/lib/libpython3.6m.a (found version "3.6.7") pybind11 include: /root/.venvs3/netadc_sgang31/include/site/python3.6;/root/.venvs3/netadc_sgang31/include/site/python3.6 -- Configuring done -- Generating done -- Build files have been written to: /tmp/pip-install-h7qf7x2_/ydk/build/temp.linux-x86_64-3.6
I even put that path /usr/local/lib/libpython3.6m.a in LD_LIBRARY_PATH, but I get the same error.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-01-2020 08:18 PM
--enable-shared
tar -xvf Python-3.6.7.tgz
cd Python-3.6.7
./configure --enable-optimizations --prefix="custom_location" --with-ensurepip=install (use --enable-shared for shared python).
make -j 8
make altinstall
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-01-2020 09:17 PM
updatedb
and then pip install ydk worked!!
Thanks for the support
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-01-2020 09:23 PM
*Why you should use _'python -m pip'_
https://snarky.ca/why-you-should-use-python-m-pip/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-01-2020 10:27 PM - edited 01-02-2020 08:48 AM
My pip install ydk succeeded, but now I am getting an error on the module NetConfProvider.
For cisco nxos switch:
RuntimeError: YClientError: Could not connect to x.x.x.x: Session status: Undefined
For arista 7010 switch:
RuntimeError: YIllegalStateError: Could not create repository in: /root/.ydk/x.x.x.x
People have suggested to downgrade libssh module and re-install libydk and core modules. is that the way to be followed?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-02-2020 09:40 AM
You clearly have connectivity issue. Make sure you can ssh to the device from CLI. The test will record SSH key on your system. Then check that you can connect to Netconf server, which must be configured on the device. The configuration is different and specific to the device. For Cisco routers and switches the testing command would be: ssh @ -p -s netconf
YDK Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-02-2020 10:28 AM - edited 01-02-2020 10:47 AM
My normal ssh access works :
(netadc_sgang31) [root@xxxx netadc3]# telnet x.x.x.x 22 Trying x.x.x.x... Connected to x.x.x.x.sdsd Escape character is '^]'. SSH-2.0-OpenSSH_7.2 FIPS
Now it works, I had to enable feature netconf on the cisco device.
When I try to issue the command for netconf that you gave:
(netadc_sgang31) [root@xxx ~]# ssh admin@x.x.x.x -p 22 -s netconf User Access Verification Password: <?xml version="1.0" encoding="ISO-8859-1"?> <hello xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"> <capabilities> <capability>urn:ietf:params:xml:ns:netconf:base:1.0</capability> <capability>urn:ietf:params:netconf:base:1.0</capability> <capability>urn:ietf:params:netconf:capability:validate:1.0</capability> <capability>urn:ietf:params:netconf:capability:writable-running:1.0</capability> <capability>urn:ietf:params:netconf:capability:url:1.0?scheme=file</capability> <capability>urn:ietf:params:netconf:capability:rollback-on-error:1.0</capability> <capability>urn:ietf:params:netconf:capability:candidate:1.0</capability> <capability>urn:ietf:params:netconf:capability:confirmed-commit:1.0</capability> </capabilities> <session-id>xxxx</session-id> </hello> ]]>]]>
But when using NetConfProvider YDK python module
provider = NetconfServiceProvider(address="x.x.x.x",port=22,username="admin",password="xxxx", protocol="ssh")
getting error:
RuntimeError: YIllegalStateError: Could not create repository in: /root/.ydk/x.x.x.x
I changed the perms on /root/.ydk to 777 temporaraily, still it fails.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-02-2020 01:26 PM
YDK Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-02-2020 02:24 PM
Using port 830 works from the linux CLI
(netadc_sgang31) [root@xxxx netadc3]# ssh admin@x.x.x.x -p 830 -s netconf User Access Verification Password: <?xml version="1.0" encoding="UTF-8"?> <hello xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"> <capabilities> <capability>urn:ietf:params:netconf:base:1.0</capability> <capability>urn:ietf:params:netconf:base:1.1</capability> <capability>urn:ietf:params:netconf:capability:writable-running:1.0</capability> <capability>urn:ietf:params:netconf:capability:rollback-on-error:1.0</capability> <capability>urn:ietf:params:netconf:capability:candidate:1.0</capability> <capability>urn:ietf:params:netconf:capability:validate:1.1</capability> <capability>urn:ietf:params:netconf:capability:confirmed-commit:1.1</capability> <capability>http://cisco.com/ns/yang/cisco-nx-os-device?revision=2018-06-14&module=Cisco-NX-OS-device&deviations=Cisco-NX-OS-device-deviations</capability> </capabilities> <session-id>xxxx</session-id> </hello>
But from python application using
provider = NetconfServiceProvider(address="x.x.x.x",port=830,username="admin",password="xxxx", protocol="ssh")
I get error:
RuntimeError: YIllegalStateError: Could not create repository in: /root/.ydk/xxxx
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-02-2020 03:25 PM - edited 01-02-2020 03:27 PM
What is the permission on /root/.ydk directory?
Could you please enable DEBUG logging level in your script and attach its output to the post.
YDK Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-03-2020 11:41 AM - edited 01-03-2020 11:43 AM
Permissions are set to 777. Can we change the path to a more common location inside our project, other than root?
I enabled the debug INFo logs. The errors:-
Path where models are to be downloaded: /root/.ydk/x.x.x.x Data is invalid according to the yang model. Libyang error: Loading "/usr/local/lib/libyang/nacm.so" as an extension plugin failed (/lib64/libc.so.6: version `GLIBC_2.14' not found (required by /usr/local/lib/libyang/nacm.so)). Data is invalid according to the yang model. Libyang error: Loading "/usr/local/lib/libyang/metadata.so" as an extension plugin failed (/lib64/libc.so.6: version `GLIBC_2.14' not found (required by /usr/local/lib/libyang/metadata.so)). Data is invalid according to the yang model. Libyang error: Invalid keyword "type" as a child to "annotation". Path: '/' Data is invalid according to the yang model. Libyang error: Module "yang" parsing failed. Could not create repository in: /root/.ydk/x.x.x.x
I am basically trying to build a VLAN config using this cisco link:
https://community.cisco.com/t5/yang-development-kit-ydk/i-need-help-on-automating-openconfig-vlan-yang-module/td-p/3444515
