vectorbt icon indicating copy to clipboard operation
vectorbt copied to clipboard

import errors

Open hayilmaz opened this issue 4 years ago • 6 comments

I am getting the following errors

from vectorbt.portfolio.nb import auto_call_seq_ctx_nb ImportError: cannot import name 'auto_call_seq_ctx_nb' from 'vectorbt.portfolio.nb'

from vectorbt.portfolio.nb import order_nb ImportError: cannot import name 'order_nb' from 'vectorbt.portfolio.nb'

hayilmaz avatar Jun 23 '21 15:06 hayilmaz

Generally, it's a sign that you import another package with the same name. Do you have any directory called "vectorbt"?

polakowo avatar Jun 23 '21 15:06 polakowo

I don’t and except those two all other imports are working. I was wondering if the version update was causing them.

H. Adem Yilmaz

On Jun 23, 2021, at 8:13 AM, Oleg Polakow @.***> wrote:

 Generally, it's a sign that you import another package with the same name. Do you have any directory called "vectorbt"?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

hayilmaz avatar Jun 23 '21 15:06 hayilmaz

order_nb is not part of any release, it's on the master's branch (which is in a steady development), maybe you are looking for create_order_nb? auto_call_seq_ctx_nb has been recently renamed to sort_call_seq_nb. The best place to look for the most recent naming is documentation.

Edit: create_order_nb will be renamed to order_nb in 0.19. In the future, I will create a separate branch for development just to avoid this kind of issues.

polakowo avatar Jun 23 '21 15:06 polakowo

After your email, I just installed a fresh copy of vectorbt[full] in its own environment and using the example you have under the examples folder “PortfolioOPtimization.ipynb”.

in the import group of that example, there is a group of imports:

import vectorbt as vbt from vectorbt.generic.nb import nanmean_nb from vectorbt.portfolio.nb import order_nb, sort_call_seq_nb from vectorbt.portfolio.enums import SizeType, Direction

which order_nb is one of the imports. When I run that I still get an error

ImportError: cannot import name 'order_nb' from 'vectorbt.portfolio.nb'

On Jun 23, 2021, at 8:22 AM, Oleg Polakow @.***> wrote:

order_nb is not part of any release, it's on the master's branch (which is in a steady development), maybe you are looking for create_order_nb? auto_call_seq_ctx_nb has been recently renamed to sort_call_seq_nb. The best place to look for the most recent naming is documentation https://polakowo.io/vectorbt/docs/portfolio/nb.html.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/polakowo/vectorbt/issues/177#issuecomment-866932358, or unsubscribe https://github.com/notifications/unsubscribe-auth/AI56YAJYSIWI6DKPC6UPFHTTUH32VANCNFSM47GABHIQ.

hayilmaz avatar Jun 23 '21 15:06 hayilmaz

Here's the notebook that corresponds to the latest version of vectorbt: https://nbviewer.jupyter.org/github/polakowo/vectorbt/blob/866b46c7c390eab5b50e642d793cfe6c7f3b8042/examples/PortfolioOptimization.ipynb

The issue is that even in the documentation all notebooks refer to the master branch. I will fix this later. Or, you can wait a couple of days until 0.19 is out.

polakowo avatar Jun 23 '21 15:06 polakowo

Thank you for your quick response.

On Jun 23, 2021, at 8:40 AM, Oleg Polakow @.***> wrote:

Here's the notebook that corresponds to the latest version of vectorbt: https://nbviewer.jupyter.org/github/polakowo/vectorbt/blob/866b46c7c390eab5b50e642d793cfe6c7f3b8042/examples/PortfolioOptimization.ipynb https://nbviewer.jupyter.org/github/polakowo/vectorbt/blob/866b46c7c390eab5b50e642d793cfe6c7f3b8042/examples/PortfolioOptimization.ipynb The issue is that even in the documentation all notebooks refer to the master branch. I will fix this later. Or, you can wait a couple of days until 0.19 is out.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/polakowo/vectorbt/issues/177#issuecomment-866947004, or unsubscribe https://github.com/notifications/unsubscribe-auth/AI56YAPJW4CMWSLRG5XN2QLTUH56ZANCNFSM47GABHIQ.

hayilmaz avatar Jun 23 '21 15:06 hayilmaz