I run
lean init
in PowerShell and I can see
-------------
lean : The term 'lean' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included,
verify that the path is correct and try again.
At line:1 char:1
+ lean init
+ ~~~~
+ CategoryInfo : ObjectNotFound: (lean:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
------------------
The installation of the Docker and the lean
pip install lean
was successful.
Notwithstanding the installation was successful,
there is no lean command in Windows.
The question is:
Why the Windows does not familiar with the “lean” command?
Fred Painchaud
Hi Bolt,
“lean” is not a PowerShell command. Is it a Python “executable script”. It sits under your installation directory, in “Scripts”.
So depending on how Python is installed, and which environment variables are set and to what, files in the “Scripts” folder are in the path or not. If they are not, “lean” will not be recognized, unless you type the full path, i.e., <your Python installation directory>/Scripts/lean.exe.
Fred
Fred Painchaud
Oh, and in case you don't know your installation directory, execute that python script:
Add “\Scripts" to the returned path. (Backslashes will be escaped in the returned path, of course.)
Fred
Bolt.Investments
Hm... I can find the python package which is named "lean" by the command
The package is in
c:\users\dbolt\appdata\roaming\python\python37\site-packages\
Python knows the package “lean”.
But according to the installation instruction, I must run the command
from the terminal (in Windows a terminal = the PowerShell)
But. There is no file named "lean" in the file system.
So the question is:
How can I run the command
in Windows?
Fred Painchaud
Hi Bolt,
When your python installation is in the path, and once lean has been installed, you normally just type “lean init” in a command prompt, inside a folder which you want to be a lean project. Just like “git” if you are familiar with it.
This is a screenshot from a Windows VM for which Python is not in the path. So “lean init” does not work - it cannot be found. Like I wrote, lean.exe is in the Scripts folder in the Python env into which lean was installed. If you have just one Python env, then it is in your Python installation folder. So once you enter the full path to lean.exe, “lean init” works. The Python module lean that you find and the LEAN CLI are two different things.
Fred
P.S. If Python is put into the path (including <>\Scripts), then “lean init” will work since lean.exe will be found.
James Lin
I had to uninstall and reinstall lean to get this to work, it might have failed to add lean.exe the first time due to permission issues.
Bolt.Investments
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!