Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

possible MacOs issue #408

Open
keltik85 opened this issue Dec 19, 2024 · 8 comments
Open

possible MacOs issue #408

keltik85 opened this issue Dec 19, 2024 · 8 comments
Labels
bug Something isn't working dependencies Pull requests that update a dependency file enhancement New feature or request

Comments

@keltik85
Copy link

What happened?

ls -all /Users/myuser/my-pthon-project/venv/lib/python3.9/site-packages/stock_indicators/_cslib/lib

and it does exist.

  • System Version: macOS 15.2 (24C101), Kernel Version: Darwin 24.2.0
  • .NET for MacOs is installed:
dotnet --version
9.0.101
  • python.net is installed:
pip3 show pythonnet
Name: pythonnet
Version: 3.0.5

Code usage

from stock_indicators import Quote, EndType, indicators

...

results = indicators.get_zig_zag(quotes_list, EndType.HIGH_LOW, 3)

Log output

import sys; print('Python %s on %s' % (sys.version, sys.platform))
/Users/myuser/my-python-project/venv/bin/python -X pycache_prefix=/Users/myuser/Library/Caches/JetBrains/IntelliJIdea2023.3/cpython-cache /Users/myuser/Library/Application Support/JetBrains/IntelliJIdea2023.3/plugins/python/helpers/pydev/pydevd.py --multiprocess --qt-support=auto --client 127.0.0.1 --port 50730 --file /Users/myuser/my-python-project/scripts/find-candlestick-patterns.py 
Connected to pydev debugger (build 233.13135.103)
Traceback (most recent call last):
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 790, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "/Users/myuser/my-python-project/venv/lib/python3.9/site-packages/stock_indicators/__init__.py", line 17, in <module>
    from stock_indicators import indicators
  File "/Users/myuser/my-python-project/venv/lib/python3.9/site-packages/stock_indicators/indicators/__init__.py", line 3, in <module>
    from stock_indicators import _cslib
  File "/Users/myuser/my-python-project/venv/lib/python3.9/site-packages/stock_indicators/_cslib/__init__.py", line 25, in <module>
    clr.AddReference(skender_stock_indicators_dll_path)
System.IO.FileNotFoundException: Could not load file or assembly '/Users/myuser/my-python-project/venv/lib/python3.9/site-packages/stock_indicators/_cslib/lib/Skender.Stock.Indicators.dll, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.

File name: '/Users/myuser/my-python-project/venv/lib/python3.9/site-packages/stock_indicators/_cslib/lib/Skender.Stock.Indicators.dll, Culture=neutral, PublicKeyToken=null'
   at System.Reflection.RuntimeAssembly.InternalLoad(AssemblyName assemblyName, StackCrawlMark& stackMark, AssemblyLoadContext assemblyLoadContext, RuntimeAssembly requestingAssembly, Boolean throwOnFileNotFound)
   at System.Reflection.Assembly.Load(AssemblyName assemblyRef)
   at Python.Runtime.AssemblyManager.LoadAssembly(AssemblyName name) in /home/benedikt/.cache/uv/sdists-v6/.tmpkW03e6/pythonnet-3.0.5/src/runtime/AssemblyManager.cs:line 234
   at Python.Runtime.CLRModule.AddReference(String name) in /home/benedikt/.cache/uv/sdists-v6/.tmpkW03e6/pythonnet-3.0.5/src/runtime/Types/ClrModule.cs:line 109
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
   at System.Reflection.MethodBaseInvoker.InvokeDirectByRefWithFewArgs(Object obj, Span`1 copyOfArgs, BindingFlags invokeAttr)
python-BaseException
@DaveSkender
Copy link
Member

DaveSkender commented Dec 19, 2024

What do you see when you run:

pip freeze --local

We also have a QuickStart tutorial that walks through setup steps in detail, if helpful.

@DaveSkender
Copy link
Member

@keltik85 were you able to resolve this issue on your own?

@DaveSkender DaveSkender added user support Help a user and removed bug Something isn't working labels Dec 24, 2024
@DaveSkender DaveSkender moved this from 💡 Triage to 🏗 In progress in Stock Indicators for Python Dec 24, 2024
@edlang
Copy link

edlang commented Dec 26, 2024

I'm seeing the same issue on a vanilla Debian 12 Bookworm freshly provisioned in Azure.

$ cat /etc/debian_version
12.8

$ dpkg -l | grep ^ii | grep dotnet
ii dotnet-apphost-pack-9.0 9.0.0-1 amd64 Microsoft.NETCore.App.Host 9.0.0
ii dotnet-host 9.0.0-1 amd64 Microsoft .NET Host - 9.0.0
ii dotnet-hostfxr-9.0 9.0.0-1 amd64 Microsoft .NET Host FX Resolver - 9.0.0
ii dotnet-runtime-9.0 9.0.0-1 amd64 Microsoft.NETCore.App.Runtime 9.0.0
ii dotnet-runtime-deps-9.0 9.0.0-1 amd64 dotnet-runtime-deps-debian 9.0.0
ii dotnet-sdk-9.0 9.0.101-1 amd64 Microsoft .NET SDK 9.0.101
ii dotnet-targeting-pack-9.0 9.0.0-1 amd64 Microsoft.NETCore.App.Ref 9.0.0

$ pip freeze --local | grep stock
stock-indicators==1.3.1

$ python
Python 3.11.2 (main, Sep 14 2024, 03:00:30) [GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.

import stock_indicators
Traceback (most recent call last):
File "", line 1, in
File "/home/edlang/src/repos/dummy/env/lib/python3.11/site-packages/stock_indicators/init.py", line 17, in
from stock_indicators import indicators
File "/home/edlang/src/repos/dummy/env/lib/python3.11/site-packages/stock_indicators/indicators/init.py", line 3, in
from stock_indicators import _cslib
File "/home/edlang/src/repos/dummy/env/lib/python3.11/site-packages/stock_indicators/_cslib/init.py", line 25, in
clr.AddReference(skender_stock_indicators_dll_path)
System.IO.FileNotFoundException: Could not load file or assembly '/home/edlang/src/repos/dummy/env/lib/python3.11/site-packages/stock_indicators/_cslib/lib/Skender.Stock.Indicators.dll, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.

File name: '/home/edlang/src/repos/dummy/env/lib/python3.11/site-packages/stock_indicators/_cslib/lib/Skender.Stock.Indicators.dll, Culture=neutral, PublicKeyToken=null'
at System.Reflection.RuntimeAssembly.InternalLoad(AssemblyName assemblyName, StackCrawlMark& stackMark, AssemblyLoadContext assemblyLoadContext, RuntimeAssembly requestingAssembly, Boolean throwOnFileNotFound)
at System.Reflection.Assembly.Load(AssemblyName assemblyRef)
at Python.Runtime.AssemblyManager.LoadAssembly(AssemblyName name) in /home/benedikt/.cache/uv/sdists-v6/.tmpkW03e6/pythonnet-3.0.5/src/runtime/AssemblyManager.cs:line 234
at Python.Runtime.CLRModule.AddReference(String name) in /home/benedikt/.cache/uv/sdists-v6/.tmpkW03e6/pythonnet-3.0.5/src/runtime/Types/ClrModule.cs:line 109
at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
at System.Reflection.MethodBaseInvoker.InvokeDirectByRefWithFewArgs(Object obj, Span`1 copyOfArgs, BindingFlags invokeAttr)

