Hello all,
I am setting up LEAN locally on my Win10 PC, plan to wirte backtest using Python.
I follow instruction on LEAN readme.md, clone LEAN and have C# algorithm built & run with using VS2017 no problem.
Then I follow the Python setup instruction install Python 3.6, Anaconda 5.2, pandas.
Then when I try to run "python setup.py" script, I got error.
it seems attempt to build pythonnet failed.
Could you help to look into this and help me solve the problem?
Log after running "python setup.py" script.
(python364) c:\Users\chrisho\Documents\Visual Studio 2017\Projects\FSremote\TrackFrameworkAsMasterBranch\Lean20180808>python setup.py
Python support in Lean with pythonnet
=====================================
Prerequisites:
- Python 3.6 x64 with pip
- LEAN: https://github.com/QuantConnect/Lean#installation-instructions
- Visual C++ for Python: https://www.microsoft.com/en-us/download/details.aspx?id=44266
- git
It will update conda, pip, wheel, setuptools, pandas packages.
Install/updates required packages
---------------------------------
[conda] Successfully installed/updated: wheel, conda, setuptools, pandas, pip
Install/updates pythonnet
-------------------------
Failed building wheel for pythonnet
Command "C:\Users\chrisho\Anaconda3\envs\python364\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\chrisho\\AppData\\Local\\Temp\\pip-req-build-04d9zj9z\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\chrisho\AppData\Local\Temp\pip-record-l0f00dt1\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\chrisho\AppData\Local\Temp\pip-req-build-04d9zj9z\
Collecting git+https://github.com/QuantConnect/pythonnet
Cloning https://github.com/QuantConnect/pythonnet to c:\\users\\chrisho\\appdata\\local\\temp\\pip-req-build-04d9zj9z
Building wheels for collected packages: pythonnet
Running setup.py bdist_wheel for pythonnet: started
Running setup.py bdist_wheel for pythonnet: finished with status 'error'
Complete output from command C:\\Users\\chrisho\\Anaconda3\\envs\\python364\\python.exe -u -c "import setuptools, tokenize;__file__=\'C:\\\\Users\\\\chrisho\\\\AppData\\\\Local\\\\Temp\\\\pip-req-build-04d9zj9z\\\\setup.py\';f=getattr(tokenize, \'open\', open)(__file__);code=f.read().replace(\'\\r\\n\', \'\\n\');f.close();exec(compile(code, __file__, \'exec\'))" bdist_wheel -d C:\\Users\\chrisho\\AppData\\Local\\Temp\\pip-wheel-ofuxc7qe --python-tag cp36:
running bdist_wheel
running build
running build_ext
Checking for updates from https://www.nuget.org/api/v2/.
Currently running NuGet.exe 4.1.0.
Updating NuGet.exe to 4.6.2.
Update successful.
MSBuild auto-detection: using msbuild version '15.7.180.61344' from 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\MSBuild\\15.0\\bin'.
Restoring NuGet package NUnit.3.7.1.
Restoring NuGet package UnmanagedExports.1.2.7.
Restoring NuGet package NUnit.ConsoleRunner.3.7.0.
Adding package 'NUnit.ConsoleRunner.3.7.0' to folder 'C:\\Users\\chrisho\\AppData\\Local\\Temp\\pip-req-build-04d9zj9z\\packages'
Adding package 'NUnit.3.7.1' to folder 'C:\\Users\\chrisho\\AppData\\Local\\Temp\\pip-req-build-04d9zj9z\\packages'
Adding package 'UnmanagedExports.1.2.7' to folder 'C:\\Users\\chrisho\\AppData\\Local\\Temp\\pip-req-build-04d9zj9z\\packages'
Added package 'UnmanagedExports.1.2.7' to folder 'C:\\Users\\chrisho\\AppData\\Local\\Temp\\pip-req-build-04d9zj9z\\packages'
Added package 'NUnit.3.7.1' to folder 'C:\\Users\\chrisho\\AppData\\Local\\Temp\\pip-req-build-04d9zj9z\\packages'
Added package 'NUnit.ConsoleRunner.3.7.0' to folder 'C:\\Users\\chrisho\\AppData\\Local\\Temp\\pip-req-build-04d9zj9z\\packages'
NuGet Config files used:
C:\\Users\\chrisho\\AppData\\Local\\Temp\\pip-req-build-04d9zj9z\\NuGet.Config
C:\\Users\\chrisho\\AppData\\Roaming\\NuGet\\NuGet.Config
C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config
Feeds used:
C:\\Users\\chrisho\\.nuget\\packages\\
https://dotnet.myget.org/F/dotnet-core/api/v3/index.json
https://api.nuget.org/v3/index.json
C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\
Installed:
3 package(s) to packages.config projects
Microsoft (R) Manifest Tool
Copyright (c) Microsoft Corporation.
All rights reserved.
Microsoft (R) Build Engine version 15.7.180.61344 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.
Microsoft (R) Build Engine version 15.7.180.61344 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.
pythonexception.cs(67,13): warning CS0162: Unreachable code detected [C:\\Users\\chrisho\\AppData\\Local\\Temp\\pip-req-build-04d9zj9z\\src\\runtime\\Python.Runtime.csproj]
pyscope.cs(534,13): warning CS0162: Unreachable code detected [C:\\Users\\chrisho\\AppData\\Local\\Temp\\pip-req-build-04d9zj9z\\src\\runtime\\Python.Runtime.csproj]
pyobject.cs(51,13): warning CS0162: Unreachable code detected [C:\\Users\\chrisho\\AppData\\Local\\Temp\\pip-req-build-04d9zj9z\\src\\runtime\\Python.Runtime.csproj]
delegatemanager.cs(204,13): warning CS0162: Unreachable code detected [C:\\Users\\chrisho\\AppData\\Local\\Temp\\pip-req-build-04d9zj9z\\src\\runtime\\Python.Runtime.csproj]
Python.Runtime -> C:\\Users\\chrisho\\AppData\\Local\\Temp\\pip-req-build-04d9zj9z\\src\\runtime\\bin\\Python.Runtime.dll
Python.Test -> C:\\Users\\chrisho\\AppData\\Local\\Temp\\pip-req-build-04d9zj9z\\src\\testing\\bin\\Python.Test.dll
dynamic.cs(121,28): warning CS0618: 'PythonEngine.RunString(string, IntPtr?, IntPtr?)' is obsolete: 'RunString is deprecated and will be removed. Use Exec/Eval/RunSimpleString instead.' [C:\\Users\\chrisho\\AppData\\Local\\Temp\\pip-req-build-04d9zj9z\\src\\embed_tests\\Python.EmbeddingTest.csproj]
Python.EmbeddingTest -> C:\\Users\\chrisho\\AppData\\Local\\Temp\\pip-req-build-04d9zj9z\\src\\embed_tests\\bin\\Python.EmbeddingTest.dll
Console -> C:\\Users\\chrisho\\AppData\\Local\\Temp\\pip-req-build-04d9zj9z\\src\\console\\bin\\nPython.exe
clrmodule -> C:\\Users\\chrisho\\AppData\\Local\\Temp\\pip-req-build-04d9zj9z\\src\\clrmodule\\bin\\clrmodule.dll
C:\\Users\\chrisho\\AppData\\Local\\Temp\\pip-req-build-04d9zj9z\\packages\\UnmanagedExports.1.2.7\\tools\\RGiesecke.DllExport.targets(58,3): error MSB4062: The "RGiesecke.DllExport.MSBuild.DllExportAppDomainIsolatedTask" task could not be loaded from the assembly C:\\Users\\chrisho\\AppData\\Local\\Temp\\pip-req-build-04d9zj9z\\packages\\UnmanagedExports.1.2.7\\tools\\RGiesecke.DllExport.MSBuild.dll. Could not load file or assembly \'Microsoft.Build.Utilities, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\' or one of its dependencies. The system cannot find the file specified. Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask. [C:\\Users\\chrisho\\AppData\\Local\\Temp\\pip-req-build-04d9zj9z\\src\\clrmodule\\clrmodule.csproj]
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\\Users\\chrisho\\AppData\\Local\\Temp\\pip-req-build-04d9zj9z\\setup.py", line 527, in <module>
zip_safe=False,
File "C:\\Users\\chrisho\\Anaconda3\\envs\\python364\\lib\\site-packages\\setuptools\\__init__.py", line 129, in setup
return distutils.core.setup(**attrs)
File "C:\\Users\\chrisho\\Anaconda3\\envs\\python364\\lib\\distutils\\core.py", line 148, in setup
dist.run_commands()
File "C:\\Users\\chrisho\\Anaconda3\\envs\\python364\\lib\\distutils\\dist.py", line 955, in run_commands
self.run_command(cmd)
File "C:\\Users\\chrisho\\Anaconda3\\envs\\python364\\lib\\distutils\\dist.py", line 974, in run_command
cmd_obj.run()
File "C:\\Users\\chrisho\\AppData\\Local\\Temp\\pip-req-build-04d9zj9z\\setup.py", line 475, in run
return bdist_wheel.bdist_wheel.run(self)
File "C:\\Users\\chrisho\\Anaconda3\\envs\\python364\\lib\\site-packages\\wheel\\bdist_wheel.py", line 202, in run
self.run_command('build')
File "C:\\Users\\chrisho\\Anaconda3\\envs\\python364\\lib\\distutils\\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "C:\\Users\\chrisho\\Anaconda3\\envs\\python364\\lib\\distutils\\dist.py", line 974, in run_command
cmd_obj.run()
File "C:\\Users\\chrisho\\Anaconda3\\envs\\python364\\lib\\distutils\\command\\build.py", line 135, in run
self.run_command(cmd_name)
File "C:\\Users\\chrisho\\Anaconda3\\envs\\python364\\lib\\distutils\\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "C:\\Users\\chrisho\\Anaconda3\\envs\\python364\\lib\\distutils\\dist.py", line 974, in run_command
cmd_obj.run()
File "C:\\Users\\chrisho\\Anaconda3\\envs\\python364\\lib\\distutils\\command\\build_ext.py", line 339, in run
self.build_extensions()
File "C:\\Users\\chrisho\\Anaconda3\\envs\\python364\\lib\\distutils\\command\\build_ext.py", line 448, in build_extensions
self._build_extensions_serial()
File "C:\\Users\\chrisho\\Anaconda3\\envs\\python364\\lib\\distutils\\command\\build_ext.py", line 473, in _build_extensions_serial
self.build_extension(ext)
File "C:\\Users\\chrisho\\AppData\\Local\\Temp\\pip-req-build-04d9zj9z\\setup.py", line 265, in build_extension
subprocess.check_call(" ".join(cmd + ["/t:Build"]), shell=use_shell)
File "C:\\Users\\chrisho\\Anaconda3\\envs\\python364\\lib\\subprocess.py", line 291, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command \'"C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\MSBuild\\15.0\\Bin\\MSBuild.exe" pythonnet.sln /p:Configuration=ReleaseWin /p:Platform=x64 /p:DefineConstants="PYTHON36%3BPYTHON3%3BUCS2" /p:PythonBuildDir="C:\\Users\\chrisho\\AppData\\Local\\Temp\\pip-req-build-04d9zj9z\\build\\lib.win-amd64-3.6" /p:PythonInteropFile="interop36.cs" /verbosity:minimal /p:PythonManifest="C:\\Users\\chrisho\\AppData\\Local\\Temp\\pip-req-build-04d9zj9z\\build\\lib.win-amd64-3.6\\app.manifest" /t:Build\' returned non-zero exit status 1.
----------------------------------------
Running setup.py clean for pythonnet
Failed to build pythonnet
Installing collected packages: pythonnet
Running setup.py install for pythonnet: started
Running setup.py install for pythonnet: finished with status 'error'
Complete output from command C:\\Users\\chrisho\\Anaconda3\\envs\\python364\\python.exe -u -c "import setuptools, tokenize;__file__=\'C:\\\\Users\\\\chrisho\\\\AppData\\\\Local\\\\Temp\\\\pip-req-build-04d9zj9z\\\\setup.py\';f=getattr(tokenize, \'open\', open)(__file__);code=f.read().replace(\'\\r\\n\', \'\\n\');f.close();exec(compile(code, __file__, \'exec\'))" install --record C:\\Users\\chrisho\\AppData\\Local\\Temp\\pip-record-l0f00dt1\\install-record.txt --single-version-externally-managed --compile:
usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
or: -c --help [cmd1 cmd2 ...]
or: -c --help-commands
or: -c cmd --help
error: option --single-version-externally-managed not recognized
----------------------------------------
I also browsed other thread on the community forum and try to clone and install pythonnet directly from github
it also failed
Log after trying to install pythonnet directly from github.
(python364) c:\Users\chrisho\Documents\Visual Studio 2017\Projects\FSremote\TrackFrameworkAsMasterBranch\Lean20180808>pip install -U git+https://github.com/QuantConnect/pythonnet
Collecting git+https://github.com/QuantConnect/pythonnet
Cloning https://github.com/QuantConnect/pythonnet to c:\users\chrisho\appdata\local\temp\pip-req-build-37j21g3h
Building wheels for collected packages: pythonnet
Running setup.py bdist_wheel for pythonnet ... error
Complete output from command c:\users\chrisho\anaconda3\envs\python364\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\chrisho\\AppData\\Local\\Temp\\pip-req-build-37j21g3h\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d C:\Users\chrisho\AppData\Local\Temp\pip-wheel-sqb4uwd7 --python-tag cp36:
running bdist_wheel
running build
running build_ext
Checking for updates from https://www.nuget.org/api/v2/.
Currently running NuGet.exe 4.1.0.
Updating NuGet.exe to 4.6.2.
Update successful.
MSBuild auto-detection: using msbuild version '15.7.180.61344' from 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\bin'.
Restoring NuGet package NUnit.3.7.1.
Restoring NuGet package NUnit.ConsoleRunner.3.7.0.
Restoring NuGet package UnmanagedExports.1.2.7.
Adding package 'NUnit.3.7.1' to folder 'C:\Users\chrisho\AppData\Local\Temp\pip-req-build-37j21g3h\packages'
Adding package 'NUnit.ConsoleRunner.3.7.0' to folder 'C:\Users\chrisho\AppData\Local\Temp\pip-req-build-37j21g3h\packages'
Adding package 'UnmanagedExports.1.2.7' to folder 'C:\Users\chrisho\AppData\Local\Temp\pip-req-build-37j21g3h\packages'
Added package 'UnmanagedExports.1.2.7' to folder 'C:\Users\chrisho\AppData\Local\Temp\pip-req-build-37j21g3h\packages'
Added package 'NUnit.ConsoleRunner.3.7.0' to folder 'C:\Users\chrisho\AppData\Local\Temp\pip-req-build-37j21g3h\packages'
Added package 'NUnit.3.7.1' to folder 'C:\Users\chrisho\AppData\Local\Temp\pip-req-build-37j21g3h\packages'
NuGet Config files used:
C:\Users\chrisho\AppData\Local\Temp\pip-req-build-37j21g3h\NuGet.Config
C:\Users\chrisho\AppData\Roaming\NuGet\NuGet.Config
C:\Program Files (x86)\NuGet\Config\Microsoft.VisualStudio.Offline.config
Feeds used:
C:\Users\chrisho\.nuget\packages\
https://dotnet.myget.org/F/dotnet-core/api/v3/index.json
https://api.nuget.org/v3/index.json
C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\
Installed:
3 package(s) to packages.config projects
Microsoft (R) Manifest Tool
Copyright (c) Microsoft Corporation.
All rights reserved.
Microsoft (R) Build Engine version 15.7.180.61344 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.
Microsoft (R) Build Engine version 15.7.180.61344 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.
delegatemanager.cs(204,13): warning CS0162: Unreachable code detected [C:\Users\chrisho\AppData\Local\Temp\pip-req-build-37j21g3h\src\runtime\Python.Runtime.csproj]
pythonexception.cs(67,13): warning CS0162: Unreachable code detected [C:\Users\chrisho\AppData\Local\Temp\pip-req-build-37j21g3h\src\runtime\Python.Runtime.csproj]
pyobject.cs(51,13): warning CS0162: Unreachable code detected [C:\Users\chrisho\AppData\Local\Temp\pip-req-build-37j21g3h\src\runtime\Python.Runtime.csproj]
pyscope.cs(534,13): warning CS0162: Unreachable code detected [C:\Users\chrisho\AppData\Local\Temp\pip-req-build-37j21g3h\src\runtime\Python.Runtime.csproj]
Python.Runtime -> C:\Users\chrisho\AppData\Local\Temp\pip-req-build-37j21g3h\src\runtime\bin\Python.Runtime.dll
Python.Test -> C:\Users\chrisho\AppData\Local\Temp\pip-req-build-37j21g3h\src\testing\bin\Python.Test.dll
dynamic.cs(121,28): warning CS0618: 'PythonEngine.RunString(string, IntPtr?, IntPtr?)' is obsolete: 'RunString is deprecated and will be removed. Use Exec/Eval/RunSimpleString instead.' [C:\Users\chrisho\AppData\Local\Temp\pip-req-build-37j21g3h\src\embed_tests\Python.EmbeddingTest.csproj]
Python.EmbeddingTest -> C:\Users\chrisho\AppData\Local\Temp\pip-req-build-37j21g3h\src\embed_tests\bin\Python.EmbeddingTest.dll
Console -> C:\Users\chrisho\AppData\Local\Temp\pip-req-build-37j21g3h\src\console\bin\nPython.exe
clrmodule -> C:\Users\chrisho\AppData\Local\Temp\pip-req-build-37j21g3h\src\clrmodule\bin\clrmodule.dll
C:\Users\chrisho\AppData\Local\Temp\pip-req-build-37j21g3h\packages\UnmanagedExports.1.2.7\tools\RGiesecke.DllExport.targets(58,3): error MSB4062: The "RGiesecke.DllExport.MSBuild.DllExportAppDomainIsolatedTask" task could not be loaded from the assembly C:\Users\chrisho\AppData\Local\Temp\pip-req-build-37j21g3h\packages\UnmanagedExports.1.2.7\tools\RGiesecke.DllExport.MSBuild.dll. Could not load file or assembly 'Microsoft.Build.Utilities, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask. [C:\Users\chrisho\AppData\Local\Temp\pip-req-build-37j21g3h\src\clrmodule\clrmodule.csproj]
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\chrisho\AppData\Local\Temp\pip-req-build-37j21g3h\setup.py", line 527, in <module>
zip_safe=False,
File "c:\users\chrisho\anaconda3\envs\python364\lib\site-packages\setuptools\__init__.py", line 129, in setup
return distutils.core.setup(**attrs)
File "c:\users\chrisho\anaconda3\envs\python364\lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "c:\users\chrisho\anaconda3\envs\python364\lib\distutils\dist.py", line 955, in run_commands
self.run_command(cmd)
File "c:\users\chrisho\anaconda3\envs\python364\lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "C:\Users\chrisho\AppData\Local\Temp\pip-req-build-37j21g3h\setup.py", line 475, in run
return bdist_wheel.bdist_wheel.run(self)
File "c:\users\chrisho\anaconda3\envs\python364\lib\site-packages\wheel\bdist_wheel.py", line 202, in run
self.run_command('build')
File "c:\users\chrisho\anaconda3\envs\python364\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "c:\users\chrisho\anaconda3\envs\python364\lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "c:\users\chrisho\anaconda3\envs\python364\lib\distutils\command\build.py", line 135, in run
self.run_command(cmd_name)
File "c:\users\chrisho\anaconda3\envs\python364\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "c:\users\chrisho\anaconda3\envs\python364\lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "c:\users\chrisho\anaconda3\envs\python364\lib\distutils\command\build_ext.py", line 339, in run
self.build_extensions()
File "c:\users\chrisho\anaconda3\envs\python364\lib\distutils\command\build_ext.py", line 448, in build_extensions
self._build_extensions_serial()
File "c:\users\chrisho\anaconda3\envs\python364\lib\distutils\command\build_ext.py", line 473, in _build_extensions_serial
self.build_extension(ext)
File "C:\Users\chrisho\AppData\Local\Temp\pip-req-build-37j21g3h\setup.py", line 265, in build_extension
subprocess.check_call(" ".join(cmd + ["/t:Build"]), shell=use_shell)
File "c:\users\chrisho\anaconda3\envs\python364\lib\subprocess.py", line 291, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe" pythonnet.sln /p:Configuration=ReleaseWin /p:Platform=x64 /p:DefineConstants="PYTHON36%3BPYTHON3%3BUCS2" /p:PythonBuildDir="C:\Users\chrisho\AppData\Local\Temp\pip-req-build-37j21g3h\build\lib.win-amd64-3.6" /p:PythonInteropFile="interop36.cs" /verbosity:minimal /p:PythonManifest="C:\Users\chrisho\AppData\Local\Temp\pip-req-build-37j21g3h\build\lib.win-amd64-3.6\app.manifest" /t:Build' returned non-zero exit status 1.
----------------------------------------
Failed building wheel for pythonnet
Running setup.py clean for pythonnet
Failed to build pythonnet
Installing collected packages: pythonnet
Running setup.py install for pythonnet ... error
Complete output from command c:\users\chrisho\anaconda3\envs\python364\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\chrisho\\AppData\\Local\\Temp\\pip-req-build-37j21g3h\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\chrisho\AppData\Local\Temp\pip-record-70_gwk8c\install-record.txt --single-version-externally-managed --compile:
usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
or: -c --help [cmd1 cmd2 ...]
or: -c --help-commands
or: -c cmd --help
error: option --single-version-externally-managed not recognized
----------------------------------------
Command "c:\users\chrisho\anaconda3\envs\python364\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\chrisho\\AppData\\Local\\Temp\\pip-req-build-37j21g3h\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\chrisho\AppData\Local\Temp\pip-record-70_gwk8c\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\chrisho\AppData\Local\Temp\pip-req-build-37j21g3h\
Kow Gate
I am trying to answer my own question here:
After working on it for last couple of days, I think I found a way to "work around" this problem. However, I am not sure if it is technically a solution to this problem, but at least I can now keep moving on.
Therefore I want to share my findings here, In case anyone stumble on the same problem, they don't need to spend the time to sort our the reason and find the "work around"
If one take a look into the log I posted, somewhere in the middle, it says " Could not load file or assembly \'Microsoft.Build.Utilities, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\' or one of its dependencies."
I googled and found this " Where can I find Microsoft.Build.Utilities.v3.5 " in another forum. One of the answers suggests :
"navigating to Control Panel-> Programs and Features-> Turn Windows features on or off and installed .NET Framework 3.5 (includes .NET 2.0 and 3.0)"
I followed and bingo , it works.
But honestly I don't know why it works.
Anyhow, i hope it helps.
Here's some context :
I also tried plain vanilla Python 3.6.5 with virtualenv and it works well too.
Finally a remark to QuantConnect team:
the Python setup procedure for LEAN might need to review
https://github.com/QuantConnect/Lean/tree/master/Algorithm.Python#quantconnect-python-algorithm-project
In Windows setup section, it says Anaconda can be used in bullet (1).
In bullet (3), it says a system variable "PYTHONHOME" need to be set to point to python installation path. This *will* crash with part of the Anaconda installations (e.g. Anaconda prompt), and one cannot use conda as virtual environment if this variable is set.
This create some confusion and would be nice if it could be cleaned up.
For me, I do not set "PYTHONHOME" but I am not sure if this system variable is needed in other part of LEAN engine. I am not sure about that at this moment.
Hope this help
Kow
Alexandre Catarino
Hi Kow Gate , thank you for looking into it. I was starting to.
When I installed Anaconda, I needed to add "PYTHONHOME", but if you can run a python algorithm in Lean without it, great.
Vincent Tan
hi alexandre i have also tried in vain to clear the python error unresolved clr..
i followed the steps exactly, both c# and python are able to built.. but running the .py files.. you cannot add reference to quantconnect assemblies.. pythonnet in lean seems broken...Â
i am running on VS 2017, anaconda 5.2 and python 3.6.8 ...
 hummmm...Â
Kow Gate
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!