(base) C:\Users\63036>lean
pywin32 has not been installed completely, which may lead to errors
You can fix this issue by running pywin32's post-install script
Run the following command in an elevated terminal from your Python environment's Scripts directory:
python pywin32_postinstall.py -install
Usage: lean [OPTIONS] COMMAND [ARGS]...
Jasper van Merle
Hi Yi,
The CLI depends on Docker's Python SDK, which in turn depends on pywin32 for Windows users. pywin32 installation requires running a post-install script, which the CLI attempts to do automatically. However, if the CLI cannot find and/or run pywin32's post-install script automatically, it prints the given warning and asks you to run it manually.
As shown in the warning message, you can do so by opening an elevated terminal (Win + X > Windows PowerShell (Admin)), navigating to the directory containing pywin32's post-install script and running `python pywin32_postinstall.py -install`.
Usually you can find pywin32_postinstall.py in the “Scripts” subdirectory of your Python environment. Assuming you use conda as environment manager, that path looks like `<conda install path>/envs/<environment name>/Scripts` (or `<conda install path>/Scripts` for conda's base environment).
Yi ren
I have run the python pywin32_postinstall.py -install, but still have this error
Jasper van Merle
Hi Yi,
That's weird. If you just ran the post-install script, can you try restarting your computer? If that doesn't fix it, please share the path to the pywin32_postinstall.py file you ran and the output of running the command again.
Yi ren
When i reinstall lean cli i got this error.
Yi ren
Then got this
Yi ren
And finally run this command
got this
But I still got this problem
This is my env path
Jasper van Merle
Hi Yi,
Can you please try running a backtest with `lean backtest <project name> --verbose` (note the verbose flag) to see if that works correctly (and if not, what the full error is)? If that works correctly then the CLI's “is pywin32 installed”-check is broken, if it doesn't work then the pywin32 installation is probably still broken in some way.
Garrett Grow
I am encountering the same error as originally stated above. I tried to follow the instructions: Run the following command in an elevated terminal from your Python environment's Scripts directory:
python pywin32_postinstall.py -install.
I received the following error: ImportError: DLL load failed while importing win32api: The specified procedure could not be found.
Garrett Grow
Got it working by running the post-install script in Admin mode.
Yi ren
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!