$ ls -lart /home/edlang/src/repos/dummy/env/lib/python3.11/site-packages/stock_indicators/_cslib/lib/Skender.Stock.Indicators.dll
-rw-r--r-- 1 edlang edlang 219648 Dec 26 07:26 /home/edlang/src/repos/dummy/env/lib/python3.11/site-packages/stock_indicators/_cslib/lib/Skender.Stock.Indicators.dll

@edlang
Copy link

edlang commented Dec 26, 2024

Some more details: it seems to be a compatibility issue with the .NET 9 runtime / SDK. The module imports correctly when using the .NET 8 runtime and SDK.

@DaveSkender
Copy link
Member

DaveSkender commented Dec 26, 2024

Some more details: it seems to be a compatibility issue with the .NET 9 runtime / SDK. The module imports correctly when using the .NET 8 runtime and SDK.

Helpful! Thank you. This DLL was built with .NET 8 and the internals for CLR must depend on that particular SDK.

This poses an interesting dilemma about maintaining environment compatibility — we could update that DLL to the latest version built on .NET 9, but that’d be a breaking change for people who’ve not upgraded their environment accordingly.

Tip

Workaround: install .NET 8 SDK

@DaveSkender DaveSkender added bug Something isn't working enhancement New feature or request dependencies Pull requests that update a dependency file and removed user support Help a user labels Dec 26, 2024
@LeeDongGeon1996
Copy link
Member

LeeDongGeon1996 commented Dec 31, 2024

@DaveSkender The target version of distributed dll is .NET 6.0. And AFAIK, that's how we're supporting all the versions above .NET 6.0.
Do we need to include the .NET 6.0 dll built on .NET 9..?

This module loads `Skender.Stock.Indicators.dll`(v2.5.0), which is a compiled library package
from <https://github.com/DaveSkender/Stock.Indicators>, written in C#.
The target framework of dll is `.NET 6.0`.

@DaveSkender
Copy link
Member

@DaveSkender The target version of distributed dll is .NET 6.0. And AFAIK, that's how we're supporting all the versions above .NET 6.0. Do we need to include the .NET 6.0 dll built on .NET 9..?

That might work, let's update our build workflows to first just use .NET 9 SDK to see if it breaks similarly on MacOS builds (it should); then we can update use the net6.0 DLL from v2.6.0 which was built on .NET 9, to see if that works.

@carusyte
Copy link

carusyte commented Jan 1, 2025

I just met the same issue on MacOS and .Net 9. Hope the version compatibility could be fixed soon. Thanks in advance!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working dependencies Pull requests that update a dependency file enhancement New feature or request
Projects
Status: 🏗 In progress
Development

When branches are created from issues, their pull requests are automatically linked.

5 participants