{"id":304,"date":"2020-07-20T20:35:13","date_gmt":"2020-07-20T18:35:13","guid":{"rendered":"https:\/\/camilomatajira.wordpress.com\/?p=304"},"modified":"2025-06-11T20:45:21","modified_gmt":"2025-06-11T20:45:21","slug":"packaging-a-pandas-numpy-project-for-debian-9-and-10-using-dh-virtualenv","status":"publish","type":"post","link":"https:\/\/camilo.matajira.com\/?p=304","title":{"rendered":"Packaging a Pandas \/ Numpy project for Debian 9 and 10 using dh-virtualenv"},"content":{"rendered":"\n<p>In this post we are going to create a debian package for a project that involves importing pandas and numpy. We will do it for Debian 9 and Debian 10.<\/p>\n\n\n\n<p>In a previous post, I made a tutorial on  how to use dh-virtualenv to create a debian package for a python project. In case you are interested you can read it <a href=\"https:\/\/camilomatajira.wordpress.com\/2020\/06\/13\/how-to-create-a-python-debian-package-with-dh-virtualenv\/\">here<\/a>.<\/p>\n\n\n\n<p><br>I wrote a specific post for Pandas and Numpy because the usual packaging fails due to a missing Fortran library (libgfortran) that is not easily accessible (at least I don&#8217;t know yet how to get it).<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#282A36\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#F8F8F2;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><textarea class=\"code-block-pro-copy-button-textarea\" aria-hidden=\"true\" readonly>dpkg-shlibdeps: error: cannot find library libgfortran-ed201abd.so.3.0.0 needed by debian\/test\/opt\/venvs\/test\/lib\/python3.7\/sit\ne-packages\/numpy\/.libs\/libopenblasp-r0-2ecf47d5.3.7.dev.so (ELF format: &#8216;elf64-x86-64&#8217; abi: &#8216;0201003e00000000&#8217;; RPATH: &#8221;)\ndpkg-shlibdeps: error: cannot continue due to the error above\nNote: libraries are not searched in other binary packages that do not have any shlibs or symbols file.\nTo help dpkg-shlibdeps find private libraries, you might need to use -l.<\/textarea><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dracula\" style=\"background-color: #282A36\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #50FA7B\">dpkg-shlibdeps:<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #F1FA8C\">error:<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #F1FA8C\">cannot<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #F1FA8C\">find<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #F1FA8C\">library<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #F1FA8C\">libgfortran-ed201abd.so.3.0.0<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #F1FA8C\">needed<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #F1FA8C\">by<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #F1FA8C\">debian\/test\/opt\/venvs\/test\/lib\/python3.7\/sit<\/span><\/span>\n<span class=\"line\"><span style=\"color: #50FA7B\">e-packages\/numpy\/.libs\/libopenblasp-r0-2ecf47d5.3.7.dev.so<\/span><span style=\"color: #F8F8F2\"> (ELF <\/span><span style=\"color: #F1FA8C\">format:<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #E9F284\">&#39;<\/span><span style=\"color: #F1FA8C\">elf64-x86-64<\/span><span style=\"color: #E9F284\">&#39;<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #F1FA8C\">abi:<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #E9F284\">&#39;<\/span><span style=\"color: #F1FA8C\">0201003e00000000<\/span><span style=\"color: #E9F284\">&#39;<\/span><span style=\"color: #F8F8F2\">; <\/span><span style=\"color: #50FA7B\">RPATH:<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #E9F284\">&#39;&#39;<\/span><span style=\"color: #F8F8F2\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #50FA7B\">dpkg-shlibdeps:<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #F1FA8C\">error:<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #F1FA8C\">cannot<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #F1FA8C\">continue<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #F1FA8C\">due<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #F1FA8C\">to<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #F1FA8C\">the<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #F1FA8C\">error<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #F1FA8C\">above<\/span><\/span>\n<span class=\"line\"><span style=\"color: #50FA7B\">Note:<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #F1FA8C\">libraries<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #F1FA8C\">are<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #F1FA8C\">not<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #F1FA8C\">searched<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #F1FA8C\">in<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #F1FA8C\">other<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #F1FA8C\">binary<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #F1FA8C\">packages<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #F1FA8C\">that<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #F1FA8C\">do<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #F1FA8C\">not<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #F1FA8C\">have<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #F1FA8C\">any<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #F1FA8C\">shlibs<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #F1FA8C\">or<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #F1FA8C\">symbols<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #F1FA8C\">file.<\/span><\/span>\n<span class=\"line\"><span style=\"color: #50FA7B\">To<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #F1FA8C\">help<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #F1FA8C\">dpkg-shlibdeps<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #F1FA8C\">find<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #F1FA8C\">private<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #F1FA8C\">libraries,<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #F1FA8C\">you<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #F1FA8C\">might<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #F1FA8C\">need<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #F1FA8C\">to<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #F1FA8C\">use<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #BD93F9\">-l.<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>To tackle this problem you have two options:<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">1. Activate &#8216;override_dh_shlibdeps&#8217;<\/h2>\n\n\n\n<p>This is the best option given that compile time for my project using this technique took around 1 minutes (instead of 27 minutes with the second option).<\/p>\n\n\n\n<p>For this approach, you need to modify the debian\/rules file. Specifically you need to un-comment the override_dh_shlibdeps in the &#8216;.PHONY&#8217; line.<\/p>\n\n\n\n<p>Also you need to uncomment the &#8216;override_dh_shlibdeps&#8217; block. And add the problematic libraries, in this case Numpy and Pandas.<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#282A36\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#F8F8F2;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><textarea class=\"code-block-pro-copy-button-textarea\" aria-hidden=\"true\" readonly>.PHONY: clean build-arch override_dh_virtualenv override_dh_strip override_dh_shlibdeps\n\n(&#8230;)\n\noverride_dh_shlibdeps:\n    dh_shlibdeps -X\/x86\/ -X\/numpy\/ -X\/pandas\/<\/textarea><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dracula\" style=\"background-color: #282A36\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #8BE9FD\">.PHONY<\/span><span style=\"color: #FF79C6\">:<\/span><span style=\"color: #F1FA8C\"> clean build-arch override_dh_virtualenv override_dh_strip override_dh_shlibdeps<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">(...)<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #8BE9FD\">override_dh_shlibdeps<\/span><span style=\"color: #FF79C6\">:<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">    dh_shlibdeps -X\/x86\/ -X\/numpy\/ -X\/pandas\/<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">2. Add extra pip argument &#8216;&#8211;no-binary=:all:&#8217;<\/h2>\n\n\n\n<p>This option is second best given that the packaging process will take around 27 minutes. I list this option because there might be some use case in which the override_dh_shlibdeps is not enough.<\/p>\n\n\n\n<p>To implement this option you need to modify the debian\/rules file and add the following: &#8211;extra-pip-arg=&#8217;&#8211;no-binary=:all:&#8217;<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#282A36\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#F8F8F2;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><textarea class=\"code-block-pro-copy-button-textarea\" aria-hidden=\"true\" readonly>DH_VENV_ARGS=&#8211;setuptools &#8211;builtin-venv &#8211;python=$(SNAKE) $(EXTRA_REQUIREMENTS) \\\n                                                 &#8211;extra-pip-arg=&#8211;progress-bar=pretty &#8211;extra-pip-arg=&#8217;&#8211;no-binary=:all:&#8217;<\/textarea><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dracula\" style=\"background-color: #282A36\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #F8F8F2\">DH_VENV_ARGS<\/span><span style=\"color: #FF79C6\">=<\/span><span style=\"color: #F8F8F2\">--setuptools --builtin-venv --python=<\/span><span style=\"color: #FF79C6\">$(<\/span><span style=\"color: #F8F8F2\">SNAKE<\/span><span style=\"color: #FF79C6\">)<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #FF79C6\">$(<\/span><span style=\"color: #F8F8F2\">EXTRA_REQUIREMENTS<\/span><span style=\"color: #FF79C6\">)<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #FF79C6\">\\<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">                                                 --extra-pip-arg=--progress-bar=pretty --extra-pip-arg=&#39;--no-binary=:all:&#39;<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<h1 class=\"wp-block-heading\">Missing &#8216;six&#8217; module at runtime<\/h1>\n\n\n\n<p>With these modifications the package will build. However at runtime Python will request a missing &#8216;six module&#8217;.<br>I have tried several options but I don&#8217;t have yet a clean solution for this.<br>My best approach is to tell debian to put python3-six as a dependency for the package and do some hacking to add the &#8216;six&#8217; module to the path.<\/p>\n\n\n\n<p>To make debian require python3-six, add it to the Pre-Depends line in the debian\/control file:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#282A36\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#F8F8F2;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><textarea class=\"code-block-pro-copy-button-textarea\" aria-hidden=\"true\" readonly>Pre-Depends: dpkg (>= 1.16.1), python3, python3-venv, python3-six, ${misc:Pre-Depends}<\/textarea><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dracula\" style=\"background-color: #282A36\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #8BE9FD\">Pre-Depends<\/span><span style=\"color: #FF79C6\">:<\/span><span style=\"color: #F1FA8C\"> dpkg (&gt;= 1.16.1), python3, python3-venv, python3-six, <\/span><span style=\"color: #FF79C6\">${<\/span><span style=\"color: #F8F8F2\">misc:Pre-Depends<\/span><span style=\"color: #FF79C6\">}<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>To make the hack work, first you need to know where your system will store the &#8216;six&#8217; module. For this, install the module and then check where the library is stored:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#282A36\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#F8F8F2;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><textarea class=\"code-block-pro-copy-button-textarea\" aria-hidden=\"true\" readonly>   apt-get update &amp;&amp; apt-get install python3-six\n   dpkg -L python3-six<\/textarea><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dracula\" style=\"background-color: #282A36\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #F8F8F2\">   <\/span><span style=\"color: #50FA7B\">apt-get<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #F1FA8C\">update<\/span><span style=\"color: #F8F8F2\"> &amp;&amp; <\/span><span style=\"color: #50FA7B\">apt-get<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #F1FA8C\">install<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #F1FA8C\">python3-six<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">   <\/span><span style=\"color: #50FA7B\">dpkg<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #BD93F9\">-L<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #F1FA8C\">python3-six<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>In my case it is stored in usr\/lib\/python3\/dist-packages. Hence I will add the following to the <strong>__init__<\/strong>.py of my main module:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#282A36\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#F8F8F2;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><textarea class=\"code-block-pro-copy-button-textarea\" aria-hidden=\"true\" readonly>   import sys\n   sys.path.append(&#8216;usr\/lib\/python3\/dist-packages&#8217;)<\/textarea><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dracula\" style=\"background-color: #282A36\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #F8F8F2\">   <\/span><span style=\"color: #50FA7B\">import<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #F1FA8C\">sys<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">   <\/span><span style=\"color: #50FA7B\">sys.path.append(<\/span><span style=\"color: #50FA7B\">&#39;usr\/lib\/python3\/dist-packages&#39;<\/span><span style=\"color: #F8F8F2\">)<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>I know this is not the cleanest approach, but for some reason the python interpreter inside the virtual environment doest not uses the &#8216;dist-packages&#8217; libraries. I have tried using the &#8211;use-system-package option, but it does not work for me.<\/p>\n\n\n\n<p>Hope this helps you build your project.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this post we are going to create a debian package for a project that involves importing pandas and numpy. We will do it for Debian 9 and Debian 10. In a previous post, I made a tutorial on how to use dh-virtualenv to create a debian package for a python project. In case you&#8230;<\/p>\n","protected":false},"author":2,"featured_media":284,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[25,28,47,50,55],"class_list":["post-304","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-projects","tag-debian","tag-dh-virtualenv","tag-numpy","tag-pandas","tag-python"],"_links":{"self":[{"href":"https:\/\/camilo.matajira.com\/index.php?rest_route=\/wp\/v2\/posts\/304","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/camilo.matajira.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/camilo.matajira.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/camilo.matajira.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/camilo.matajira.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=304"}],"version-history":[{"count":2,"href":"https:\/\/camilo.matajira.com\/index.php?rest_route=\/wp\/v2\/posts\/304\/revisions"}],"predecessor-version":[{"id":575,"href":"https:\/\/camilo.matajira.com\/index.php?rest_route=\/wp\/v2\/posts\/304\/revisions\/575"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/camilo.matajira.com\/index.php?rest_route=\/wp\/v2\/media\/284"}],"wp:attachment":[{"href":"https:\/\/camilo.matajira.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=304"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/camilo.matajira.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=304"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/camilo.matajira.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=304"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}