pyreadr icon indicating copy to clipboard operation
pyreadr copied to clipboard

undefined symbol : libiconv

Open sxr740 opened this issue 10 months ago • 2 comments

ImportError Traceback (most recent call last) Cell In[1], line 1 ----> 1 import pyreadr

File ~/y/libs/x/python/lib/python3.11/site-packages/pyreadr/init.py:1 ----> 1 from .pyreadr import read_r, list_objects, write_rds, write_rdata, download_file 2 from .custom_errors import PyreadrError, LibrdataError 4 version = "0.5.2"

File ~/y/libs/x/python/lib/python3.11/site-packages/pyreadr/pyreadr.py:10 6 from urllib.request import urlopen 8 import pandas as pd ---> 10 from ._pyreadr_parser import PyreadrParser, ListObjectsParser 11 from ._pyreadr_writer import PyreadrWriter 12 from .custom_errors import PyreadrError

File ~/y/libs/x/python/lib/python3.11/site-packages/pyreadr/_pyreadr_parser.py:17 14 except: 15 pass ---> 17 from .librdata import Parser 18 from .custom_errors import PyreadrError 22 class Table:

ImportError: /home/z/y/libs/x/python/lib/python3.11/site-packages/pyreadr/librdata.cpython-311-x86_64-linux-gnu.so: undefined symbol: libiconv

when tring to import pyreadr this issue is coming..I think all the functionalities of libiconv is now in libc6. In ubuntu 2204 the libiconv is not there..So what may be the reason for this issue.

versions used ubuntu 22.04 python 3.11 pyreadr 0.5.2

sxr740 avatar Mar 04 '25 10:03 sxr740

in order to be able to try to reproduce the issue, please indicate how you installed python, please indicate how you installed pyreadr. Although probably that would not solve the issue, try now with the latest version pyreadr 0.5.3. If you installed from pip and you are not using miniconda/miniforge etc, you can try to compile from source, that may solve the issue

ofajardo avatar Mar 05 '25 10:03 ofajardo

The issue is solved once I used the Pyreader wheel file for installing pyreadr.. Eralier I used the Pyreadr tar file for installing the same, that is when the issue occured..

sxr740 avatar Mar 05 '25 15:03 sxr740

Somehow I was using Ubuntu 24.04 and everything was fine. I updated my environment and then the problem arose. The solution is to statically link iconv in setup.py. However, for other distros (or old ubuntu), linking raises an error. I have not found a good way to detect in which situation we are before hand, for now I have introduced that for ubuntu iconv should be statically linked, but not for other distros.

ofajardo avatar Jun 30 '25 07:06 ofajardo

Earlier I was using the tar file for installing the package so it used to compile the entire package, so later I used the wheel(.whl) file for installing the package and hence it is already compiled my issue is resolved..

sxr740 avatar Jun 30 '25 08:06 sxr740