{
  "source_file": "0930",
  "source_platform": "Medium",
  "author": "Dario Radečić",
  "title_listed": "Python Poetry - The Best Data Science Dependency Management Tool?",
  "keywords": "Poetry,依赖管理",
  "domain": "数据处理",
  "content_type": "深度技术解析",
  "is_paid_flag": "部分免费/会员墙",
  "url": "https://towardsdatascience.com/python-poetry-the-best-data-science-dependency-management-tool-cca260257dd5/",
  "publish_date": "2024-07",
  "corpus_stage": "预训练/SFT",
  "notes": "",
  "id": "7b9125aa5d8b",
  "collected_at": "2026-10-01T21:00:42",
  "title": "Python Poetry - The Best Data Science Dependency Management Tool? | Towards Data Science",
  "body_markdown": "![Revisit consent button](https://cdn-cookieyes.com/assets/images/revisit.svg)\nWe value your privacy\nWe use cookies to enhance your browsing experience, serve personalised ads or content, and analyse our traffic. By clicking \"Accept All\", you consent to our use of cookies.\nCustomise Reject All Accept All\nCustomise Consent Preferences ![](https://cdn-cookieyes.com/assets/images/close.svg)\nWe use cookies to help you navigate efficiently and perform certain functions. You will find detailed information about all cookies under each consent category below.\nThe cookies that are categorised as \"Necessary\" are stored on your browser as they are essential for enabling the basic functionalities of the site. ... Show more\nNecessaryAlways Active\nNecessary cookies are required to enable the basic features of this site, such as providing secure log-in or adjusting your consent preferences. These cookies do not store any personally identifiable data.\n  * Cookie\nBCTempID\n  * Duration\n10 minutes\n  * Description\nNo description available.\n\n\n  * Cookie\n__cf_bm\n  * Duration\n1 hour\n  * Description\nThis cookie, set by Cloudflare, is used to support Cloudflare Bot Management. \n\n\n  * Cookie\nAWSALBCORS\n  * Duration\n7 days\n  * Description\nAmazon Web Services set this cookie for load balancing.\n\n\n  * Cookie\n_cfuvid\n  * Duration\nsession\n  * Description\nCloudflare sets this cookie to track users across sessions to optimize user experience by maintaining session consistency and providing personalized services\n\n\n  * Cookie\nli_gc\n  * Duration\n6 months\n  * Description\nLinkedin set this cookie for storing visitor's consent regarding using cookies for non-essential purposes.\n\n\n  * Cookie\n__hssrc\n  * Duration\nsession\n  * Description\nThis cookie is set by Hubspot whenever it changes the session cookie. The __hssrc cookie set to 1 indicates that the user has restarted the browser, and if the cookie does not exist, it is assumed to be a new session.\n\n\n  * Cookie\n__hssc\n  * Duration\n1 hour\n  * Description\nHubSpot sets this cookie to keep track of sessions and to determine if HubSpot should increment the session number and timestamps in the __hstc cookie.\n\n\n  * Cookie\nwpEmojiSettingsSupports\n  * Duration\nsession\n  * Description\nWordPress sets this cookie when a user interacts with emojis on a WordPress site. It helps determine if the user's browser can display emojis properly.\n\n\n  * Cookie\nBCSessionID\n  * Duration\n1 year 1 month 4 days\n  * Description\nBlueconic sets this cookie as a unique identifier for the BlueConic profile.\n\n\n  * Cookie\n_octo\n  * Duration\n1 year\n  * Description\nNo description available.\n\n\n  * Cookie\nlogged_in\n  * Duration\n1 year\n  * Description\nNo description available.\n\n\n  * Cookie\n__Secure-YEC\n  * Duration\npast\n  * Description\nYouTube sets this cookie to stores the user's video player preferences using embedded YouTube video\n\n\n  * Cookie\n__eoi\n  * Duration\n6 months\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nAWSALBTGCORS\n  * Duration\n7 days\n  * Description\nNo description available.\n\n\n  * Cookie\nlogin-status-p\n  * Duration\npast\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nAWSALBTG\n  * Duration\n7 days\n  * Description\nNo description available.\n\n\n  * Cookie\ncsrf_token\n  * Duration\nsession\n  * Description\nNo description available.\n\n\n  * Cookie\ntoken_v2\n  * Duration\n1 day\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nD\n  * Duration\n1 year\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nPHPSESSID\n  * Duration\nsession\n  * Description\nThis cookie is native to PHP applications. The cookie stores and identifies a user's unique session ID to manage user sessions on the website. The cookie is a session cookie and will be deleted when all the browser windows are closed.\n\n\n  * Cookie\nVISITOR_PRIVACY_METADATA\n  * Duration\n6 months\n  * Description\nYouTube sets this cookie to store the user's cookie consent state for the current domain. \n\n\n  * Cookie\ncookietest\n  * Duration\nsession\n  * Description\nThe cookietest cookie is typically used to determine whether the user's browser accepts cookies, essential for website functionality and user experience.\n\n\n  * Cookie\n__Host-airtable-session\n  * Duration\n1 year\n  * Description\nThis cookie is used to enable us to integrate the services of Airtable.\n\n\n  * Cookie\n__Host-airtable-session.sig\n  * Duration\n1 year\n  * Description\nThis cookie is used to enable us to integrate the services of Airtable.\n\n\n  * Cookie\nm\n  * Duration\n1 year 1 month 4 days\n  * Description\nStripe sets this cookie for fraud prevention purposes. It identifies the device used to access the website, allowing the website to be formatted accordingly.\n\n\n  * Cookie\nBIGipServer*\n  * Duration\nsession\n  * Description\nMarketo sets this cookie to collect information about the user's online activity and build a profile about their interests to provide advertisements relevant to the user. \n\n\n  * Cookie\n__cfruid\n  * Duration\nsession\n  * Description\nCloudflare sets this cookie to identify trusted web traffic.\n\n\n  * Cookie\n_GRECAPTCHA\n  * Duration\n6 months\n  * Description\nGoogle Recaptcha service sets this cookie to identify bots to protect the website against malicious spam attacks.\n\n\n  * Cookie\n__Secure-YNID\n  * Duration\n6 months\n  * Description\nGoogle cookie used to protect user security and prevent fraud, especially during the login process.\n\n\n  * Cookie\ncookieyes-consent\n  * Duration\n1 year\n  * Description\nCookieYes sets this cookie to remember users' consent preferences so that their preferences are respected on subsequent visits to this site. It does not collect or store any personal information about the site visitors.\n\n\nFunctional\nFunctional cookies help perform certain functionalities like sharing the content of the website on social media platforms, collecting feedback, and other third-party features.\n  * Cookie\nlidc\n  * Duration\n1 day\n  * Description\nLinkedIn sets the lidc cookie to facilitate data center selection.\n\n\n  * Cookie\nbrw\n  * Duration\n1 year\n  * Description\nNo description available.\n\n\n  * Cookie\nbrwConsent\n  * Duration\n5 minutes\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nWMF-Uniq\n  * Duration\n1 year\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nloom_anon_comment\n  * Duration\n1 year\n  * Description\nNo description available.\n\n\n  * Cookie\nloom_referral_video\n  * Duration\nsession\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nVISITOR_INFO1_LIVE\n  * Duration\n6 months\n  * Description\nA cookie set by YouTube to measure bandwidth that determines whether the user gets the new or old player interface.\n\n\n  * Cookie\nyt-remote-connected-devices\n  * Duration\nNever Expires\n  * Description\nYouTube sets this cookie to store the user's video preferences using embedded YouTube videos.\n\n\n  * Cookie\nytidb::LAST_RESULT_ENTRY_KEY\n  * Duration\nNever Expires\n  * Description\nThe cookie ytidb::LAST_RESULT_ENTRY_KEY is used by YouTube to store the last search result entry that was clicked by the user. This information is used to improve the user experience by providing more relevant search results in the future.\n\n\n  * Cookie\nyt-remote-device-id\n  * Duration\nNever Expires\n  * Description\nYouTube sets this cookie to store the user's video preferences using embedded YouTube videos.\n\n\n  * Cookie\nyt-remote-session-name\n  * Duration\nsession\n  * Description\nThe yt-remote-session-name cookie is used by YouTube to store the user's video player preferences using embedded YouTube video.\n\n\n  * Cookie\nyt-remote-fast-check-period\n  * Duration\nsession\n  * Description\nThe yt-remote-fast-check-period cookie is used by YouTube to store the user's video player preferences for embedded YouTube videos.\n\n\n  * Cookie\nyt-remote-session-app\n  * Duration\nsession\n  * Description\nThe yt-remote-session-app cookie is used by YouTube to store user preferences and information about the interface of the embedded YouTube video player.\n\n\n  * Cookie\nyt-remote-cast-available\n  * Duration\nsession\n  * Description\nThe yt-remote-cast-available cookie is used to store the user's preferences regarding whether casting is available on their YouTube video player.\n\n\n  * Cookie\nyt-remote-cast-installed\n  * Duration\nsession\n  * Description\nThe yt-remote-cast-installed cookie is used to store the user's video player preferences using embedded YouTube video.\n\n\n  * Cookie\ncp_session\n  * Duration\n3 months\n  * Description\nCodepen sets this cookie for Help systems found in the website.\n\n\n  * Cookie\nloid\n  * Duration\n1 year 1 month 4 days\n  * Description\nThis cookie is set by the Reddit. The cookie enables the sharing of content from the website onto the social media platform.\n\n\nAnalytics\nAnalytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics such as the number of visitors, bounce rate, traffic source, etc.\n  * Cookie\n__hstc\n  * Duration\n6 months\n  * Description\nHubspot set this main cookie for tracking visitors. It contains the domain, initial timestamp (first visit), last timestamp (last visit), current timestamp (this visit), and session number (increments for each subsequent session).\n\n\n  * Cookie\nhubspotutk\n  * Duration\n6 months\n  * Description\nHubSpot sets this cookie to keep track of the visitors to the website. This cookie is passed to HubSpot on form submission and used when deduplicating contacts.\n\n\n  * Cookie\n_ga\n  * Duration\n1 year 1 month 4 days\n  * Description\nGoogle Analytics sets this cookie to calculate visitor, session and campaign data and track site usage for the site's analytics report. The cookie stores information anonymously and assigns a randomly generated number to recognise unique visitors.\n\n\n  * Cookie\n_ga_*\n  * Duration\n1 year 1 month 4 days\n  * Description\nGoogle Analytics sets this cookie to store and count page views.\n\n\n  * Cookie\n__Host-psifi.analyticsTrace\n  * Duration\n6 hours\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\n__Host-psifi.analyticsTraceV2\n  * Duration\n6 hours\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\n_gh_sess\n  * Duration\nsession\n  * Description\nGitHub sets this cookie for temporary application and framework state between pages like what step the user is on in a multiple step form.\n\n\n  * Cookie\nYSC\n  * Duration\nsession\n  * Description\nYSC cookie is set by Youtube and is used to track the views of embedded videos on Youtube pages.\n\n\n  * Cookie\najs_anonymous_id\n  * Duration\n1 year\n  * Description\nThis cookie is set by Segment to count the number of people who visit a certain site by tracking if they have visited before.\n\n\n  * Cookie\nvuid\n  * Duration\n1 year 1 month 4 days\n  * Description\nVimeo installs this cookie to collect tracking information by setting a unique ID to embed videos on the website. \n\n\nPerformance\nPerformance cookies are used to understand and analyse the key performance indexes of the website which helps in delivering a better user experience for the visitors.\n  * Cookie\nAWSALB\n  * Duration\n7 days\n  * Description\nAWSALB is an application load balancer cookie set by Amazon Web Services to map the session to the target.\n\n\n  * Cookie\nacq\n  * Duration\npast\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nacq.sig\n  * Duration\npast\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nptc\n  * Duration\n2 years\n  * Description\nNo description available.\n\n\nAdvertisement\nAdvertisement cookies are used to provide visitors with customised advertisements based on the pages you visited previously and to analyse the effectiveness of the ad campaigns.\n  * Cookie\nmuc_ads\n  * Duration\n1 year 1 month 4 days\n  * Description\nTwitter sets this cookie to collect user behaviour and interaction data to optimize the website.\n\n\n  * Cookie\nguest_id_marketing\n  * Duration\n1 year 1 month 4 days\n  * Description\nTwitter sets this cookie to identify and track the website visitor.\n\n\n  * Cookie\nguest_id_ads\n  * Duration\n1 year 1 month 4 days\n  * Description\nTwitter sets this cookie to identify and track the website visitor.\n\n\n  * Cookie\npersonalization_id\n  * Duration\n1 year 1 month 4 days\n  * Description\nTwitter sets this cookie to integrate and share features for social media and also store information about how the user uses the website, for tracking and targeting.\n\n\n  * Cookie\nguest_id\n  * Duration\n1 year 1 month 4 days\n  * Description\nTwitter sets this cookie to identify and track the website visitor. It registers if a user is signed in to the Twitter platform and collects information about ad preferences.\n\n\n  * Cookie\nbcookie\n  * Duration\n1 year\n  * Description\nLinkedIn sets this cookie from LinkedIn share buttons and ad tags to recognize browser IDs.\n\n\n  * Cookie\n__Secure-ROLLOUT_TOKEN\n  * Duration\n6 months\n  * Description\nYouTube sets this cookie to manage feature rollout and experimentation. It helps Google control which new features or interface changes are shown to users as part of testing and staged rollouts, ensuring consistent experience for a given user during an experiment.\n\n\n  * Cookie\nyt.innertube::nextId\n  * Duration\nNever Expires\n  * Description\nYouTube sets this cookie to register a unique ID to store data on what videos from YouTube the user has seen.\n\n\n  * Cookie\nyt.innertube::requests\n  * Duration\nNever Expires\n  * Description\nYouTube sets this cookie to register a unique ID to store data on what videos from YouTube the user has seen.\n\n\n  * Cookie\nsession_tracker\n  * Duration\nsession\n  * Description\nThis cookie is set by the Reddit. This cookie is used to identify trusted web traffic. It also helps in adverstising on the website.\n\n\n  * Cookie\nedgebucket\n  * Duration\nsession\n  * Description\nReddit sets this cookie to save the information about a log-on Reddit user, for the purpose of advertisement recommendations and updating the content.\n\n\n  * Cookie\ndid\n  * Duration\n1 year\n  * Description\nArbor sets this cookie to show targeted ads to site visitors.This cookie expires after 2 months or 1 year.\n\n\nUncategorised\nOther uncategorised cookies are those that are being analysed and have not been classified into a category as yet.\nNo cookies to display.\nReject All Save My Preferences Accept All\nToggle Search[](https://towardsdatascience.com/)Toggle Mobile Navigation\n[](https://towardsdatascience.com/)\nPublish AI, ML & data-science insights to a global community of data professionals.\nSign in[Submit an Article](https://write.insightmediagroup.io)\n[Latest](https://towardsdatascience.com/latest/)[Editor's Picks](https://towardsdatascience.com/tag/editors-pick/)[Newsletter](https://towardsdatascience.com/tag/the-variable/)[ShipAI](https://towardsdatascience.com/shipai/)\n* * *\n[Write For TDS](https://towardsdatascience.com/submissions/)\n[LinkedIn](https://www.linkedin.com/company/towards-data-science/)[X](https://x.com/TDataScience)Toggle Search\n[Data Science](https://towardsdatascience.com/category/data-science/)\n# Python Poetry - The Best Data Science Dependency Management Tool?\nPoetry makes deploying machine learning applications a breeze - learn how!\n[Dario Radečić](https://towardsdatascience.com/author/radecicdario/)\nJuly 30, 20248 min read\n![Photo by Prachi Gautam on Unsplash](https://assets.insightmediagroup.io/media/wp-content/uploads/2024/07/0f5clQDQz6czZpe4o-scaled.jpg)\nPhoto by [Prachi Gautam](https://unsplash.com/@prachi30gautam?utm_source=medium&utm_medium=referral) on [Unsplash](https://unsplash.com?utm_source=medium&utm_medium=referral)\nIf I had a dollar every time I faced a missing Python dependency or a version mismatch, well, I wouldn't be a millionaire, but you get the point.\nDependency management is a common problem in data science with many potential solutions. A **virtual environment** is always recommended, but that's only the beginning. It's usually followed by keeping track of installed packages. **But what about their dependencies?** And dependencies of their dependencies? It's a recursive nightmare.\n[Poetry](https://python-poetry.org) might be the solution you're looking for. It aims to be a one-stop-shop for everything dependency management related, and can even be used for publishing Python packages.\nToday, you'll build a simple machine learning application locally and then push it to a remote compute instance. If Poetry keeps up to its promise, the remote setup should be as simple as running a single shell command.\n* * *\nLearn this step by step with the interactive [AI and Data Scientist](https://roadmap.sh/ai-data-scientist), [Computer Science](https://roadmap.sh/computer-science) and [Machine Learning](https://roadmap.sh/machine-learning) roadmaps.\n## How to Get Started with Poetry\nA small inconvenience with Poetry is that you can't start with a `pip install` command. It needs an additional command line tool.\n### Install Poetry\nAnd that command line tool is called [pipx](https://pipx.pypa.io/stable/installation/). The installation instructions for Mac are pretty straightforward (follow the above link for other operating systems):\nbash\n\n```\nbrew install pipx\npipx ensurepath\nsudo pipx ensurepath --global\n```\n\nOnce pipx is installed, install Poetry with the following command:\nbash\n\n```\npipx install poetry\n```\n\nJust a slight inconvenience, but it's over now.\n### Create a new Poetry Project\nThe `poetry new <name>` command initializes a new Python project and creates an appropriately named folder:\nbash\n\n```\npoetry new ml-demo\n```\n\n![Image 1 - New Poetry project output \\(image by author\\)](https://assets.insightmediagroup.io/media/wp-content/uploads/2024/07/1nlh_QGLFMFYOxobS1QKEVw.png)\nImage 1 - New Poetry project output (image by author)\nThese are the files that'll get created:\n![Image 2 - Directory structure \\(image by author\\)](https://assets.insightmediagroup.io/media/wp-content/uploads/2024/07/1BOLSiyVdevRlQBjcxe694Q.png)\nImage 2 - Directory structure (image by author)\nThe file to focus your attention now is `pyproject.toml`. It contains details of your app, external dependencies, and the minimum required Python version.\n**If you don't want to publish the package** , which you don't want in this case, add the following line to the first block:\nini\n\n```\n[tool.poetry]\npackage-mode = false\n```\n\n![Image 3 - The pyproject.toml file \\(image by author\\)](https://assets.insightmediagroup.io/media/wp-content/uploads/2024/07/1gDKZKD4uppXk-4LGmp-yMw.png)\nImage 3 - The pyproject.toml file (image by author)\nYou can also remove the `tests` and `ml_demo` folders if you wish.\nWe'll return to this file after installing a couple of dependencies.\n## Python Poetry in Action - A Sample Machine Learning Application\nYour machine learning app will be a simple decision tree model trained on the Iris dataset and made available through a multi-worker FastAPI service.\nAny dependency you need is not installed with `pip install`, but rather with `poetry add` command:\nbash\n\n```\npoetry add numpy pandas scikit-learn fastapi gunicorn\n```\n\n![Image 4 - Installing Python packages \\(image by author\\)](https://assets.insightmediagroup.io/media/wp-content/uploads/2024/07/1cDI_gu9sc9dxDSKMNWCZWw.png)\nImage 4 - Installing Python packages (image by author)\nThis creates a virtual environment if it doesn't exist, installs the packages and create/update the `poetry.lock` file:\n![Image 5 - The poetry.lock file \\(image by author\\)](https://assets.insightmediagroup.io/media/wp-content/uploads/2024/07/1HTbbhI9YK1wHNAqXeGxo-g.png)\nImage 5 - The poetry.lock file (image by author)\nIn plain English, the lock file handles the recursive nightmare of dependency management.\nThe `pyproject.toml` file was also updated, but it shows only the dependencies you've explicitly installed:\n![Image 6— The pyproject.toml file \\(2\\) \\(image by author\\)](https://assets.insightmediagroup.io/media/wp-content/uploads/2024/07/1Ujw4eYIjakBzwy0cxdtzNA.png)\nImage 6— The pyproject.toml file (2) (image by author)\nSo far, so good!\n### Visual Studio Code Setup\nYou'll face an annoying issue when you start writing Python code in an editor such as VSCode - **the editor doesn't know where to find the newly created virtual environment!**\nAnd neither do you.\nThe `poetry show -v` command lists the path to the virtual environment and shows dependencies it has installed:\nbash\n\n```\npoetry show -v\n```\n\n![Image 7 - Listing virtual environment details \\(image by author\\)](https://assets.insightmediagroup.io/media/wp-content/uploads/2024/07/1nN-uhS7LPPM4Ys0oSd-3Ig.png)\nImage 7 - Listing virtual environment details (image by author)\nIf you want only the environment's absolute path, opt for this command instead:\nbash\n\n```\npoetry env info -p\n```\n\n![Image 8 - Printing absolute path to the Python environment \\(image by author\\)](https://assets.insightmediagroup.io/media/wp-content/uploads/2024/07/1agYnYrXg5H8zCsL3TxajaA.png)\nImage 8 - Printing absolute path to the Python environment (image by author)\nNow in Visual Studio Code (or any other editor), simply change the path to your Python interpreter. Copy the path returned by the above command, and add `/bin/python3.<version>` to the end. I'm using Python 3.12, so the part to append becomes `/bin/python3.12`:\nbash\n\n```\n/<path-to-environment>/bin/python3.<version>\n```\n\n![Image 9 - Setting up VSCode interpreter \\(image by author\\)](https://assets.insightmediagroup.io/media/wp-content/uploads/2024/07/1I8taZdlDtcH-6CT7C5sO0w.png)\nImage 9 - Setting up VSCode interpreter (image by author)\nThe import errors will now disappear.\n### Machine Learning Application\nOnto the app now. Create a `utils/ml.py` file and copy the following code:\npython\n\n```\nimport os\nimport pickle\nfrom sklearn.datasets import load_iris\nfrom sklearn.tree import DecisionTreeClassifier\n\nMODEL_PATH = \"ml_models/iris.model\"\n\ndef train_model() -> DecisionTreeClassifier:\n    iris = load_iris()\n    X = iris.data\n    y = iris.target\n    model = DecisionTreeClassifier()\n    model.fit(X, y)\n    return model\n\ndef save_model(model: DecisionTreeClassifier) -> bool:\n    os.makedirs(os.path.dirname(MODEL_PATH), exist_ok=True)\n    try:\n        with open(MODEL_PATH, \"wb\") as f:\n            pickle.dump(model, f)\n        return True\n    except Exception as e:\n        print(f\"An error occurred while saving the model: {e}\")\n        return False\n\ndef load_model() -> DecisionTreeClassifier:\n    try:\n        with open(MODEL_PATH, 'rb') as f:\n            model = pickle.load(f)\n        return model\n    except Exception as e:\n        print(f\"An error occurred while loading the model: {e}\")\n        raise e\n\ndef predict(\n        model: DecisionTreeClassifier, \n        sepal_length: float, \n        sepal_width: float, \n        petal_length: float, \n        petal_width: float\n    ) -> dict:\n    prediction = model.predict([[sepal_length, sepal_width, petal_length, petal_width]])\n    prediction_str = \"\"\n    match prediction:\n        case 0:\n            prediction_str = \"setosa\"\n        case 1:\n            prediction_str = \"versicolor\"\n        case 2:\n            prediction_str = \"virginica\"\n\n    prediction_prob = model.predict_proba([[sepal_length, sepal_width, petal_length, petal_width]])\n    return {\n        \"prediction\": prediction_str,\n        \"prediction_probabilities\": prediction_prob[0].tolist()\n    }\n```\n\nIt's a simple file with a couple of functions to train the model, make a single prediction, and read/write the model file to/from disk.\nAlso, create `main.py` file to test the functionality:\npython\n\n```\nfrom utils.ml import train_model, save_model, load_model, predict\n\nif __name__ == \"__main__\":\n    model = train_model()\n    did_save = save_model(model=model)\n    if did_save:\n        print(\"Model saved\")\n    loaded_model = load_model()\n    pred = predict(\n        model=loaded_model,\n        sepal_length=4.2,\n        sepal_width=3.1,\n        petal_length=3.4,\n        petal_width=4.1\n    )\n    print(pred)\n```\n\nTo use the virtual environment created by Poetry, **you must prepend Python script run commands** with `poetry run`:\nbash\n\n```\npoetry run python main.py\n```\n\n![Image 10 - Model prediction result \\(image by author\\)](https://assets.insightmediagroup.io/media/wp-content/uploads/2024/07/1TV7AR6BheOcCnI7_GyB4KQ.png)\nImage 10 - Model prediction result (image by author)\nYou get the prediction class and probabilities back, so it's safe to assume everything works as advertised.\n### FastAPI Application\nFinally, replace the contents of `main.py` will the following code snippet:\npython\n\n```\nimport os\nfrom fastapi import FastAPI\nfrom pydantic import BaseModel\nfrom utils.ml import train_model, save_model, load_model, predict\n\napp = FastAPI()\nmodel = None\n\n# Request body for prediction\nclass IrisFeatures(BaseModel):\n    sepal_length: float\n    sepal_width: float\n    petal_length: float\n    petal_width: float\n\n# Ensure the model is loaded on startup\n@app.on_event(\"startup\")\ndef startup_event():\n    if not os.path.exists(\"ml_models/iris.model\"):\n        _model = train_model()\n        did_save_model = save_model(model=_model)\n        if did_save_model:\n            print(\"Model trained and saved successfully.\")\n        else:\n            print(\"Model training and saving failed.\")\n    global model\n    model = load_model()\n\n# The prediction endpoint\n@app.post(\"/predict\")\ndef make_prediction(iris: IrisFeatures):\n    return predict(\n        model=model,\n        sepal_length=iris.sepal_length,\n        sepal_width=iris.sepal_width,\n        petal_length=iris.petal_length,\n        petal_width=iris.petal_width\n    )\n```\n\nIt will create or load the model when the application starts (depending if the model already exists), and expose the prediction functionality on the `/predict` endpoint.\nFor the final bit of testing, run the FastAPI application through Gunicorn and optionally increase the number of workers. It doesn't make any difference locally, but changing this parameter will allow more users to access your API at the same time:\nbash\n\n```\npoetry run gunicorn main:app --workers 4 --worker-class uvicorn.workers.UvicornWorker --bind 0.0.0.0:8500\n```\n\n![Image 11 - FastAPI startup \\(image by author\\)](https://assets.insightmediagroup.io/media/wp-content/uploads/2024/07/1oIWkGBQosGdGT7exjHs1Nw.png)\nImage 11 - FastAPI startup (image by author)\nSeems like the app is running, so let's test it:\n![Image 12 - Model prediction result \\(2\\) \\(image by author\\)](https://assets.insightmediagroup.io/media/wp-content/uploads/2024/07/1X1YfW7oInbKN7DCMTRcguA.png)\nImage 12 - Model prediction result (2) (image by author)\nThe correct output is returned! Let's now transfer the app to a new environment to see what happens.\n## Test on a New Environment - EC2 Instance\nI've provisioned a **free tier EC2 instance** (Ubuntu) on AWS for this section of the article.\nAssuming you've done the same, and assuming yours also comes with Python 3.12 (specified in `pyproject.toml`) or later, run the following set of commands to update the system and install Poetry:\nbash\n\n```\nsudo apt update &amp;&amp; sudo apt upgrade -y\nsudo apt install gunicorn -y\n\nsudo apt install pipx -y\npipx ensurepath\nsudo pipx ensurepath --global\n\npipx install poetry\n```\n\n![Image 13 - Linux machine setup \\(image by author\\)](https://assets.insightmediagroup.io/media/wp-content/uploads/2024/07/10GCdVtmdtCiUTbiJntd4Og.png)\nImage 13 - Linux machine setup (image by author)\nVisual Studio Code has a neat [Remote SSH plugin](https://code.visualstudio.com/docs/remote/ssh) that allows you to connect to remote instances. But really, any SCP tool will do the trick.\nI've copied our `ml-demo` folder with Python code and Poetry environment details:\n![Image 14 - Directory structure \\(image by author\\)](https://assets.insightmediagroup.io/media/wp-content/uploads/2024/07/1NaBLvAWCZdCyyMnPD4cXXg.png)\nImage 14 - Directory structure (image by author)\nPoetry promises to make dependency management in new environments a breeze. All you have to do is navigate to the application folder and run the `poetry install` command:\nbash\n\n```\ncd ml-demo\npoetry install\n```\n\n![Image 15 - Package installation \\(image by author\\)](https://assets.insightmediagroup.io/media/wp-content/uploads/2024/07/1da3TWzPOvwuyUTWK_Y9eOQ.png)\nImage 15 - Package installation (image by author)\nIt seems like a new virtual environment was created and dependencies were installed.\nThe ultimate test will be running the same FastAPI startup command you ran moments ago in a local environment. If no errors are raised, Poetry has delivered on its promise:\nbash\n\n```\npoetry run gunicorn main:app --workers 4 --worker-class uvicorn.workers.UvicornWorker --bind 0.0.0.0:8500\n```\n\n![Image 16 - FastAPI startup on a remote instance \\(image by author\\)](https://assets.insightmediagroup.io/media/wp-content/uploads/2024/07/1jy8c4LiAQHwQL2gr-g_vjA.png)\nImage 16 - FastAPI startup on a remote instance (image by author)\nThe app looks to be running, which is great news! Now, assuming you've allowed traffic to port 8500, you will be able to make requests to the `/predict` endpoint:\n![Image 17 - Model prediction result \\(3\\) \\(image by author\\)](https://assets.insightmediagroup.io/media/wp-content/uploads/2024/07/1M7Yxud4Yf9akNsKn6JpS7A.png)\nImage 17 - Model prediction result (3) (image by author)\nYou should get the same response back as with the local testing. If the request hangs for a while and then dies, your instance likely doesn't allow traffic on the port the app is running on.\nAnyhow, the deployment process sure was a breeze.\n* * *\n## Summing up Python Poetry\nTools like Poetry promise to reduce the number of migraines you get during model deployment. They also allow you to focus on what's important, such as improving model quality and enriching its response, and not waste time on errors that shouldn't happen in the first place.\nFor the short time I've been using Poetry on my day job, I've yet to find an error in which Poetry is to blame. Don't get me wrong, I've seen errors after running the `poetry install` command, but they've all been OS-related. Like forgetting to install Gunicorn or something even dumber.\n_Have you used Poetry professionally? Did you encounter any issues and/or limitations?_ Make sure to let me know in the comment section below.\n**Read next:**\n> [**Python Concurrency - A Brain-Friendly Guide for Data Professionals**](https://towardsdatascience.com/python-concurrency-a-brain-friendly-guide-for-data-professionals-a6215a3e9e26)\n## Register Now to Continue Reading\n### Unlock Towards Data Science with a Free Account\nAll articles on Towards Data Science are available to registered users. Create a free account today to access this article and thousands more.\nRegister for freeSign in to your account\n* * *\n![](https://assets.insightmediagroup.io/media/1787657095692_93hujy.png)\nWritten By\n## [Dario Radečić](https://towardsdatascience.com/author/radecicdario/)\nhttps://writingfordevs.substack.com\n[See all from Dario Radečić](https://towardsdatascience.com/author/radecicdario/)\n[Data Science](https://towardsdatascience.com/tag/data-science/)[Machine Learning](https://towardsdatascience.com/tag/machine-learning/)[Programming](https://towardsdatascience.com/tag/programming/)[Python](https://towardsdatascience.com/tag/python/)[Software Development](https://towardsdatascience.com/tag/software-development/)\nShare This Article\n  * [](https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Ftowardsdatascience.com%2Fpython-poetry-the-best-data-science-dependency-management-tool-cca260257dd5%2F&title=Python%20Poetry%20-%20The%20Best%20Data%20Science%20Dependency%20Management%20Tool%3F)\n  * [](https://www.linkedin.com/shareArticle?mini=true&url=https%3A%2F%2Ftowardsdatascience.com%2Fpython-poetry-the-best-data-science-dependency-management-tool-cca260257dd5%2F&title=Python%20Poetry%20-%20The%20Best%20Data%20Science%20Dependency%20Management%20Tool%3F)\n  * [](https://x.com/share?url=https%3A%2F%2Ftowardsdatascience.com%2Fpython-poetry-the-best-data-science-dependency-management-tool-cca260257dd5%2F&text=Python%20Poetry%20-%20The%20Best%20Data%20Science%20Dependency%20Management%20Tool%3F)\n\n\nTowards Data Science is a community publication. Submit your insights to reach our global audience and earn through the TDS Author Payment Program.\n[Write for TDS](https://towardsdatascience.com/submissions/)\n## Related Articles\n  * [![](https://assets.insightmediagroup.io/media/wp-content/uploads/2023/08/1IB22-8qoNpIITYqKA034lQ.png)](https://towardsdatascience.com/variational-autoencoder-vae-with-discrete-distribution-using-gumbel-softmax-b3f749b3417e/)\n## [Variational Autoencoder (VAE) with Discrete Distribution using Gumbel Softmax](https://towardsdatascience.com/variational-autoencoder-vae-with-discrete-distribution-using-gumbel-softmax-b3f749b3417e/)\n[Deep Learning](https://towardsdatascience.com/category/artificial-intelligence/deep-learning/)\nTheory and PyTorch Implementation\n[Alexey Kravets](https://towardsdatascience.com/author/alexml0123/)\nAugust 9, 202317 min read\n  * [![](https://assets.insightmediagroup.io/media/wp-content/uploads/2021/01/1Amm2Ei9zbk7V0_fCcr_6qg.png)](https://towardsdatascience.com/image-processing-with-python-template-matching-with-scikit-image-6e82fdd77b66/)\n## [Image Processing with Python - Template Matching with Scikit-Image](https://towardsdatascience.com/image-processing-with-python-template-matching-with-scikit-image-6e82fdd77b66/)\n[Data Science](https://towardsdatascience.com/category/data-science/)\nHow to identify similar objects in your image\n[Tonichi Edeza](https://towardsdatascience.com/author/tonichi-edeza/)\nJanuary 30, 20216 min read\n  * [![](https://assets.insightmediagroup.io/media/wp-content/uploads/2023/02/0uAsMEPw6JJa52JlD.png)](https://towardsdatascience.com/when-milliseconds-matter-my-journey-to-performance-improvement-5a3cd69754c4/)\n## [When Milliseconds Matter - My Journey to Performance Improvement](https://towardsdatascience.com/when-milliseconds-matter-my-journey-to-performance-improvement-5a3cd69754c4/)\n[](https://towardsdatascience.com/python-poetry-the-best-data-science-dependency-management-tool-cca260257dd5/)\nLessons Learned From a Latency Improvement Project\n[Naomi Kriger](https://towardsdatascience.com/author/naomikriger/)\nFebruary 15, 20236 min read\n  * [![](https://assets.insightmediagroup.io/media/wp-content/uploads/2021/01/0Hzm_TfY2YhS91zXH-scaled.jpg)](https://towardsdatascience.com/what-makes-for-a-good-movie-8e10896e0f1b/)\n## [What makes for a good movie?](https://towardsdatascience.com/what-makes-for-a-good-movie-8e10896e0f1b/)\n[Film](https://towardsdatascience.com/category/film/)\nComparing audience and critic ratings using data from Rotten Tomatoes.\n[Harry Roper](https://towardsdatascience.com/author/harryroper96/)\nJanuary 16, 20219 min read\n  * [![](https://assets.insightmediagroup.io/media/wp-content/uploads/2021/09/1z1fcMHHwl2ol-GoW-NHkg-scaled.jpeg)](https://towardsdatascience.com/python-parse-library-simple-way-for-reversing-f-strings-72ad4d59e7c4/)\n## [Python Parse Library: Simple Way For Reversing F-strings](https://towardsdatascience.com/python-parse-library-simple-way-for-reversing-f-strings-72ad4d59e7c4/)\n[Artificial Intelligence](https://towardsdatascience.com/category/artificial-intelligence/)\nWe sometimes need to go the other way around.\n[Soner Yıldırım](https://towardsdatascience.com/author/sonery/)\nSeptember 5, 20214 min read\n  * [![](https://assets.insightmediagroup.io/media/wp-content/uploads/2022/07/0EiAOE_P_5Lh6z6G_-scaled.jpg)](https://towardsdatascience.com/3-steps-to-build-airflow-pipelines-with-efficient-resource-utilisation-b9f399d29fb3/)\n## [3 steps for Building Airflow Pipelines with Efficient Resource Utilisation](https://towardsdatascience.com/3-steps-to-build-airflow-pipelines-with-efficient-resource-utilisation-b9f399d29fb3/)\n[Programming](https://towardsdatascience.com/category/programming/)\nBuilding data pipelines that utilise infrastructure efficiently is a blend of multiple components. This blog explores those concepts ...\n[Vachan Anand](https://towardsdatascience.com/author/vachan15/)\nJuly 3, 20222 min read\n  * [![](https://assets.insightmediagroup.io/media/wp-content/uploads/2019/05/112Ml9R813nJ6zea-il8HjQ.png)](https://towardsdatascience.com/lessons-from-a-real-machine-learning-project-part-1-from-jupyter-to-luigi-bdfd0b050ca5/)\n## [Lessons from a real Machine Learning project, part 1: from Jupyter to Luigi](https://towardsdatascience.com/lessons-from-a-real-machine-learning-project-part-1-from-jupyter-to-luigi-bdfd0b050ca5/)\n[Machine Learning](https://towardsdatascience.com/category/artificial-intelligence/machine-learning/)\nA brief story about how we realized how to use - and how not not use - Jupyter notebooks in Machine Learning projects\n[Emanuele Fabbiani](https://towardsdatascience.com/author/donlelef/)\nMay 6, 20196 min read\n  * [![](https://assets.insightmediagroup.io/media/wp-content/uploads/2024/01/0y50MYOW60Csw0Ly1.png)](https://towardsdatascience.com/fine-tuning-llms-on-a-single-consumer-graphic-card-6de1587daddb/)\n## [Fine Tuning LLMs on a Single Consumer Graphic Card](https://towardsdatascience.com/fine-tuning-llms-on-a-single-consumer-graphic-card-6de1587daddb/)\n[Artificial Intelligence](https://towardsdatascience.com/category/artificial-intelligence/)\nLearnings from fine-tuning a large language model on a single consumer GPU\n[Naser Tamimi](https://towardsdatascience.com/author/tamimi-naser/)\nJanuary 31, 202410 min read\n  * [![](https://assets.insightmediagroup.io/media/wp-content/uploads/2022/02/0x7vuZ-Opv1Y7PURC-scaled.jpg)](https://towardsdatascience.com/the-most-favorable-pre-trained-sentiment-classifiers-in-python-9107c06442c6/)\n## [The Most Favorable Pre-trained Sentiment Classifiers in Python](https://towardsdatascience.com/the-most-favorable-pre-trained-sentiment-classifiers-in-python-9107c06442c6/)\n[NLP](https://towardsdatascience.com/category/artificial-intelligence/nlp/)\nInspecting the performance of Vader, Happy Transformer, TextBlob, and Google NL API, discussing their limitations and tips for selecting...\n[Petr Koráb](https://towardsdatascience.com/author/petrkorab/)\nFebruary 11, 20228 min read\n\n\n  * [YouTube](https://www.youtube.com/c/TowardsDataScience)\n  * [X](https://x.com/TDataScience)\n  * [LinkedIn](https://www.linkedin.com/company/towards-data-science/)\n  * [Threads](https://www.threads.net/@towardsdatascience)\n  * [Bluesky](https://bsky.app/profile/towardsdatascience.com)\n\n\n[](https://towardsdatascience.com/)\nYour home for data science and AI. The world's leading publication for data science, data analytics, data engineering, machine learning, and artificial intelligence professionals.\nSubscribe to Our Newsletter[Write For TDS](https://towardsdatascience.com/submissions/)•[About](https://towardsdatascience.com/about-towards-data-science-d691af11cc2f/)•[Advertise](https://contact.towardsdatascience.com/advertise-with-towards-data-science)•[Privacy Policy](https://towardsdatascience.com/privacy-policy/)•[Terms of Use](https://towardsdatascience.com/website-terms-of-use/)\n© Insight Media Group, LLC 2026•[The New Stack](https://thenewstack.io)•[roadmap.sh](https://roadmap.sh)•[Creator Network](https://insightmediagroup.io/creator-network)\n####  Recommended Articles \nClose\n  * [ ![](https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/607686/image?etag=1782161464448&width=500&height=500) How Relevance Models Foreshadowed Transformers for NLP ](https://towardsdatascience.com/how-relevance-models-foreshadowed-transformers-for-nlp/ \"How Relevance Models Foreshadowed Transformers for NLP\")\n  * [ ![](https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/607639/image?etag=1781250125848&width=500&height=500) Javascript Fatigue: HTMX Is All You Need to Build ChatGPT — Part 1 ](https://towardsdatascience.com/javascript-fatigue-you-dont-need-js-to-build-chatgpt/ \"Javascript Fatigue: HTMX Is All You Need to Build ChatGPT — Part 1\")\n  * [ ![](https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/607930/image?etag=1782124566054&width=500&height=500) The Subset Sum Problem Solved in Linear Time for Dense Enough Inputs ](https://towardsdatascience.com/subset-sum-problem-solved-in-linear-time-for-dense-enough-inputs/ \"The Subset Sum Problem Solved in Linear Time for Dense Enough Inputs\")\n  * [ ![](https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/3660/image?etag=1780176246070&width=500&height=500) Does Your Company Have a Data Strategy? ](https://towardsdatascience.com/does-your-company-have-a-data-strategy-e8944dbec4ae/ \"Does Your Company Have a Data Strategy?\")\n\n\n",
  "metadata": {
    "title": "Python Poetry - The Best Data Science Dependency Management Tool? | Towards Data Science",
    "description": "Poetry makes deploying machine learning applications a breeze - learn how!",
    "keywords": null,
    "author": "Dario Radečić",
    "og:locale": "en_US",
    "og:type": "article",
    "og:title": "Python Poetry - The Best Data Science Dependency Management Tool?",
    "og:description": "Poetry makes deploying machine learning applications a breeze - learn how!",
    "og:url": "https://towardsdatascience.com/python-poetry-the-best-data-science-dependency-management-tool-cca260257dd5/",
    "og:site_name": "Towards Data Science",
    "og:image": "https://assets.insightmediagroup.io/media/wp-content/uploads/2024/07/0f5clQDQz6czZpe4o-scaled.jpg",
    "og:image:width": "1708",
    "og:image:height": "2560",
    "og:image:type": "image/jpeg",
    "twitter:card": "summary_large_image",
    "twitter:site": "@TDataScience",
    "twitter:creator": "@TDataScience",
    "twitter:label1": "Written by",
    "twitter:data1": "Dario Radečić",
    "twitter:label2": "Est. reading time",
    "twitter:data2": "8 min read",
    "article:published_time": "2024-07-30T13:23:09.000Z",
    "article:modified_time": "2024-07-30T13:23:09.000Z",
    "article:author": "https://towardsdatascience.com/author/radecicdario/"
  },
  "paywall": {
    "listed_paid": true,
    "detected": false,
    "marker": "",
    "public_only": true,
    "policy": "付费/会员内容只保留页面公开可见部分，不绕过付费墙"
  },
  "crawl": {
    "success": true,
    "status_code": 202,
    "error": ""
  },
  "code_blocks": [
    {
      "language": "txt",
      "file": "attachments/7b9125aa5d8b/code/block_000.txt",
      "chars": 64
    },
    {
      "language": "txt",
      "file": "attachments/7b9125aa5d8b/code/block_001.txt",
      "chars": 20
    },
    {
      "language": "txt",
      "file": "attachments/7b9125aa5d8b/code/block_002.txt",
      "chars": 19
    },
    {
      "language": "txt",
      "file": "attachments/7b9125aa5d8b/code/block_003.txt",
      "chars": 35
    },
    {
      "language": "txt",
      "file": "attachments/7b9125aa5d8b/code/block_004.txt",
      "chars": 54
    },
    {
      "language": "txt",
      "file": "attachments/7b9125aa5d8b/code/block_005.txt",
      "chars": 15
    },
    {
      "language": "txt",
      "file": "attachments/7b9125aa5d8b/code/block_006.txt",
      "chars": 19
    },
    {
      "language": "txt",
      "file": "attachments/7b9125aa5d8b/code/block_007.txt",
      "chars": 45
    },
    {
      "language": "txt",
      "file": "attachments/7b9125aa5d8b/code/block_008.txt",
      "chars": 1633
    },
    {
      "language": "txt",
      "file": "attachments/7b9125aa5d8b/code/block_009.txt",
      "chars": 408
    },
    {
      "language": "txt",
      "file": "attachments/7b9125aa5d8b/code/block_010.txt",
      "chars": 26
    },
    {
      "language": "txt",
      "file": "attachments/7b9125aa5d8b/code/block_011.txt",
      "chars": 1029
    },
    {
      "language": "txt",
      "file": "attachments/7b9125aa5d8b/code/block_012.txt",
      "chars": 106
    },
    {
      "language": "txt",
      "file": "attachments/7b9125aa5d8b/code/block_013.txt",
      "chars": 169
    },
    {
      "language": "txt",
      "file": "attachments/7b9125aa5d8b/code/block_014.txt",
      "chars": 26
    },
    {
      "language": "txt",
      "file": "attachments/7b9125aa5d8b/code/block_015.txt",
      "chars": 106
    }
  ],
  "images": [
    {
      "src": "https://assets.insightmediagroup.io/media/wp-content/uploads/2024/07/0f5clQDQz6czZpe4o-scaled.jpg",
      "alt": "Photo by Prachi Gautam on Unsplash",
      "local_path": "attachments/7b9125aa5d8b/images/000.jpg",
      "bytes": 342827,
      "downloaded": true
    },
    {
      "src": "https://assets.insightmediagroup.io/media/wp-content/uploads/2024/07/1nlh_QGLFMFYOxobS1QKEVw.png",
      "alt": "Image 1 - New Poetry project output (image by author)",
      "local_path": "attachments/7b9125aa5d8b/images/001.png",
      "bytes": 59547,
      "downloaded": true
    },
    {
      "src": "https://assets.insightmediagroup.io/media/wp-content/uploads/2024/07/1BOLSiyVdevRlQBjcxe694Q.png",
      "alt": "Image 2 - Directory structure (image by author)",
      "local_path": "attachments/7b9125aa5d8b/images/002.png",
      "bytes": 65989,
      "downloaded": true
    },
    {
      "src": "https://assets.insightmediagroup.io/media/wp-content/uploads/2024/07/1gDKZKD4uppXk-4LGmp-yMw.png",
      "alt": "Image 3 - The pyproject.toml file (image by author)",
      "local_path": "attachments/7b9125aa5d8b/images/003.png",
      "bytes": 118584,
      "downloaded": true
    },
    {
      "src": "https://assets.insightmediagroup.io/media/wp-content/uploads/2024/07/1cDI_gu9sc9dxDSKMNWCZWw.png",
      "alt": "Image 4 - Installing Python packages (image by author)",
      "local_path": "attachments/7b9125aa5d8b/images/004.png",
      "bytes": 277143,
      "downloaded": true
    },
    {
      "src": "https://assets.insightmediagroup.io/media/wp-content/uploads/2024/07/1HTbbhI9YK1wHNAqXeGxo-g.png",
      "alt": "Image 5 - The poetry.lock file (image by author)",
      "local_path": "attachments/7b9125aa5d8b/images/005.png",
      "bytes": 240654,
      "downloaded": true
    },
    {
      "src": "https://assets.insightmediagroup.io/media/wp-content/uploads/2024/07/1Ujw4eYIjakBzwy0cxdtzNA.png",
      "alt": "Image 6— The pyproject.toml file (2) (image by author)",
      "local_path": "attachments/7b9125aa5d8b/images/006.png",
      "bytes": 126090,
      "downloaded": true
    },
    {
      "src": "https://assets.insightmediagroup.io/media/wp-content/uploads/2024/07/1nN-uhS7LPPM4Ys0oSd-3Ig.png",
      "alt": "Image 7 - Listing virtual environment details (image by author)",
      "local_path": "attachments/7b9125aa5d8b/images/007.png",
      "bytes": 480206,
      "downloaded": true
    },
    {
      "src": "https://assets.insightmediagroup.io/media/wp-content/uploads/2024/07/1agYnYrXg5H8zCsL3TxajaA.png",
      "alt": "Image 8 - Printing absolute path to the Python environment (image by author)",
      "local_path": "attachments/7b9125aa5d8b/images/008.png",
      "bytes": 63780,
      "downloaded": true
    },
    {
      "src": "https://assets.insightmediagroup.io/media/wp-content/uploads/2024/07/1I8taZdlDtcH-6CT7C5sO0w.png",
      "alt": "Image 9 - Setting up VSCode interpreter (image by author)",
      "local_path": "attachments/7b9125aa5d8b/images/009.png",
      "bytes": 74561,
      "downloaded": true
    },
    {
      "src": "https://assets.insightmediagroup.io/media/wp-content/uploads/2024/07/1TV7AR6BheOcCnI7_GyB4KQ.png",
      "alt": "Image 10 - Model prediction result (image by author)",
      "local_path": "attachments/7b9125aa5d8b/images/010.png",
      "bytes": 67028,
      "downloaded": true
    },
    {
      "src": "https://assets.insightmediagroup.io/media/wp-content/uploads/2024/07/1oIWkGBQosGdGT7exjHs1Nw.png",
      "alt": "Image 11 - FastAPI startup (image by author)",
      "local_path": "attachments/7b9125aa5d8b/images/011.png",
      "bytes": 449836,
      "downloaded": true
    },
    {
      "src": "https://assets.insightmediagroup.io/media/wp-content/uploads/2024/07/1X1YfW7oInbKN7DCMTRcguA.png",
      "alt": "Image 12 - Model prediction result (2) (image by author)",
      "local_path": "attachments/7b9125aa5d8b/images/012.png",
      "bytes": 254568,
      "downloaded": true
    },
    {
      "src": "https://assets.insightmediagroup.io/media/wp-content/uploads/2024/07/10GCdVtmdtCiUTbiJntd4Og.png",
      "alt": "Image 13 - Linux machine setup (image by author)",
      "local_path": "attachments/7b9125aa5d8b/images/013.png",
      "bytes": 156888,
      "downloaded": true
    },
    {
      "src": "https://assets.insightmediagroup.io/media/wp-content/uploads/2024/07/1NaBLvAWCZdCyyMnPD4cXXg.png",
      "alt": "Image 14 - Directory structure (image by author)",
      "local_path": "attachments/7b9125aa5d8b/images/014.png",
      "bytes": 168224,
      "downloaded": true
    },
    {
      "src": "https://assets.insightmediagroup.io/media/wp-content/uploads/2023/08/1IB22-8qoNpIITYqKA034lQ.png",
      "alt": "",
      "local_path": "attachments/7b9125aa5d8b/images/015.png",
      "bytes": 191525,
      "downloaded": true
    },
    {
      "src": "https://assets.insightmediagroup.io/media/wp-content/uploads/2021/01/1Amm2Ei9zbk7V0_fCcr_6qg.png",
      "alt": "",
      "local_path": "attachments/7b9125aa5d8b/images/016.png",
      "bytes": 1503556,
      "downloaded": true
    },
    {
      "src": "https://assets.insightmediagroup.io/media/wp-content/uploads/2023/02/0uAsMEPw6JJa52JlD.png",
      "alt": "",
      "local_path": "attachments/7b9125aa5d8b/images/017.png",
      "bytes": 1719137,
      "downloaded": true
    },
    {
      "src": "https://assets.insightmediagroup.io/media/wp-content/uploads/2021/01/0Hzm_TfY2YhS91zXH-scaled.jpg",
      "alt": "",
      "local_path": "attachments/7b9125aa5d8b/images/018.jpg",
      "bytes": 605158,
      "downloaded": true
    },
    {
      "src": "https://assets.insightmediagroup.io/media/wp-content/uploads/2021/09/1z1fcMHHwl2ol-GoW-NHkg-scaled.jpeg",
      "alt": "",
      "local_path": "attachments/7b9125aa5d8b/images/019.jpeg",
      "bytes": 239044,
      "downloaded": true
    },
    {
      "src": "https://assets.insightmediagroup.io/media/wp-content/uploads/2022/07/0EiAOE_P_5Lh6z6G_-scaled.jpg",
      "alt": "",
      "local_path": "attachments/7b9125aa5d8b/images/020.jpg",
      "bytes": 424886,
      "downloaded": true
    },
    {
      "src": "https://assets.insightmediagroup.io/media/wp-content/uploads/2019/05/112Ml9R813nJ6zea-il8HjQ.png",
      "alt": "",
      "local_path": "attachments/7b9125aa5d8b/images/021.png",
      "bytes": 70248,
      "downloaded": true
    },
    {
      "src": "https://assets.insightmediagroup.io/media/wp-content/uploads/2024/01/0y50MYOW60Csw0Ly1.png",
      "alt": "",
      "local_path": "attachments/7b9125aa5d8b/images/022.png",
      "bytes": 1682817,
      "downloaded": true
    },
    {
      "src": "https://assets.insightmediagroup.io/media/wp-content/uploads/2022/02/0x7vuZ-Opv1Y7PURC-scaled.jpg",
      "alt": "",
      "local_path": "attachments/7b9125aa5d8b/images/023.jpg",
      "bytes": 195995,
      "downloaded": true
    }
  ],
  "audio": [],
  "videos": [
    {
      "src": "https://www.youtube.com/c/TowardsDataScience",
      "quality": "unavailable",
      "local_path": "",
      "note": "无1080p且无720p，未交付更低清晰度"
    }
  ],
  "links": [
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/latest/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/tag/editors-pick/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/tag/the-variable/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/shipai/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/submissions/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/category/data-science/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/author/radecicdario/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/python-concurrency-a-brain-friendly-guide-for-data-professionals-a6215a3e9e26"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/tag/data-science/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/tag/machine-learning/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/tag/programming/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/tag/python/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/tag/software-development/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/variational-autoencoder-vae-with-discrete-distribution-using-gumbel-softmax-b3f749b3417e/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/category/artificial-intelligence/deep-learning/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/author/alexml0123/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/image-processing-with-python-template-matching-with-scikit-image-6e82fdd77b66/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/author/tonichi-edeza/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/when-milliseconds-matter-my-journey-to-performance-improvement-5a3cd69754c4/"
    },
    {
      "type": "external",
      "href": "https://write.insightmediagroup.io"
    },
    {
      "type": "external",
      "href": "https://www.linkedin.com/company/towards-data-science/"
    },
    {
      "type": "external",
      "href": "https://x.com/TDataScience"
    },
    {
      "type": "external",
      "href": "https://unsplash.com/@prachi30gautam"
    },
    {
      "type": "external",
      "href": "https://unsplash.com"
    },
    {
      "type": "external",
      "href": "https://python-poetry.org"
    },
    {
      "type": "external",
      "href": "https://roadmap.sh/ai-data-scientist"
    },
    {
      "type": "external",
      "href": "https://roadmap.sh/computer-science"
    },
    {
      "type": "external",
      "href": "https://roadmap.sh/machine-learning"
    },
    {
      "type": "external",
      "href": "https://pipx.pypa.io/stable/installation/"
    },
    {
      "type": "external",
      "href": "https://code.visualstudio.com/docs/remote/ssh"
    },
    {
      "type": "external",
      "href": "https://www.facebook.com/sharer/sharer.php?title=Python+Poetry+-+The+Best+Data+Science+Dependency+Management+Tool%3F&u=https%3A%2F%2Ftowardsdatascience.com%2Fpython-poetry-the-best-data-science-dependency-management-tool-cca260257dd5%2F"
    },
    {
      "type": "external",
      "href": "https://www.linkedin.com/shareArticle?mini=true&title=Python+Poetry+-+The+Best+Data+Science+Dependency+Management+Tool%3F&url=https%3A%2F%2Ftowardsdatascience.com%2Fpython-poetry-the-best-data-science-dependency-management-tool-cca260257dd5%2F"
    },
    {
      "type": "external",
      "href": "https://x.com/share?text=Python+Poetry+-+The+Best+Data+Science+Dependency+Management+Tool%3F&url=https%3A%2F%2Ftowardsdatascience.com%2Fpython-poetry-the-best-data-science-dependency-management-tool-cca260257dd5%2F"
    },
    {
      "type": "external",
      "href": "https://www.youtube.com/c/TowardsDataScience"
    },
    {
      "type": "external",
      "href": "https://www.threads.net/@towardsdatascience"
    },
    {
      "type": "external",
      "href": "https://bsky.app/profile/towardsdatascience.com"
    },
    {
      "type": "external",
      "href": "https://thenewstack.io"
    },
    {
      "type": "external",
      "href": "https://roadmap.sh"
    },
    {
      "type": "external",
      "href": "https://insightmediagroup.io/creator-network"
    }
  ],
  "repair_version": 2,
  "repaired_at": "2026-10-14T11:11:48Z",
  "source_url": "https://towardsdatascience.com/python-poetry-the-best-data-science-dependency-management-tool-cca260257dd5/",
  "delivery_status": "excluded_paid",
  "discovery_status": "excluded_paid",
  "missing_reason": "按原约定排除付费/会员全文"
}