Back

Running local python algorithm error

I'm trying to run a python algorithm locally on my Mac but got the error below. I did follow the instructions for adding python support already so don't know what else am I missing. The C# version was running fine. Anyone has any idea on how to fix this? 

 

20180722 22:05:59.990 ERROR:: Loader.TryCreatePythonAlgorithm():  System.Exception: AlgorithmPythonWrapper(): The dynamic-link library for python3.6m could not be found. Please visit https://github.com/QuantConnect/Lean/blob/master/Algorithm.Python/readme.md for instructions on how to enable python support in Unix python3.6m
  at QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper..ctor (System.String moduleName) [0x00304] in /Users/sunrise/Quant/Lean/AlgorithmFactory/Python/Wrappers/AlgorithmPythonWrapper.cs:103 
  at QuantConnect.AlgorithmFactory.Loader.TryCreatePythonAlgorithm (System.String assemblyPath, QuantConnect.Interfaces.IAlgorithm& algorithmInstance, System.String& errorMessage) [0x000b3] in /Users/sunrise/Quant/Lean/AlgorithmFactory/Loader.cs:172 
20180722 22:06:00.646 ERROR:: Engine.Run():  QuantConnect.Lean.Engine.Setup.AlgorithmSetupException: During the algorithm initialization, the following exception has occurred: Loader.TryCreatePythonAlgorithm(): Unable to import python module ../../../Algorithm.Python/BasicTemplateFrameworkAlgorithm.py. AlgorithmPythonWrapper(): The dynamic-link library for python3.6m could not be found. Please visit https://github.com/QuantConnect/Lean/blob/master/Algorithm.Python/readme.md for instructions on how to enable python support in Unix python3.6m
  at QuantConnect.Lean.Engine.Setup.ConsoleSetupHandler.CreateAlgorithmInstance (QuantConnect.Packets.AlgorithmNodePacket algorithmNodePacket, System.String assemblyPath) [0x00060] in /Users/sunrise/Quant/Lean/Engine/Setup/ConsoleSetupHandler.cs:92 
  at QuantConnect.Lean.Engine.Engine.Run (QuantConnect.Packets.AlgorithmNodePacket job, QuantConnect.Lean.Engine.AlgorithmManager manager, System.String assemblyPath) [0x000d7] in /Users/sunrise/Quant/Lean/Engine/Engine.cs:115 
 

Update Backtest







Hi Nigel N , which python distribuition do you get? Anaconda 5.2 with Python 3.6?
Please checkout whether you have libpython3.6m.dylib in your system:

find / libpython3.6* | grep libpython3.6*

Maybe you don't have the library with pymalloc (it has an 'm' after 3.6), but you should if you install Anaconda 5.2.
Another possibility is that you don't have the right environment set when launching Lean.

0

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Alexandre,



I do have python 3.6m installed. I didn't get any error messages when

running setup.py. I tried to install pythonnet manually and got the

following error below.



python3.6m -m pip install -U git+https://github.com/QuantConnect/pythonnet



Collecting git+https://github.com/QuantConnect/pythonnet



Cloning https://github.com/QuantConnect/pythonnet to

/private/var/folders/ks/1f29qrhn0vzgfd366fk8r39m0000gn/T/pip-req-build-8mgj84of



Building wheels for collected packages: pythonnet



Running setup.py bdist_wheel for pythonnet ... error



Complete output from command /anaconda3/bin/python3.6m -u -c "import

setuptools,

tokenize;__file__='/private/var/folders/ks/1f29qrhn0vzgfd366fk8r39m0000gn/T/pip-req-build-8mgj84of/setup.py';f=getattr(tokenize,

'open', open)(__file__);code=f.read().replace('\r\n',

'\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d

/private/var/folders/ks/1f29qrhn0vzgfd366fk8r39m0000gn/T/pip-wheel-igbqnv74
0

Could you please provide your system details (macOS version, python version)?
And the output of 

find / libpython3.6* | grep libpython3.6*

What if you try to install pythonnet simply with:

pip install -U git+https://github.com/QuantConnect/pythonnet

Lean/setup.py does it for you and it should print out an error message if it fails.

0

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Update Backtest





0

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Loading...

This discussion is closed