facioquo / stock-indicators-python

Stock Indicators for Python. Maintained by @LeeDongGeon1996
https://python.StockIndicators.dev
Apache License 2.0
220 stars 37 forks source link

Having Issue with Setup #277

Closed onuroruc closed 1 year ago

onuroruc commented 1 year ago

I installed the library with "pip install stock-indicators". However, when I try to import the library, it get a report like below:


OSError Traceback (most recent call last) /var/folders/zw/301wrgp50nb4395pkp_f9xrm0000gn/T/ipykernel_58482/357114019.py in ----> 1 from stock_indicators import indicators

~/opt/anaconda3/lib/python3.9/site-packages/stock_indicators/init.py in 15 """ 16 ---> 17 from stock_indicators import indicators 18 from stock_indicators.indicators.common import *

~/opt/anaconda3/lib/python3.9/site-packages/stock_indicators/indicators/init.py in 1 """All available APIs for calculating indicators.""" 2 ----> 3 from stock_indicators import _cslib 4 5 from .adl import (get_adl)

~/opt/anaconda3/lib/python3.9/site-packages/stock_indicators/_cslib/init.py in 10 11 import os ---> 12 import clr 13 14 skender_stock_indicators_dll_path = os.path.join(

~/opt/anaconda3/lib/python3.9/site-packages/clr.py in 4 5 from pythonnet import load ----> 6 load()

~/opt/anaconda3/lib/python3.9/site-packages/pythonnet/init.py in load() 34 # TODO: Warn, in the future the runtime must be set explicitly, either 35 # as a config/env variable or via set_runtime ---> 36 set_default_runtime() 37 38 dll_path = join(dirname(file), "runtime", "Python.Runtime.dll")

~/opt/anaconda3/lib/python3.9/site-packages/pythonnet/init.py in set_default_runtime() 20 set_runtime(clr_loader.get_netfx()) 21 else: ---> 22 set_runtime(clr_loader.get_mono()) 23 24

~/opt/anaconda3/lib/python3.9/site-packages/clr_loader/init.py in get_mono(config_file, global_config_file, libmono, sgen, debug, jit_options) 56 libmono = find_libmono(sgen=sgen) 57 ---> 58 impl = Mono( 59 # domain=domain, 60 debug=debug,

~/opt/anaconda3/lib/python3.9/site-packages/clr_loader/mono.py in init(self, libmono, domain, debug, jit_options, config_file, global_config_file) 28 self._assemblies: Dict[Path, Any] = {} 29 ---> 30 self._version = initialize( 31 config_file=optional_path_as_string(config_file), 32 debug=debug,

~/opt/anaconda3/lib/python3.9/site-packages/clr_loader/mono.py in initialize(libmono, debug, jit_options, config_file, global_config_file) 125 global _MONO, _ROOT_DOMAIN 126 if _MONO is None: --> 127 _MONO = load_mono(libmono) 128 129 # Load in global config (i.e /etc/mono/config)

~/opt/anaconda3/lib/python3.9/site-packages/clr_loader/ffi/init.py in load_mono(path) 38 39 path_str = str(path) if path else None ---> 40 return ffi.dlopen(path_str, ffi.RTLD_GLOBAL) 41 42

~/opt/anaconda3/lib/python3.9/site-packages/cffi/api.py in dlopen(self, name, flags) 148 "or an already-opened 'void *' handle") 149 with self._lock: --> 150 lib, function_cache = _make_ffi_library(self, name, flags) 151 self._function_caches.append(function_cache) 152 self._libraries.append(lib)

~/opt/anaconda3/lib/python3.9/site-packages/cffi/api.py in _make_ffi_library(ffi, libname, flags) 830 def _make_ffi_library(ffi, libname, flags): 831 backend = ffi._backend --> 832 backendlib = _load_backend_lib(backend, libname, flags) 833 # 834 def accessor_function(name):

~/opt/anaconda3/lib/python3.9/site-packages/cffi/api.py in _load_backend_lib(backend, name, flags) 825 if first_error is not None: 826 msg = "%s. Additionally, %s" % (first_error, msg) --> 827 raise OSError(msg) 828 return backend.load_library(path, flags) 829

OSError: cannot load library '/Library/Frameworks/Mono.framework/Versions/Current/lib/libmonosgen-2.0.dylib': dlopen(/Library/Frameworks/Mono.framework/Versions/Current/lib/libmonosgen-2.0.dylib, 0x000A): tried: '/Library/Frameworks/Mono.framework/Versions/Current/lib/libmonosgen-2.0.dylib' (no such file), '/usr/local/lib/libmonosgen-2.0.dylib' (no such file), '/usr/lib/libmonosgen-2.0.dylib' (no such file). Additionally, ctypes.util.find_library() did not manage to locate a library called '/Library/Frameworks/Mono.framework/Versions/Current/lib/libmonosgen-2.0.dylib'

When I try to install with setup.py, I got a warning about the version not being supported, what can I do?

LeeDongGeon1996 commented 1 year ago

Hi😀 @onuroruc , there are two solutions you should try:

  1. Make sure that you have Mono runtime installed.
  2. Check your clr-loader version using pip list command, and downgrade to 0.1.7.