Can you use the same directory for your project/workspace for the lean CLI and for the local platform?
I'm getting this error when trying to open the directory using the local platform / vs code extension: “Please select a valid algorithm project folder”
I created the directory using lean init and lean cloud pull:
Mia Alissi
To use the same directory for your project/workspace with both the Lean CLI and the local platform, ensure that the directory is properly initialized and linked. When you create a directory using
lean init
andlean cloud pull
, it should be recognized by both systems. If you're encountering the error "Please select a valid algorithm project folder," it might be due to the directory not being correctly set up as a Lean CLI root folder.Here are some steps to troubleshoot and resolve the issue:
Ensure Proper Initialization: Run
lean init
in the directory to initialize it as a Lean CLI root folder. This setup is necessary for the directory to be recognized by both the CLI and the local platform.Check Directory Structure: Verify that the directory structure matches what the local platform expects. The presence of necessary configuration files, like
lean.json
, is crucial.Re-link the Directory: If the directory was previously linked to a different project or setup, you might need to unlink and re-link it. This can be done by ensuring the directory is clean and re-running
lean init
.Verify Project Configuration: Ensure that the project configuration files are correctly set up and that there are no conflicts between local and cloud configurations.
Consult Documentation: Refer to the QuantConnect documentation for any specific requirements or updates regarding directory setup and project linking.
By following these steps, you should be able to resolve the issue and use the same directory for both the Lean CLI and the local platform.
Sources: Cloud Synchronization, Getting Started with Lean CLI, Lean Cloud Pull API Reference
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.
Kevin Wheeler
@Mia Sadly, I did run lean init in an empty directory before running lean cloud pull. I don't know how to check if my configuration is correct. I will note that I get an error that my data/config.json file is corrupted when I do lean cloud pull. I also get:"Restored successfullyError: 'NoneType' object has no attribute 'parent'"After I do lean cloud pull. Also, I have created new diretories from scratch before doing lean init and lean cloud pull, I've rebooted several times, etc. It's still not working.
Mia Alissi
To address the issues you're experiencing, here are some steps you can take:
Check
config.json
File: Ensure that yourconfig.json
file is not corrupted. It should be properly formatted as a JSON file with all keys and values enclosed in double quotes. If the file is corrupted, you might want to replace it with a default version or correct any formatting issues.Resolve
NoneType
Error: The error'NoneType' object has no attribute 'parent'
suggests that a variable expected to be an object with aparent
attribute isNone
. This could be due to missing or incorrectly set paths in your configuration. Double-check the paths in yourconfig.json
and ensure they point to valid directories or files.Verify Lean CLI Configuration: Make sure your Lean CLI is properly configured. You can do this by running
lean init
again in a new directory and ensuring that all necessary files are created correctly. Also, ensure that yourlean.json
file is correctly set up and located in the appropriate directory.Update Lean CLI: Ensure that you are using the latest version of the Lean CLI. You can update it by running
pip install --upgrade lean
.Check for Missing Files: Ensure that all necessary files, such as
configuration.json
, exist in the specified paths. If any files are missing, you may need to recreate them or restore them from a backup.Contact Support: If the issue persists, consider reaching out to QuantConnect support for further assistance. They may be able to provide more specific guidance based on your setup and the errors you're encountering.
Sources: Cloud Synchronization, Getting Started with Lean CLI, Lean Cloud Pull API Reference
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.
Kevin Wheeler
The local platform syncs your files with the cloud, so if you edit your files locally but outside of the local platform while having the local platform open, the local platform can delete your changes.
Kevin Wheeler
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!