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 'selfImports'
at <module>
from selfImports import *
in main.py: line 0
No module named 'selfImports' 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 'selfImports'
at <module>
from selfImports import *
in main.py: line 0
No module named 'selfImports'
Mia Alissi
It seems like you're trying to import a module named 'selfImports' in your algorithm, but Python can't find it. This could be due to a few reasons:
The module 'selfImports' does not exist in your project. Make sure that you have a Python file named 'selfImports.py' in your project directory.
The module 'selfImports' is not in the same directory as your main Python file. If 'selfImports.py' is in a different directory, you need to specify the correct path when importing it.
There might be an issue with the naming. Python module names should follow certain conventions. They should be all lowercase and can include underscores.
If 'selfImports' is a custom module that contains your imports, you might want to consider using the standard import statement provided by QuantConnect. According to the discussions in the QuantConnect forum, you should add the following line at the top of your algorithm:
This line imports all the necessary modules for your algorithm. If you need additional modules, you can import them separately.
Please check your code and make sure that the 'selfImports' module exists and is in the correct location. If the problem persists, you might want to consider asking for help in the QuantConnect forum.
Sources:
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.
Saurav Singh
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!