Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

C extension error when running buy_and_hold_backtest.py #261

Closed
tansc1990 opened this issue May 1, 2018 · 3 comments
Closed

C extension error when running buy_and_hold_backtest.py #261

tansc1990 opened this issue May 1, 2018 · 3 comments

Comments

@tansc1990
Copy link

Hi,

I was trying out the README.md documentation and i encountered this error when running "python buy_and_hold_backtest.py"

`RuntimeError: module compiled against API version 0xc but this version of numpy is 0xa
Traceback (most recent call last):
File "/home/emperor/venv/qstraderp3/lib/python3.6/site-packages/pandas/init.py", line 25, in
from pandas import hashtable, tslib, lib
ImportError: numpy.core.multiarray failed to import

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "buy_and_hold_backtest.py", line 7, in
from qstrader.trading_session import TradingSession
File "/home/emperor/venv/qstraderp3/lib/python3.6/site-packages/qstrader/trading_session.py", line 5, in
from .price_handler.yahoo_daily_csv_bar import YahooDailyCsvBarPriceHandler
File "/home/emperor/venv/qstraderp3/lib/python3.6/site-packages/qstrader/price_handler/yahoo_daily_csv_bar.py", line 3, in
import pandas as pd
File "/home/emperor/venv/qstraderp3/lib/python3.6/site-packages/pandas/init.py", line 31, in
"extensions first.".format(module))
ImportError: C extension: umpy.core.multiarray failed to import not built. If you want to import pandas from the source directory, you may need to run 'python setup.py build_ext --inplace' to build the C extensions first.`

I am running on an Ubuntu 18.04 machine, are there any possible solutions/alternatives?

@JamesKBowler
Copy link

JamesKBowler commented May 1, 2018

without digging into the details too much, I would assume its a numpy compatibility issue with Ubuntu 18.04.

18.04 is bleeding edge, best open up an issue on numpy's page? Or try on 16.04

Also, have you seen this?
https://stackoverflow.com/questions/30761152/how-to-solve-import-error-for-pandas

or this

pandas-dev/pandas#18281

Cheers
James

@tansc1990
Copy link
Author

Thank you James! It works fine once I follow the instructions on the second link on #18281

@JamesKBowler
Copy link

You are welcome, happy to help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants