0

I am tring to call VectorBT using C#, a python package for backtesting.

Meeting the below bug:

'[WinError 87] The parameter is incorrect: '.\Library\bin''

  File "D:\ProgramData\Anaconda3\lib\os.py", line 1111, in add_dll_directory
    cookie = nt._add_dll_directory(path)
  File "D:\ProgramData\Anaconda3\lib\site-packages\llvmlite\binding\ffi.py", line 162, in <module>
    os.add_dll_directory(os.path.join(os.path.normpath(sys.prefix), 'Library', 'bin'))
  File "D:\ProgramData\Anaconda3\lib\site-packages\llvmlite\binding\dylib.py", line 3, in <module>
    from llvmlite.binding import ffi
  File "D:\ProgramData\Anaconda3\lib\site-packages\llvmlite\binding\__init__.py", line 4, in <module>
    from .dylib import *
  File "D:\ProgramData\Anaconda3\lib\site-packages\numba\core\config.py", line 15, in <module>
    import llvmlite.binding as ll
  File "D:\ProgramData\Anaconda3\lib\site-packages\numba\__init__.py", line 19, in <module>
    from numba.core import config
  File "C:\Users\Rex\AppData\Roaming\Python\Python39\site-packages\vectorbt\_typing.py", line 15, in <module>
    from numba.core.registry import CPUDispatcher
  File "C:\Users\Rex\AppData\Roaming\Python\Python39\site-packages\vectorbt\generic\drawdowns.py", line 171, in <module>
    from vectorbt import _typing as tp
  File "C:\Users\Rex\AppData\Roaming\Python\Python39\site-packages\vectorbt\generic\__init__.py", line 8, in <module>
    from vectorbt.generic.drawdowns import Drawdowns
  File "C:\Users\Rex\AppData\Roaming\Python\Python39\site-packages\vectorbt\__init__.py", line 12, in <module>
    from vectorbt.generic import nb, plotting
   at Python.Runtime.PythonException.ThrowLastAsClrException()
   at Python.Runtime.PyModule.Import(String name)
   at PythonnetSampleConsoleApp.VectorBT.VectorBTMethod() in E:\Github\PythonNetSample\src\PythonnetSampleConsole\VectorBT.cs:line 64
   at PythonnetSampleConsoleApp.Program.Main(String[] args) in E:\Github\PythonNetSample\src\PythonnetSampleConsole\Program.cs:line 32

Printscreen: https://i.stack.imgur.com/9dN1a.png

Any suggestion? Does Anaconda3 contain the VectorBt package?

Environment: Visual Studio 2022 + Anaconda3

Rex
  • 59
  • 7

1 Answers1

0

I found the reason, it's because that anaconda3 does not contain the package "vectorBT". But when I install using "conda install vectorbt", I got the below notice “package not found error, the following packages are not available from current channels” print screen: [1]: https://i.stack.imgur.com/H1Frh.png

follow up question: how to install vectorbt to anaconda3?

Rex
  • 59
  • 7
  • I think you need to use pip but activate the conda environment first: https://stackoverflow.com/questions/41060382/using-pip-to-install-packages-to-anaconda-environment – user1689987 Mar 07 '23 at 23:15