Closed heury closed 3 months ago
#/home/user/anaconda3/lib/python3.11/site-packages/polars_talib/__init.py__
from pathlib import Path
#lib = _get_shared_lib_location(__file__)
lib = Path(__file__).parent.__str__()
But anyway, library update is highly appreciated!
Thanks for your solution
It would be greeat to update to Polars 1 and over, this should not be a solution. It should be reopened. This works before import, but should not be the solution.
import sys
from pathlib import Path
def find_and_modify_polars_talib():
# Find the polars_talib installation
polars_talib_path = next((Path(p) / 'polars_talib' for p in sys.path if (Path(p) / 'polars_talib').exists()), None)
if polars_talib_path is None:
print("polars_talib not found in sys.path")
return
# Modify the __init__.py file
init_file = polars_talib_path / '__init__.py'
with open(init_file, 'r') as f:
content = f.read()
# Replace the problematic import and lib definition
new_content = content.replace(
"from polars.utils.udfs import _get_shared_lib_location",
"from pathlib import Path"
)
new_content = new_content.replace(
"lib = _get_shared_lib_location(__file__)",
"lib = str(Path(__file__).parent)"
)
with open(init_file, 'w') as f:
f.write(new_content)
print(f"Updated {init_file}")
# Run the function to modify polars_talib
find_and_modify_polars_talib()
fix with version 0.1.3
After upgrading to polars 1.0, the following error occurred. Would you guide me how to fix it?
from polars.utils.udfs import _get_shared_lib_location ModuleNotFoundError: No module named 'polars.utils'