.NET runtime environment required in a python code, so how do I deploy it as an Azure App Service?

Wasim Bijili A S 0 Reputation points
2024-05-10T15:27:01.0666667+00:00

2024-05-10T08:10:16.972810276Z Traceback (most recent call last): 2024-05-10T08:10:16.972823177Z File "/tmp/8dc70c645302e9a/antenv/lib/python3.10/site-packages/pythonnet/init.py", line 77, in create_runtime_from_spec 2024-05-10T08:10:16.972844078Z return clr_loader.get_coreclr(**params) 2024-05-10T08:10:16.972848778Z File "/tmp/8dc70c645302e9a/antenv/lib/python3.10/site-packages/clr_loader/init.py", line 121, in get_coreclr 2024-05-10T08:10:16.972853478Z dotnet_root = find_dotnet_root() 2024-05-10T08:10:16.972857879Z File "/tmp/8dc70c645302e9a/antenv/lib/python3.10/site-packages/clr_loader/util/find.py", line 57, in find_dotnet_root 2024-05-10T08:10:16.972862379Z raise RuntimeError("Can not determine dotnet root") 2024-05-10T08:10:16.972866879Z RuntimeError: Can not determine dotnet root 2024-05-10T08:10:16.972871179Z 2024-05-10T08:10:16.972875380Z The above exception was the direct cause of the following exception: 2024-05-10T08:10:16.972880080Z 2024-05-10T08:10:16.972884280Z Traceback (most recent call last): 2024-05-10T08:10:16.972888680Z File "/tmp/8dc70c645302e9a/antenv/lib/python3.10/site-packages/stock_indicators/cslib/init.py", line 15, in <module> 2024-05-10T08:10:16.972893781Z load(runtime="coreclr") 2024-05-10T08:10:16.972898181Z File "/tmp/8dc70c645302e9a/antenv/lib/python3.10/site-packages/pythonnet/init.py", line 135, in load 2024-05-10T08:10:16.972902681Z set_runtime(runtime, **params) 2024-05-10T08:10:16.972907082Z File "/tmp/8dc70c645302e9a/antenv/lib/python3.10/site-packages/pythonnet/init.py", line 29, in set_runtime 2024-05-10T08:10:16.972911582Z runtime = _create_runtime_from_spec(runtime, params) 2024-05-10T08:10:16.972915982Z File "/tmp/8dc70c645302e9a/antenv/lib/python3.10/site-packages/pythonnet/init.py", line 90, in _create_runtime_from_spec 2024-05-10T08:10:16.972920482Z raise RuntimeError( 2024-05-10T08:10:16.972924783Z RuntimeError: Failed to create a .NET runtime (coreclr) using the 2024-05-10T08:10:16.972929083Z parameters {}. 2024-05-10T08:10:16.972933383Z 2024-05-10T08:10:16.972937483Z The above exception was the direct cause of the following exception: 2024-05-10T08:10:16.972941884Z 2024-05-10T08:10:16.972945984Z Traceback (most recent call last): 2024-05-10T08:10:16.972950384Z File "/opt/python/3.10.13/lib/python3.10/site-packages/gunicorn/arbiter.py", line 609, in spawn_worker 2024-05-10T08:10:16.972954784Z worker.init_process() 2024-05-10T08:10:16.972959085Z File "/opt/python/3.10.13/lib/python3.10/site-packages/gunicorn/workers/base.py", line 134, in init_process 2024-05-10T08:10:16.972963585Z self.load_wsgi() 2024-05-10T08:10:16.972967885Z File "/opt/python/3.10.13/lib/python3.10/site-packages/gunicorn/workers/base.py", line 146, in load_wsgi 2024-05-10T08:10:16.972972386Z self.wsgi = self.app.wsgi() 2024-05-10T08:10:16.972977586Z File "/opt/python/3.10.13/lib/python3.10/site-packages/gunicorn/app/base.py", line 67, in wsgi 2024-05-10T08:10:16.972982086Z self.callable = self.load() 2024-05-10T08:10:16.972991087Z File "/opt/python/3.10.13/lib/python3.10/site-packages/gunicorn/app/wsgiapp.py", line 58, in load 2024-05-10T08:10:16.972995887Z return self.load_wsgiapp() 2024-05-10T08:10:16.973000087Z File "/opt/python/3.10.13/lib/python3.10/site-packages/gunicorn/app/wsgiapp.py", line 48, in load_wsgiapp 2024-05-10T08:10:16.973004587Z return util.import_app(self.app_uri) 2024-05-10T08:10:16.973008888Z File "/opt/python/3.10.13/lib/python3.10/site-packages/gunicorn/util.py", line 371, in import_app 2024-05-10T08:10:16.973013388Z mod = importlib.import_module(module) 2024-05-10T08:10:16.973017588Z File "/opt/python/3.10.13/lib/python3.10/importlib/init.py", line 126, in import_module 2024-05-10T08:10:16.973022089Z return _bootstrap._gcd_import(name[level:], package, level) 2024-05-10T08:10:16.973026489Z File "<frozen importlib._bootstrap>", line 1050, in _gcd_import 2024-05-10T08:10:16.973031189Z File "<frozen importlib._bootstrap>", line 1027, in _find_and_load 2024-05-10T08:10:16.973035689Z File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked 2024-05-10T08:10:16.973040090Z File "<frozen importlib._bootstrap>", line 688, in _load_unlocked 2024-05-10T08:10:16.973044590Z File "<frozen importlib._bootstrap_external>", line 883, in exec_module 2024-05-10T08:10:16.973049290Z File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed 2024-05-10T08:10:16.973053790Z File "/tmp/8dc70c645302e9a/app.py", line 4, in <module> 2024-05-10T08:10:16.973058291Z from OP_main_buy_code.analyze_trades_wrapper import analyze_trades_wrapper 2024-05-10T08:10:16.973062791Z File "/tmp/8dc70c645302e9a/OP_main_buy_code/analyze_trades_wrapper.py", line 2, in <module> 2024-05-10T08:10:16.973067491Z from OP_main_buy_code.analyze_trades import analyze_trades 2024-05-10T08:10:16.973071792Z File "/tmp/8dc70c645302e9a/OP_main_buy_code/analyze_trades.py", line 3, in <module> 2024-05-10T08:10:16.973076292Z from OP_main_buy_code.analyze_for_timeframe import analyze_for_timeframe 2024-05-10T08:10:16.973080692Z File "/tmp/8dc70c645302e9a/OP_main_buy_code/analyze_for_timeframe.py", line 4, in <module> 2024-05-10T08:10:16.973085192Z from OP_main_buy_code.bullish_momentum_check import bullish_momentum_check 2024-05-10T08:10:16.973089593Z File "/tmp/8dc70c645302e9a/OP_main_buy_code/bullish_momentum_check.py", line 1, in <module> 2024-05-10T08:10:16.973094093Z from OP_main_buy_code.conditions.bullish_momentum_setup.MACD_greater_than_signal_line import \ 2024-05-10T08:10:16.973098693Z File "/tmp/8dc70c645302e9a/OP_main_buy_code/conditions/bullish_momentum_setup/MACD_greater_than_signal_line.py", line 1, in <module> 2024-05-10T08:10:16.973103894Z from stock_indicators.indicators.ema import get_ema 2024-05-10T08:10:16.973108294Z File "/tmp/8dc70c645302e9a/antenv/lib/python3.10/site-packages/stock_indicators/init.py", line 17, in <module> 2024-05-10T08:10:16.973116594Z from stock_indicators import indicators 2024-05-10T08:10:16.973120995Z File "/tmp/8dc70c645302e9a/antenv/lib/python3.10/site-packages/stock_indicators/indicators/init.py", line 3, in <module> 2024-05-10T08:10:16.973125695Z from stock_indicators import cslib 2024-05-10T08:10:16.973129995Z File "/tmp/8dc70c645302e9a/antenv/lib/python3.10/site-packages/stock_indicators/cslib/init.py", line 18, in <module> 2024-05-10T08:10:16.973134595Z raise ImportError("Stock Indicators for Python has a dependency on CLR.\n" 2024-05-10T08:10:16.973139196Z ImportError: Stock Indicators for Python has a dependency on CLR. 2024-05-10T08:10:16.973143696Z Install .NET SDK 6.0 (or newer) in your environment to add the required CLR capability. 2024-05-10T08:10:16.979513482Z [2024-05-10 08:10:16 +0000] [73] [INFO] Worker exiting (pid: 73) 2024-05-10T08:10:17.092743239Z [2024-05-10 08:10:17 +0000] [70] [ERROR] Worker (pid:73) exited with code 3 2024-05-10T08:10:17.100249094Z [2024-05-10 08:10:17 +0000] [70] [ERROR] Shutting down: Master 2024-05-10T08:10:17.100274695Z [2024-05-10 08:10:17 +0000] [70] [ERROR] Reason: Worker failed to boot.

.NET
.NET
Microsoft Technologies based on the .NET software framework.
3,459 questions
Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
7,028 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Bruce (SqlWork.com) 57,886 Reputation points
    2024-05-10T17:09:26.88+00:00

    the python webapp hosting is a Linux environment and does not have the .net core runtime installed. while you could try to include as native library, I don't believe web app define the linux distro.

    you should switch to azure web app for docker, and build a docker image that supports python and .net core.

    0 comments No comments