{"id":24289,"library":"py-vollib","title":"Py-Vollib","description":"Deprecated transition package for vollib, a Python library for pricing and calculating option implied volatility using Black-Scholes, Black (1976), and Garman-Kohlhagen models. Version 1.0.7 is the final release; users should install 'vollib' (the canonical package) instead. py_vollib is published as a stub that depends on vollib and provides deprecated compatibility imports. Release cadence is low; actively maintained on GitHub under the vollib organization.","status":"deprecated","version":"1.0.7","language":"python","source_language":"en","source_url":"https://github.com/vollib/py_vollib","tags":["options","black-scholes","implied-volatility","derivatives","finance","vollib","deprecated"],"install":[{"cmd":"pip install vollib","lang":"bash","label":"Install canonical package (recommended)"},{"cmd":"pip install py-vollib","lang":"bash","label":"Install deprecated transition package"}],"dependencies":[],"imports":[{"note":"py_vollib.* imports work via compatibility shim but are deprecated. Use vollib.* instead.","wrong":"from py_vollib.black_scholes import black_scholes","symbol":"black_scholes","correct":"from vollib.black_scholes import black_scholes"},{"note":"Same as above; prefer canonical vollib.","wrong":"from py_vollib.black import black","symbol":"black","correct":"from vollib.black import black"},{"note":"","wrong":"","symbol":"implied_volatility","correct":"from vollib.black_scholes import implied_volatility"}],"quickstart":{"code":"from vollib.black_scholes import black_scholes, implied_volatility\n\n# Option parameters\nS = 100.0   # underlying asset price\nK = 105.0   # strike price\nt = 0.5     # time to expiration in years\nr = 0.02    # risk-free rate\nsigma = 0.2 # implied volatility\nflag = 'c'  # 'c' for call, 'p' for put\n\n# Price using Black-Scholes\nprice = black_scholes(flag, S, K, t, r, sigma)\nprint(f\"Option price: {price:.4f}\")\n\n# Implied volatility from observed price\nobserved_price = 5.0\niv = implied_volatility(observed_price, S, K, t, r, flag)\nprint(f\"Implied volatility: {iv:.4f}\")","lang":"python","description":"Basic usage of vollib for Black-Scholes pricing and implied volatility calculation."},"warnings":[{"fix":"pip uninstall py-vollib && pip install vollib, then change imports from py_vollib to vollib.","message":"py-vollib is deprecated. The canonical package is 'vollib'. Install and import 'vollib' instead.","severity":"deprecated","affected_versions":">=1.0.7"},{"fix":"Do not install py-vollib; use vollib directly.","message":"Stale dependency path: py_vollib==1.0.7 pins an old vollib version. Avoid installing py_vollib directly.","severity":"breaking","affected_versions":"1.0.7"},{"fix":"Always use 'c' or 'p' (lowercase) and pass floats: e.g., S=100.0, not 100.","message":"Flag argument 'c'/'p' is case-sensitive; lower case only. Also, all numeric inputs must be floats (ints may cause type errors in some versions).","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Install the canonical package: pip install vollib, then import vollib.","cause":"Cannot import py_vollib after installing py-vollib (some environments break due to package name mismatch).","error":"ModuleNotFoundError: No module named 'py_vollib'"},{"fix":"Switch to vollib: from vollib.black_scholes import black_scholes","cause":"py_vollib compatibility shim missing or outdated.","error":"ImportError: cannot import name 'black_scholes' from 'py_vollib'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}