vectorbt icon indicating copy to clipboard operation
vectorbt copied to clipboard

Can't import into Google Colab

Open Ron-27 opened this issue 2 years ago • 3 comments

While trying to import into Google Colab using import vectorbt as vbt whenPyYAML version 6 is used, I get the error message:

[/usr/local/lib/python3.7/dist-packages/distributed/config.py](https://localhost:8080/#) in <module>()
     18 
     19 with open(fn) as f:
---> 20     defaults = yaml.load(f)
     21 
     22 dask.config.update_defaults(defaults)

TypeError: load() missing 1 required positional argument: 'Loader'

Is there anyway to use vectorbt with PyYAML 6 ?

Ron-27 avatar Mar 28 '22 20:03 Ron-27

@Ron-27 vectorbt doesn't require PyYAML. A bit of googling helps: https://stackoverflow.com/a/69565230

polakowo avatar Mar 29 '22 20:03 polakowo

Yes, I saw this thread, but I'm using it with alpaca-trade-api, which uses PyYAML 6. For some reason when installing vectorbt it installs earlier version of PyYAML and won't import if it's an updated version of PyYAML. In summary, I can't use these two libraries together on Google Colab because I get the above error while trying to import vectorbt

Ron-27 avatar Mar 29 '22 21:03 Ron-27

@Ron-27

For some reason when installing vectorbt it installs earlier version of PyYAML

vectorbt still use alpaca-trade-api 1.4, that maybe explain why it install earlier version of pyyaml.

I can't use these two libraries together on Google Colab

#267 propose !pip install dateparser --upgrade:

!pip install alpaca-trade-api>=2.1.0
!pip install vectorbt==0.23.3
!pip install dateparser --upgrade
import vectorbt as vbt

No run for me.

#267 propose to force pyyaml==5.4.1:

!pip install alpaca-trade-api>=2.1.0
!pip install vectorbt==0.23.3
!pip install pyyaml==5.4.1
import vectorbt as vbt

That solves the issue. But that can raise resolution conflict with other package during the installation

For the moment, I haven't find other better solution

dev590t avatar Aug 17 '22 19:08 dev590t