Algorithm.Initialize() Error: During the algorithm initialization, the following exception has occurred: Loader.TryCreatePythonAlgorithm(): Unable to import python module ./cache/algorithm/project/main.pyc. AlgorithmPythonWrapper(): No module named 'QuantConnect.Data.Custom.CBOE' at from QuantConnect.Data.Custom.CBOE import * at Python.Runtime.PythonException.ThrowLastAsClrException() at Python.Runtime.NewReferenceExtensions.BorrowOrThrow(NewReference& reference) at Python.Runtime.PyModule.Import(String name) at Python.Runtime.Py.Import(String name) at QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper..ctor(String moduleName) at AlgorithmFactory/Python/Wrappers/AlgorithmPythonWrapper.cs:line 76 in main.py: line 5 No module named 'QuantConnect.Data.Custom.CBOE' Stack Trace: During the algorithm initialization, the following exception has occurred: Loader.TryCreatePythonAlgorithm(): Unable to import python module ./cache/algorithm/project/main.pyc. AlgorithmPythonWrapper(): No module named 'QuantConnect.Data.Custom.CBOE' at from QuantConnect.Data.Custom.CBOE import * at Python.Runtime.PythonException.ThrowLastAsClrException() at Python.Runtime.NewReferenceExtensions.BorrowOrThrow(NewReference& reference) at Python.Runtime.PyModule.Import(String name) at Python.Runtime.Py.Import(String name) at QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper..ctor(String moduleName) at AlgorithmFactory/Python/Wrappers/AlgorithmPythonWrapper.cs:line 76 in main.py: line 5 No module named 'QuantConnect.Data.Custom.CBOE'
Mia Alissi
The error message you're seeing is due to a recent change in how QuantConnect handles alternative data types. As per the forum discussion, the
QuantConnect.Data.Custom.CBOE
module has been moved to theQuantConnect.DataSource
namespace.To fix the error, you need to update your import statement in your Python code. Instead of:
You should now use:
Also, make sure to remove any old import statements containing "QuantConnect.Data.Custom" from your code.
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.
ANDREW HSING
Thanks for that.
However, I still got the same error.
Algorithm.Initialize() Error: During the algorithm initialization, the following exception has occurred: Loader.TryCreatePythonAlgorithm(): Unable to import python module ./cache/algorithm/project/main.pyc. AlgorithmPythonWrapper(): No module named 'QuantConnect.DataSource.CBOE' at from QuantConnect.DataSource.CBOE import * at Python.Runtime.PythonException.ThrowLastAsClrException() at Python.Runtime.NewReferenceExtensions.BorrowOrThrow(NewReference& reference) at Python.Runtime.PyModule.Import(String name) at Python.Runtime.Py.Import(String name) at QuantConnect.AlgorithmFactory.Python.Wrappers.AlgorithmPythonWrapper..ctor(String moduleName) at AlgorithmFactory/Python/Wrappers/AlgorithmPythonWrapper.cs:line 76 in main.py: line 3 No module named 'QuantConnect.DataSource.CBOE' Stack Trace: During the algorithm initialization, the following exception has occurred: Loader.TryCreatePythonAlgorithm(): Unable to import python module ./cache/algorithm/project/main.pyc. AlgorithmPythonWrapper(): No module named 'QuantConnect.DataSource.CBOE' at
Mia Alissi
It seems like you've updated your import statement as suggested, but you're still encountering the same error. This is unusual as the error message indicates that the module 'QuantConnect.DataSource.CBOE' could not be found, which should have been resolved by the updated import statement.
Please double-check your code to ensure that there are no typos or other issues that might be causing this problem. If the issue persists, it might be helpful to revisit the forum discussion for any additional insights or to post a new question detailing the issue you're facing.
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.
John Thiry
Disclosure: newbie here. However, I was able to resolve this issue by eliminating the CBOE import statement altogether as suggested in this post. After I commented out this line, the algo built and ran fine.
#from QuantConnect.DataSource.CBOE import *
ANDREW HSING
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!