cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
550
Views
5
Helpful
2
Replies

install_ydk.sh not working correctly on Ubuntu Focal (20.04.3)

tlijnse
Level 1
Level 1

Hi,

I was trying to install ydk-gen based on the https://github.com/ygorelik/ydk-gen fork of ydk-gen, which seems to be the more current repository. I installed a clean copy of Ubuntu server 20.4.3 in a VM, cloned the repo and ran the install_ydk.sh script as per the instructions. However, that script does not complete and stops at the following point:

*** Mon 31 Jan 2022 08:13:07 AM UTC *** install_ydk.sh | Checking installation of python shared libraries 
*** Mon 31 Jan 2022 08:13:07 AM UTC *** install_ydk.sh | Could not locate python shared library libpython3.8.so 
*** Mon 31 Jan 2022 08:13:07 AM UTC *** install_ydk.sh | Try to update locate database, then repeat YDK installation 

When I manually locate the shared library it is actually found:

tom@devbox:~/ydk-gen$ locate libpython3.8.so
/usr/lib/python3.8/config-3.8-x86_64-linux-gnu/libpython3.8.so
/usr/lib/x86_64-linux-gnu/libpython3.8.so
/usr/lib/x86_64-linux-gnu/libpython3.8.so.1
/usr/lib/x86_64-linux-gnu/libpython3.8.so.1.0

The problem seems to be in line 111 of the script in the if clause:

    if [[ ${#lines[@]} -gt 0 && -x ${lines[0]} ]]; then
      if [[ -z $CMAKE_LIBRARY_PATH ]]; then
        export CMAKE_LIBRARY_PATH=$(dirname ${lines[0]})
        print_msg "Setting CMAKE_LIBRARY_PATH to $CMAKE_LIBRARY_PATH"
      fi
    else
      print_msg "Could not locate python shared library libpython$ext"
      print_msg "Try to update locate database, then repeat YDK installation"
      exit 1
    fi

The "-x" in the if clause checks if the file exists and is executable. However, as you can see from the locate command above, the file that is located is ultimately linked to "/usr/lib/x86_64-linux-gnu/libpython3.8.so.1.0". When I check that file, I can see that it is not executable:

tom@devbox:~/ydk-gen$ ls -al /usr/lib/x86_64-linux-gnu/libpython3.8.so.1.0
-rw-r--r-- 1 root root 5449112 Nov 26 20:14 /usr/lib/x86_64-linux-gnu/libpython3.8.so.1.0

This is probably specific to Ubuntu or this specific version of Ubuntu, but it looks like the shared library file is not executable on this platform and apparently it doesn't need to be. So I changed the "-x" in the if clause to "-r" to only check if the file exists and is readable, instead of checking if it is executable. After that, the installation went through.

I am posting this here, just in case somebody else bumps into the same problem. I considered opening an issue on the repo, but the issues page on the repo states:

Please use CiscoDevNet/ydk-gen repo for all YDK issues.
Issue tracker is ONLY used for reporting bugs. Please use the YDK Community for any support issues.

However, the install script on the CiscoDevNet/ydk-gen repo is different, so there's no point in opening the issue there. So I decided to create this forum post instead to help other people that might bump into the same problem.

If I should open an issue on the repo I hope that the maintainer sees this post and tells me how to proceed.

Regards,

Tom

 

1 Accepted Solution

Accepted Solutions

ygorelik
Cisco Employee
Cisco Employee
HI Tom

This issue has been already addressed in the 0.8.6.2 branch. It is not ready for the release, hence not merged to the master.
There are 2 ways to proceed:

1. Simply manually edit the if statement and repeat the installation. The corrected statement should show:



if [[ ${#lines[@]} -gt 0 ]] && [[ -x ${lines[0]} || -L ${lines[0]} ]]; then



1. You can try to switch to the 0.8.6.2 branch and get the fixed version of the script. Please note that API for the script slightly changed, therefore I suggest running ‘./install_ydk.sh –help’ first. Major change – the use of python virtual environment is not enforced anymore and became an optional parameter. This way you can use any python installation, which is defined by your environment. If you want the virtual environment created for you, then add parameter ‘--venv’.

Yan
Cisco Systems

View solution in original post

2 Replies 2

ygorelik
Cisco Employee
Cisco Employee
HI Tom

This issue has been already addressed in the 0.8.6.2 branch. It is not ready for the release, hence not merged to the master.
There are 2 ways to proceed:

1. Simply manually edit the if statement and repeat the installation. The corrected statement should show:



if [[ ${#lines[@]} -gt 0 ]] && [[ -x ${lines[0]} || -L ${lines[0]} ]]; then



1. You can try to switch to the 0.8.6.2 branch and get the fixed version of the script. Please note that API for the script slightly changed, therefore I suggest running ‘./install_ydk.sh –help’ first. Major change – the use of python virtual environment is not enforced anymore and became an optional parameter. This way you can use any python installation, which is defined by your environment. If you want the virtual environment created for you, then add parameter ‘--venv’.

Yan
Cisco Systems

Hi Yan,

Thanks for the quick response! As mentioned in my post it wasn't really a problem for me anymore after I had identified the issue. I was mainly posting for the benefit of others who might bump into the same issue.

As a quick fix I just replaced the "-x" with "-r" and the script worked fine for me. I see that in the newer version you're now checking specifically for a symlink in addition to an executable file. That's a bit more elegant than what I did.

For now I am going to stick with the main branch that I installed, but it's good to know that this has already been fixed in the next release. Also, having the venv as optional is nice. When installing on your own machine it's good to have the option to use a virtual environment, but when installing in a dedicated VM or container it's an unnecessary complication.

Thanks again for the response!

Tom