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?
Don't have an account? Join QuantConnect Today
QuantConnect Community Discussions
QUANTCONNECT COMMUNITY
LEAN is the open-source algorithmic trading engine powering QuantConnect. Founded in 2012 LEAN has been built by a global community of 180+ engineers and powers more than 300+ hedge funds today.
Join QuantConnect's Discord server for real-time support, where a vibrant community of traders and developers awaits to help you with any of your QuantConnect needs.
The Open-Quant League is a quarterly competition between universities and investment clubs for the best-performing strategy. The previous quarter's code is open-sourced, and competitors must adapt to survive.
Add entry to system path variable for Python27 to fix import error in QuantConnect.
Continue ReadingRefer to our Research Guidelines for high quality research posts.
Create an account on QuantConnect for the latest community delivered to your inbox.
Sign Up Today
|
|
|||||||
|
|
||||||||
|
How do I add an entry to the system path variable (C:\Python27)
Lucas | August 2017
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?
QuantConnectâ„¢ 2025. All Rights Reserved
Lucas
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.
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 Catarino
Please checkout the instruction at this page:
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.
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!