Back

Cannot build the Lean Solution on Visual Studio Community 2017 - The type or namespace name 'Python' and "PyObject" could not be found

Expected Behavior

I cannot build the Lean Solution on Visual Studio Community 2017

Actual Behavior

When building I have the following errors (123 of them) composed of :

  • CS0246 The type or namespace name 'PyObject' could not be found (are you missing a using directive or an assembly reference?
  • CS0246 The type or namespace name 'Python' could not be found (are you missing a using directive or an assembly reference?Algorithm
  • CS0006 Metadata file 'C:\Users\adrie\Lean\FILEPATH\NAME_OF_FILE(.dll or .exe)' could not be found

Potential Solution

Cannot find one

System Information

Windows 10;
Visual Studio Community 2017;
ASP.NET 3.5 and 4.7 activated in windows feature;
I followed the LEAN installation procedure and ran all the steps at

https://github.com/QuantConnect/Lean/tree/master/Algorithm.Python#quantconnect-python-algorithm-project
Update Backtest







Hi Adrien LQ , sorry about the incovenience. We have a pending pull request that will solve this issue.
Meanwhile, please move the the file:
Lean\packages\QuantConnect.pythonnet.1.0.5.8\build\Python.Runtime.win to
Lean\packages\QuantConnect.pythonnet.1.0.5.8\lib\Python.Runtime.dll
and rebuild the solution.

0

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.


Hello Alexandre.
Thx for the answer.
Yeepaaa !! It works.
I know it would have been something silly like this. It used to appear on the github info page before but i don't know why it was removed.
Thx anyway

0

Hello, I have followed the steps provided in setting up LEAN locally and came across same issue listed above.

I have applied the suggested solution and I am still getting the namespace errors. Can you provide any suggestions?

Examples:

Severity    Code    Description    Project    File    Line    Suppression State
Error    CS0006    Metadata file 'C:\Users\QuantumLogic\Source\Repos\QuantConnect\Lean\Common\bin\Debug\QuantConnect.Common.dll' could not be found    QuantConnect.Api    C:\Users\QuantumLogic\Source\Repos\QuantConnect\Lean\Api\CSC    1    Active

Severity    Code    Description    Project    File    Line    Suppression State
Error    CS0006    Metadata file 'C:\Users\QuantumLogic\Source\Repos\QuantConnect\Lean\Indicators\bin\Debug\QuantConnect.Indicators.dll' could not be found    QuantConnect.Algorithm.CSharp    C:\Users\QuantumLogic\Source\Repos\QuantConnect\Lean\Algorithm.CSharp\CSC    1    Active

Severity    Code    Description    Project    File    Line    Suppression State
Error    CS0246    The type or namespace name 'Python' could not be found (are you missing a using directive or an assembly reference?)    QuantConnect    C:\Users\QuantumLogic\Source\Repos\QuantConnect\Lean\Common\Exceptions\KeyErrorPythonExceptionInterpreter.cs    18    Active

0

just to add on to this: 

The target framework is .NET 4.5.2 instead of .NET 3.5 for all of the solution. Is it mandatory to use .NET 3.5?

0

Hi QuantumLogic, have you tried this procedure?

Meanwhile, please move the the file:
Lean\packages\QuantConnect.pythonnet.1.0.5.8\build\Python.Runtime.win to
Lean\packages\QuantConnect.pythonnet.1.0.5.8\lib\Python.Runtime.dll
and rebuild the solution.

0

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.


Hi Alexandre,

I did try the suggested solution at that time and I was still coming across the same issue.

I have already converted my python algos to C#.

But, if you would like me to reproduce the issue or need anything, then please do let me know.

Kind Regards

0

Here is the link to the thread with another community member solution: Running local python algorithm error #4252.

0

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.


Thank you for providing the solution.

0

Update Backtest





0

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.


Loading...

This discussion is closed