marcdemers / py_vollib_vectorized

A vectorized implementation of py_vollib, that supports numpy arrays and pandas Series and DataFrames.
MIT License
121 stars 30 forks source link

ModuleNotFoundError: No module named '_testcapi' #11

Open xxholyChalicexx opened 1 year ago

xxholyChalicexx commented 1 year ago

When i deploy my django app with import py_vollib_vectorized in my views.py file My site will be crashed and when i watch the log it says:

import py_vollib_vectorized File "/venv/lib/python3.7/site-packages/py_vollib_vectorized/init.py", line 6, in from .api import get_all_greeks, price_dataframe File "/venv/lib/python3.7/site-packages/py_vollib_vectorized/api.py", line 7, in from .models import vectorized_black, vectorized_black_scholes, vectorized_black_scholes_merton File "venv/lib/python3.7/site-packages/py_vollib_vectorized/models.py", line 4, in from ._model_calls import _black_scholes_merton_vectorized_call, _black_vectorized_call, _black_scholes_vectorized_call File "venv/lib/python3.7/site-packages/py_vollib_vectorized/_model_calls.py", line 2, in from py_lets_be_rational.constants import * File "venv/lib/python3.7/site-packages/py_lets_be_rational/init.py", line 30, in from py_lets_be_rational.lets_be_rational import black File "venv/lib/python3.7/site-packages/py_lets_be_rational/lets_be_rational.py", line 35, in from py_lets_be_rational.exceptions import BelowIntrinsicException, AboveMaximumException File "venv/lib/python3.7/site-packages/py_lets_be_rational/exceptions.py", line 30, in  from py_lets_be_rational import constants File "venv/lib/python3.7/site-packages/py_lets_be_rational/constants.py", line 32, in from _testcapi import DBL_MIN, DBL_MAX  ModuleNotFoundError: No module named '_testcapi'

: So this is after the installation of this "py_volib_vectorized" library. If i just comment out the importing of this library, it gets deployed successfully. Python version: 3.7 Django version: 3.1.1

xxholyChalicexx commented 1 year ago

OK, after checking on this error and comparing it with my system turns out in the python folder of "/usr/lib/python" have this folder called "lib-dynload" which consist of this file _testcapi......for some uknown(for now) reason its not available in my live server OS. Trying to figure out on that missing piece of folder.