HI,
I am having some trouble getting Lean to run correctly on Mac using Python. The C# version works correctly and runs without issue. However when I follow the instructions to use python in the Algorithm.Python project get the following error when running Lean (command line or direct in VS):
ERROR:: Loader.TryCreatePythonAlgorithm(): System.DllNotFoundException: python3.6m
running which python3.6m returns /Users/<currentuser>/anaconda3/bin/python3.6m
Does anyone have an idea how to fix this problem?
Many thanks
Scott
Jakob P.
Have the same problem, has anyone a solution?
macOS High Sierra 10.13.6
conda 4.6.4 with Python 3.6.6
Â
Â
Alexandre Catarino
Hi ScottB and Jakob,
Are you running the latest Lean? About one month ago, we have added a patch that should handle issues with macOS running Python algorithms in Lean. I have tried and could install a clean version of Lean without a problem.
Is it the only python installation in your PC?
Â
Jakob P.
Hi Alexandre,
- I did a clean install of MacOs
- installed VS for Mac
- installed R from readme link
- installed Anaconda from readme link
- installed via conda Python==3.6.6, Pandas and Dependencies
when I open the project the Nuget Packages are restored. When building and running Lean in CSharp it works and displays all the sample output. If i select Python i get the same error ScottB posted.  ÂAlexandre Catarino
Hi Jakob P., sorry for the wait.
Could you please contact me in quantconnect/slack?
Perhaps it is an edge case and we will need to collect more information to improve the guide.
Best regards,
Alex
Â
Makoto Watanabe
Hi,
I'm suffering from the same error.
Could you kindly let me know how to resolve this issue?
Link Liang
Hi Makoto,
We are sorry to hear that. Could you please provide more information about the version of your MacOS, visual studio, python and Lean? Have you installed more than one version of python? We need your help to improve our service!
Andrew Schwartz
Hello,
I'm experiencing this issue trying to get pythn setup. C# works fine.
I'm installing python with pyenv (3.6.8) and then install anaconda. Anaconda seems to install 3.8 - as a solution I'm creating an environment with python 3.6.8 named Lean. The path would be as follows: {/Users/Username/opt/anaconda3/envs/Lean/lib/libpython3.6m.dylib}. After creating the environment I'm activating it in the terminal and running `pip install pandas`. Then I'm adding this line to the Python.Runtime.dll.config file:
  <dllmap dll="python3.6m" target="{/Users/andrew/opt/anaconda3/envs/Lean/lib/libpython3.6m.dylib}" os="!windows"/>
Still getting the following error:
Loader.TryCreatePythonAlgorithm(): System.DllNotFoundException: {/Users/andrew/opt/anaconda3/envs/Lean/lib/libpython3.6m.dylib} assembly:<unknown assembly> type:<unknown type> member:(null)
Thanks,
Andrew
Andrew Schwartz
Oops! Silly mistake - Removed the brackets from the file path in Python.Runtime.dll.config. Works!
ScottB
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!