Back

How do I add an entry to the system path variable (C:\Python27)

https://github.com/QuantConnect/Lean/tree/master/Algorithm.Python

I am getting an error: Unable to import python module

I suspect this is because I haven't followed the guide on the link thats states to add an entry to system path.
My question is: How do I do this?

Update Backtest








Running MSVS community 2017

The full error message on the console (after hitting f5 on my python code is):

20170830 23:57:37 Trace:: Config.Get(): Configuration key not found. Key: plugin-directory - Using default value:
20170830 23:57:38 Trace:: Config.GetValue(): debug-mode - Using default value: False
20170830 23:57:40 Trace:: Config.Get(): Configuration key not found. Key: data-directory - Using default value: ../../../Data/
20170830 23:57:40 Trace:: Config.Get(): Configuration key not found. Key: version-id - Using default value:
20170830 23:57:40 Trace:: Engine.Main(): LEAN ALGORITHMIC TRADING ENGINE v2.4.0.1 Mode: DEBUG (64bit)
20170830 23:57:40 Trace:: Engine.Main(): Started 11:57 PM
20170830 23:57:40 Trace:: Engine.Main(): Memory 68Mb-App  6Mb-Used  1212Mb-Total
20170830 23:57:40 Trace:: Config.GetValue(): job-project-id - Using default value: 0
20170830 23:57:40 Trace:: Config.Get(): Configuration key not found. Key: algorithm-path-python - Using default value: ../../../Algorithm.Python/
20170830 23:57:40 Trace:: Config.Get(): Configuration key not found. Key: lean-manager-type - Using default value: LocalLeanManager
20170830 23:57:41 Trace:: JobQueue.NextJob(): Selected ../../../Algorithm.Python/BasicTemplateAlgorithm.py
20170830 23:57:41 Trace:: Config.Get(): Configuration key not found. Key: history-provider - Using default value: SubscriptionDataReaderHistoryProvider
20170830 23:57:41 Trace:: Config.GetValue(): ignore-version-checks - Using default value: False
20170830 23:57:41 Trace:: Config.GetValue(): algorithm-manager-time-loop-maximum - Using default value: 10
20170830 23:57:41 ERROR:: Loader.TryCreatePythonAlgorithm():  System.DllNotFoundException: Unable to load DLL 'python27': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
   at Python.Runtime.Runtime.Py_IsInitialized()
   at Python.Runtime.Runtime.Initialize()
   at Python.Runtime.PythonEngine.Initialize(IEnumerable`1 args, Boolean setSysArgv)
   at Python.Runtime.PythonEngine.Initialize()
   at QuantConnect.AlgorithmFactory.Loader.TryCreatePythonAlgorithm(String assemblyPath, IAlgorithm& algorithmInstance, String& errorMessage) in C:\Lean\AlgorithmFactory\Loader.cs:line 164
20170830 23:57:42 ERROR:: Engine.Run():  System.Exception: Loader.TryCreatePythonAlgorithm(): Unable to import python module ../../../Algorithm.Python/BasicTemplateAlgorithm.py. Unable to load DLL 'python27': The specified module could not be found. (Exception from HRESULT: 0x8007007E): try re-building algorithm.
   at QuantConnect.Lean.Engine.Setup.ConsoleSetupHandler.CreateAlgorithmInstance(AlgorithmNodePacket algorithmNodePacket, String assemblyPath) in C:\Lean\Engine\Setup\ConsoleSetupHandler.cs:line 94
   at QuantConnect.Lean.Engine.Engine.Run(AlgorithmNodePacket job, AlgorithmManager manager, String assemblyPath) in C:\Lean\Engine\Engine.cs:line 111
20170830 23:57:42 Trace:: JOB HANDLERS:
20170830 23:57:42 Trace::          DataFeed:     QuantConnect.Lean.Engine.DataFeeds.FileSystemDataFeed
20170830 23:57:42 Trace::          Setup:        QuantConnect.Lean.Engine.Setup.ConsoleSetupHandler
20170830 23:57:42 Trace::          RealTime:     QuantConnect.Lean.Engine.RealTime.BacktestingRealTimeHandler
20170830 23:57:42 Trace::          Results:      QuantConnect.Lean.Engine.Results.BacktestingResultHandler
20170830 23:57:42 Trace::          Transactions: QuantConnect.Lean.Engine.TransactionHandlers.BacktestingTransactionHandler
20170830 23:57:42 Trace:: Config.GetValue(): send-via-api - Using default value: False
20170830 23:57:42 ERROR:: Algorithm.Initialize() Error: Loader.TryCreatePythonAlgorithm(): Unable to import python module ../../../Algorithm.Python/BasicTemplateAlgorithm.py. Unable to load DLL 'python27': The specified module could not be found. (Exception from HRESULT: 0x8007007E): try re-building algorithm. Stack Trace:    at QuantConnect.Lean.Engine.Setup.ConsoleSetupHandler.CreateAlgorithmInstance(AlgorithmNodePacket algorithmNodePacket, String assemblyPath) in C:\Lean\Engine\Setup\ConsoleSetupHandler.cs:line 94
   at QuantConnect.Lean.Engine.Engine.Run(AlgorithmNodePacket job, AlgorithmManager manager, String assemblyPath) in C:\Lean\Engine\Engine.cs:line 111
    at QuantConnect.Lean.Engine.Setup.ConsoleSetupHandler.CreateAlgorithmInstance(AlgorithmNodePacket algorithmNodePacket, String assemblyPath) in C:\Lean\Engine\Setup\ConsoleSetupHandler.cs:line 94
   at QuantConnect.Lean.Engine.Engine.Run(AlgorithmNodePacket job, AlgorithmManager manager, String assemblyPath) in C:\Lean\Engine\Engine.cs:line 111
20170830 23:57:42 Trace:: Debug: Your log was successfully created and can be retrieved from: C:\Lean\Launcher\bin\Debug\BasicTemplateAlgorithm-log.txt
20170830 23:57:42 Trace:: BacktestingResultHandler.Run(): Ending Thread...
20170830 23:57:42 Trace:: Waiting for threads to exit...
20170830 23:57:42 Trace:: Engine.Run(): Disposing of setup handler...
20170830 23:57:42 Trace:: Engine.Main(): Analysis Completed and Results Posted.
20170830 23:57:42 Trace:: FileSystemDataFeed.Exit(): Exit triggered.
Engine.Main(): Analysis Complete. Press any key to continue.


 

0

Please checkout the instruction at this page:

https://www.computerhope.com/issues/ch000549.htm#windows8
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